Java 类javax.swing.UIManager 实例源码
项目:EMC-Installer
文件:Installer.java
public Installer(JsonObject json) {
this.versions = json.entrySet();
System.out.println(versions.toString());
String low = "", high = "";
for (Map.Entry<String, JsonElement> entry : versions) {
if (high.isEmpty()) {
high = entry.getKey();
} else {
low = entry.getKey();
}
}
v = (low.isEmpty() ? high : low + "-" + high);
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
this.setTitle(Main.name + " Installer");
this.initGui();
}
项目:jdk8u-jdk
文件:MenuItemIconTest.java
public static void main(String[] args) throws Exception {
robot = new Robot();
String name = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(name);
} catch (ClassNotFoundException | InstantiationException |
IllegalAccessException | UnsupportedLookAndFeelException e) {
throw new RuntimeException("Test Failed");
}
createUI();
robot.waitForIdle();
executeTest();
if (!"".equals(errorMessage)) {
throw new RuntimeException(errorMessage);
}
}
项目:AgentWorkbench
文件:ProgressMonitor.java
/**
* Sets the look and feel of the dialog similar to the current application window
*/
private void setLookAndFeel() {
// --- Some exit options --------------------------
if (this.lookAndFeelClassName==null) return;
String currLookAndFeelClassName = UIManager.getLookAndFeel().getClass().getName();
if (this.lookAndFeelClassName.equals(currLookAndFeelClassName)==true) return;
// --- Try to set the look and feel ---------------
try {
UIManager.setLookAndFeel(this.lookAndFeelClassName);
SwingUtilities.updateComponentTreeUI(this.getProgressMonitorContainer());
} catch (Exception ex) {
System.err.println("Cannot install " + this.lookAndFeelClassName + " on this platform:" + ex.getMessage());
}
}
项目:Neukoelln_SER316
文件:TaskTable.java
/**
* updateUI is overridden to set the colors of the Tree's renderer to
* match that of the table.
*/
public void updateUI() {
super.updateUI();
// Make the tree's cell renderer use the table's cell selection
// colors.
TreeCellRenderer tcr = getCellRenderer();
if (tcr instanceof DefaultTreeCellRenderer) {
DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);
dtcr.setBorderSelectionColor(null);
dtcr.setTextSelectionColor(UIManager
.getColor("Table.selectionForeground"));
dtcr.setBackgroundSelectionColor(UIManager
.getColor("Table.selectionBackground"));
}
}
项目:jdk8u-jdk
文件:DefaultEditorKit.java
/** The operation to perform when this action is triggered. */
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
try {
int offs = target.getCaretPosition();
int begOffs = Utilities.getWordStart(target, offs);
if (select) {
target.moveCaretPosition(begOffs);
} else {
target.setCaretPosition(begOffs);
}
} catch (BadLocationException bl) {
UIManager.getLookAndFeel().provideErrorFeedback(target);
}
}
}
项目:openjdk-jdk10
文件:Test4319113.java
private void show(Window window) {
JButton jButton = new JButton("Show ColorChooser");
jButton.setActionCommand("Show ColorChooser");
jButton.addActionListener(this);
this.cbPlaf = new JComboBox<UIManager.LookAndFeelInfo>(UIManager.getInstalledLookAndFeels());
this.cbPlaf.addItemListener(new ItemListener(){
@Override
public void itemStateChanged(ItemEvent itemEvent) {
if (itemEvent.getStateChange() == 1) {
SwingUtilities.invokeLater(new Runnable(){
@Override
public void run() {
UIManager.LookAndFeelInfo lookAndFeelInfo = (UIManager.LookAndFeelInfo)Test4319113.this.cbPlaf.getSelectedItem();
try {
UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
Frame[] arrframe = Frame.getFrames();
int n = arrframe.length;
while (--n >= 0) {
Test4319113.updateWindowTreeUI(arrframe[n]);
}
}
catch (Exception var2_3) {
System.err.println("Exception while changing L&F!");
}
}
});
}
}
});
window.add(this.cbPlaf);
window.add(jButton);
window.pack();
window.setVisible(true);
}
项目:openjdk-jdk10
文件:MenuItemIconTest.java
public static void main(String[] args) throws Exception {
robot = new Robot();
String name = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(name);
} catch (ClassNotFoundException | InstantiationException |
IllegalAccessException | UnsupportedLookAndFeelException e) {
throw new RuntimeException("Test Failed");
}
createUI();
robot.waitForIdle();
executeTest();
if (!"".equals(errorMessage)) {
throw new RuntimeException(errorMessage);
}
}
项目:Equella
文件:BaseUtility.java
@SuppressWarnings("nls")
protected BaseUtility()
{
try
{
UIManager.setLookAndFeel(new FlatterLookAndFeel());
System.setProperty("org.apache.commons.logging.LogFactory",
"org.apache.commons.logging.impl.SLF4JLogFactory");
BlindSSLSocketFactory.register();
AxisProperties.setProperty("axis.socketSecureFactory",
"org.apache.axis.components.net.SunFakeTrustSocketFactory");
}
catch( UnsupportedLookAndFeelException e )
{
throw new RuntimeException(e);
}
data = new SharedData();
createGUI();
}
项目:school-game
文件:ToolsLauncher.java
/**
* Einstiegspunkt für das Tool.
*
* @param args wird nicht beachtet
* @throws Exception unterschiedliche Ursachen
*/
public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
}
catch (Exception e) {
e.printStackTrace();
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new ToolsLauncher();
}
});
}
项目:incubator-netbeans
文件:AquaViewTabDisplayerUI.java
@Override
protected void paintTabBackground(Graphics g, int index, int x, int y,
int width, int height) {
Graphics2D g2d = (Graphics2D) g;
Paint p = g2d.getPaint();
if( isSelected(index) ) {
g2d.setPaint( ColorUtil.getGradientPaint(x, y, UIManager.getColor("NbTabControl.selectedTabBrighterBackground"),
x, y+height/2, UIManager.getColor("NbTabControl.selectedTabDarkerBackground")) );
} else if( isMouseOver(index) ) {
g2d.setPaint( ColorUtil.getGradientPaint(x, y, UIManager.getColor("NbTabControl.mouseoverTabBrighterBackground"),
x, y+height/2, UIManager.getColor("NbTabControl.mouseoverTabDarkerBackground")) );
} else {
g2d.setPaint( ColorUtil.getGradientPaint(x, y, UIManager.getColor("NbTabControl.inactiveTabBrighterBackground"),
x, y+height/2, UIManager.getColor("NbTabControl.inactiveTabDarkerBackground")) );
}
g2d.fillRect(x, y, width, height);
g2d.setPaint(p);
}
项目:FJSTSeniorProjectSpring2017
文件:RegisterGUI.java
/** Creates new form RegisterGUI */
public RegisterGUI() {
/* Set Nimbus look and feel. */
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException exception) {
java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, exception);
}
initComponents();
Utils.setWindowCenterOfScreen(this);
setVisible(true);
}
项目:openjdk-jdk10
文件:TableHeaderRendererExceptionTest.java
public static void main(String[] args) throws Throwable {
//Execute test for all supported look and feels
UIManager.LookAndFeelInfo[] lookAndFeelArray
= UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
String lookAndFeelString = lookAndFeelItem.getClassName();
UIManager.setLookAndFeel(lookAndFeelString);
// Test getTableCellRendererComponent method by passing null table
JTableHeader header = new JTableHeader();
header.getDefaultRenderer().getTableCellRendererComponent(null,
" test ", true, true, -1, 0);
}
}
项目:incubator-netbeans
文件:OptionsAction.java
protected TreeView initGui () {
TTW retVal = new TTW () ;
split = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT);
PropertySheetView propertyView = new PropertySheetView();
split.setLeftComponent(retVal);
split.setRightComponent(propertyView);
// install proper border for split pane
split.setBorder((Border)UIManager.get("Nb.ScrollPane.border")); // NOI18N
setLayout (new java.awt.GridBagLayout ());
GridBagConstraints gridBagConstraints = new GridBagConstraints ();
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.gridwidth = 2;
add (split, gridBagConstraints);
return retVal;
}
项目:incubator-netbeans
文件:NotificationImpl.java
private JComponent createDetails( String text, ActionListener action ) {
if( null == action ) {
return new JLabel(text);
}
try {
text = "<html><u>" + XMLUtil.toElementContent(text); //NOI18N
} catch( CharConversionException ex ) {
throw new IllegalArgumentException(ex);
}
JButton btn = new JButton(text);
btn.setFocusable(false);
btn.setBorder(BorderFactory.createEmptyBorder());
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setOpaque(false);
btn.setContentAreaFilled(false);
btn.addActionListener(action);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
if (c != null) {
btn.setForeground(c);
}
return btn;
}
项目:swing-memory-game
文件:MemoryGame.java
/**
* Apply system default look and feel L&F.
*/
public static void lookF()
{
log.debug("Trying to apply default system look and feel...");
try
{
// Set to System L&F :
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// Set cross-platform Java L&F (also called "Metal")
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
log.debug("Success.");
} catch (Exception e)
{
log.debug("Error setting system look an feel : " + e);
}
}
项目:ObsidianSuite
文件:ObsidianAnimator.java
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
FMLInterModComms.sendRuntimeMessage(MODID, "VersionChecker", "addVersionCheck", VERSION_LINK);
instance = this;
proxy.init();
EventHandler eventHandler = new EventHandler();
MinecraftForge.EVENT_BUS.register(eventHandler);
if(FMLCommonHandler.instance().getEffectiveSide().isClient())
FMLCommonHandler.instance().bus().register(eventHandler);
//Minecraft.getMinecraft().gameSettings.showInventoryAchievementHint = false;
Minecraft.getMinecraft().gameSettings.saveOptions();
//Stop space from activating buttons, allowing it to be used for adding keyframes in the timeline.
InputMap im = (InputMap)UIManager.get("Button.focusInputMap");
im.put(KeyStroke.getKeyStroke("pressed SPACE"), "none");
im.put(KeyStroke.getKeyStroke("released SPACE"), "none");
}
项目:jdk8u-jdk
文件:TableExample2.java
public static void main(String[] args) {
if (args.length != 5) {
System.err.println("Needs database parameters eg. ...");
System.err.println(
"java TableExample2 \"jdbc:derby://localhost:1527/sample\" "
+ "org.apache.derby.jdbc.ClientDriver app app "
+ "\"select * from app.customer\"");
return;
}
// Trying to set Nimbus look and feel
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception ex) {
Logger.getLogger(TableExample2.class.getName()).log(Level.SEVERE,
"Failed to apply Nimbus look and feel", ex);
}
new TableExample2(args[0], args[1], args[2], args[3], args[4]);
}
项目:incubator-netbeans
文件:RunAnalysisPanel.java
@Messages({"LBL_RunAllAnalyzers=All Analyzers", "# {0} - the analyzer that should be run", "LBL_RunAnalyzer={0}"})
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (value == null) {
value = Bundle.LBL_RunAllAnalyzers();
} else if (value instanceof AnalyzerFactory) {
value = Bundle.LBL_RunAnalyzer(SPIAccessor.ACCESSOR.getAnalyzerDisplayName((AnalyzerFactory) value));
} else if (value instanceof Configuration) {
value = ((Configuration) value).getDisplayName();
} else if (value instanceof String) {
setFont(getFont().deriveFont(Font.ITALIC));
setText((String) value);
setEnabled(false);
setBackground(list.getBackground());
setForeground(UIManager.getColor("Label.disabledForeground"));
return this;
}
if (index == list.getModel().getSize()-5 && list.getModel() instanceof ConfigurationsComboModel && ((ConfigurationsComboModel) list.getModel()).canModify()) {
setBorder(new Separator(list.getForeground()));
} else {
setBorder(null);
}
return super.getListCellRendererComponent(list, (indent ? " " : "") + value, index, isSelected, cellHasFocus);
}
项目:incubator-netbeans
文件:ProjectInfoPanel.java
/** Creates new form ProjectInfoPanel */
public ProjectInfoPanel(Lookup lookup) {
super(lookup);
initComponents();
btnCheckout.setIcon(null);
if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N
setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
this.jPanel1.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
this.pnlCim.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
this.pnlIssues.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
this.pnlLicense.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
this.jPanel4.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
this.pnlMailingLists.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
this.pnlScm.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
}
}
项目:openjdk-jdk10
文件:HiDPIPropertiesUnixTest.java
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
String testCase = args[0];
switch (testCase) {
case "UISCALE_DISABLED":
testScale(1.0, 1.0);
break;
case "UISCALE_3":
testScale(3.0, 3.0);
break;
case "UISCALE_4":
testScale(4.0, 4.0);
break;
default:
throw new RuntimeException("Unknown test case: " + testCase);
}
}
项目:incubator-netbeans
文件:HtmlLabelUI.java
/** Get the system-wide unfocused selection background color */
private static Color getUnfocusedSelectionBackground() {
if (unfocusedSelBg == null) {
//allow theme/ui custom definition
unfocusedSelBg = UIManager.getColor("nb.explorer.unfocusedSelBg"); //NOI18N
if (unfocusedSelBg == null) {
//try to get standard shadow color
unfocusedSelBg = UIManager.getColor("controlShadow"); //NOI18N
if (unfocusedSelBg == null) {
//Okay, the look and feel doesn't suport it, punt
unfocusedSelBg = Color.lightGray;
}
//Lighten it a bit because disabled text will use controlShadow/
//gray
if (!Color.WHITE.equals(unfocusedSelBg.brighter())) {
unfocusedSelBg = unfocusedSelBg.brighter();
}
}
}
return unfocusedSelBg;
}
项目:incubator-netbeans
文件:TermOptionsPanel.java
private void fontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontButtonActionPerformed
PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
if (pe != null) {
pe.setValue(termOptions.getFont());
DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(), FontChooser_title());
String defaultFontString = FontChooser_defaultFont_label();
dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
defaultFontString, DialogDescriptor.CANCEL_OPTION}); //NOI18N
DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
Font f = (Font) pe.getValue();
termOptions.setFont(f);
applyTermOptions();
} else if (dd.getValue() == defaultFontString) {
Font controlFont = UIManager.getFont("controlFont"); //NOI18N
int fontSize = (controlFont == null) ? 12 : controlFont.getSize();
termOptions.setFont(new Font("monospaced", Font.PLAIN, fontSize)); //NOI18N
}
}
}
项目:Pixie
文件:GUILabelingTool.java
/**
* The entry point of application.
*
* @param args the command line arguments
*/
public static void main(String[] args) {
Logger logger = LoggerFactory.getLogger(GUILabelingTool.class);
System.getProperty("java.library.path");
/* Create and display the form */
java.awt.EventQueue.invokeLater(() -> {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// SplashScreen.startSplash()
GUILabelingTool gui = new GUILabelingTool(logger);
gui.setVisible(true);
// for the first run, some special configuration have to be done
gui.firstStartInitialization();
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
logger.error("Create and display form");
logger.debug("Create and display form {}", ex);
}
});
}
项目:OpenJSharp
文件:DefaultEditorKit.java
/** The operation to perform when this action is triggered. */
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
try {
int offs = target.getCaretPosition();
int endOffs = Utilities.getWordEnd(target, offs);
if (select) {
target.moveCaretPosition(endOffs);
} else {
target.setCaretPosition(endOffs);
}
} catch (BadLocationException bl) {
UIManager.getLookAndFeel().provideErrorFeedback(target);
}
}
}
项目:VisualGraphviz
文件:MainFrame.java
private void init(int w, int h) {
this.setBounds((Toolkit.getDefaultToolkit().getScreenSize().width - w) / 2,
(Toolkit.getDefaultToolkit().getScreenSize().height - h) / 2, w, h);
this.setTitle("Visual Graphviz v1.04");
this.setFont(buttonFont);
this.setLayout(null);
/* set close operation */
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
/* set window style */
try {
/* UIManager.setLookAndFeel(WINDOWS_STYLE); */
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
/* this.setResizable(false); */
container = this.getContentPane();
container.setLayout(null);
}
项目:NoMoreOversleeps
文件:Main.java
static void complain(String message) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException, URISyntaxException, InterruptedException
{
// Resort to a Swing Y/N dialog asking if the user wants to update Java.
// If they click yes, their default browser will open to the JAVA_UPDATE_URL
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
int reply = JOptionPane.showConfirmDialog(null, message, "NoMoreOversleeps", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE);
if (reply == 0)
{
String platformCode = "";
if (PlatformData.platformType == PlatformType.WINDOWS)
{
platformCode = PlatformData.is64bitOS ? "?platform=win64" : "?platform=win32";
}
else if (PlatformData.platformType == PlatformType.MAC)
{
platformCode = "?platform=mac";
}
else
{
platformCode = "?platform=linux";
}
java.awt.Desktop.getDesktop().browse(new URI(Main.JAVA_UPDATE_URL + platformCode));
Thread.sleep(100);
}
}
项目:Rubus
文件:SetupUtils.java
static synchronized Border getEtchedBorder() {
if (etchedBorder == null) {
etchedBorder = UIManager.getBorder( "TitledBorder.aquaVariant" );
if (etchedBorder == null)
etchedBorder = BorderFactory.createCompoundBorder(new EtchedBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5));
}
return etchedBorder;
}
项目:openjdk-jdk10
文件:MetalThemeMenu.java
public void actionPerformed(ActionEvent e) {
String numStr = e.getActionCommand();
MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
MetalLookAndFeel.setCurrentTheme(selectedTheme);
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception ex) {
System.out.println("Failed loading Metal");
System.out.println(ex);
}
}
项目:Reinickendorf_SER316
文件:SetApplicationPanel.java
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
if (lastSel != null)
chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
applicationField.setText(chooser.getSelectedFile().getPath());
}
项目:incubator-netbeans
文件:OutputOptions.java
static Color getDefaultColorError() {
Color err = UIManager.getColor("nb.output.err.foreground"); //NOI18N
if (err == null) {
err = LFCustoms.shiftColor(Color.red);
}
return err;
}
项目:jdk8u-jdk
文件:NimbusLookAndFeel.java
Map<String, Object> getDefaultsForPrefix(String prefix) {
if (compiledDefaults == null) {
compiledDefaults = new HashMap<String, Map<String, Object>>();
for (Map.Entry<Object, Object> entry: UIManager.getDefaults().entrySet()) {
if (entry.getKey() instanceof String) {
addDefault((String) entry.getKey(), entry.getValue());
}
}
if (! defaultListenerAdded) {
UIManager.getDefaults().addPropertyChangeListener(defaultsListener);
defaultListenerAdded = true;
}
}
return compiledDefaults.get(prefix);
}
项目:incubator-netbeans
文件:BoldVariablesTableModelFilter.java
public static String toHTML (
String text,
boolean bold,
boolean italics,
Color color
) {
if (text == null) return null;
StringBuilder sb = new StringBuilder ();
sb.append ("<html>");
if (bold) sb.append ("<b>");
if (italics) sb.append ("<i>");
if (color == null) {
color = UIManager.getColor("Table.foreground");
if (color == null) {
color = new JTable().getForeground();
}
}
sb.append ("<font color=\"#");
String hexColor = Integer.toHexString ((color.getRGB () & 0xffffff));
for (int i = hexColor.length(); i < 6; i++) {
sb.append("0"); // Prepend zeros to length of 6
}
sb.append(hexColor);
sb.append ("\">");
text = text.replaceAll ("&", "&");
text = text.replaceAll ("<", "<");
text = text.replaceAll (">", ">");
sb.append (text);
sb.append ("</font>");
if (italics) sb.append ("</i>");
if (bold) sb.append ("</b>");
sb.append ("</html>");
return sb.toString ();
}
项目:jdk8u-jdk
文件:WindowsSplitPaneDivider.java
/**
* Paints the divider.
*/
public void paint(Graphics g) {
Color bgColor = (splitPane.hasFocus()) ?
UIManager.getColor("SplitPane.shadow") :
getBackground();
Dimension size = getSize();
if(bgColor != null) {
g.setColor(bgColor);
g.fillRect(0, 0, size.width, size.height);
}
super.paint(g);
}
项目:openjdk-jdk10
文件:bug8008657.java
public static void main(String[] args) throws Exception {
robot = new Robot();
UIManager.LookAndFeelInfo[] lookAndFeelArray
= UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
executeCase(lookAndFeelItem.getClassName());
}
}
项目:jdk8u-jdk
文件:Test6860438.java
void test() {
int size = UIManager.getDefaults().size();
// create a new value, size increases
UIManager.getLookAndFeelDefaults().put(KEY, VALUE);
check(KEY, VALUE, true, size + 1);
// override the value, size remains the same
UIManager.put(KEY, VALUE);
check(KEY, VALUE, true, size + 1);
// remove the value, size decreases
UIManager.getDefaults().remove(KEY);
check(KEY, null, false, size);
}
项目:SER316-Ingolstadt
文件:SetApplicationPanel.java
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
if (lastSel != null)
chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
applicationField.setText(chooser.getSelectedFile().getPath());
}
项目:openjdk-jdk10
文件:JInternalFrameIconTest.java
public static void main(String[] args) throws Exception {
robot = new Robot();
robot.delay(2000);
UIManager.LookAndFeelInfo[] lookAndFeelArray
= UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
executeCase(lookAndFeelItem.getClassName());
}
if (!"".equals(errorString)) {
throw new RuntimeException("Error Log:\n" + errorString);
}
}
项目:incubator-netbeans
文件:ButtonCellRenderer.java
@Override
public Component getTableCellRendererComponent (
JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column
) {
JLabel c = (JLabel)defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (value instanceof String) {
Rectangle cellRect = table.getCellRect(row, column, false);
String scCell = (String) value;
Dimension d = new Dimension((int) cellRect.getWidth(), (int) cellRect.getHeight());
if (panel == null)
panel = new ShortcutCellPanel(scCell);
panel.setText(scCell);
panel.setSize(d);
if (isSelected) {
panel.setBgColor(table.getSelectionBackground());
if (UIManager.getLookAndFeel ().getID ().equals ("GTK"))
panel.setFgCOlor(table.getForeground(), true);
else
panel.setFgCOlor(table.getSelectionForeground(), true);
} else {
panel.setBgColor(c.getBackground());
panel.setFgCOlor(c.getForeground(), false);
}
if (hasFocus) {
panel.setBorder(c.getBorder());
} else {
panel.setBorder(null);
}
return panel;
}
else {
return c;
}
}
项目:OpenJSharp
文件:BasicLookAndFeel.java
/**
* Sets the parent of the passed in ActionMap to be the audio action
* map.
*/
static void installAudioActionMap(ActionMap map) {
LookAndFeel laf = UIManager.getLookAndFeel();
if (laf instanceof BasicLookAndFeel) {
map.setParent(((BasicLookAndFeel)laf).getAudioActionMap());
}
}
项目:smile_1.5.0_java7
文件:ButtonCellRenderer.java
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (isSelected) {
renderButton.setForeground(table.getSelectionForeground());
renderButton.setBackground(table.getSelectionBackground());
} else {
renderButton.setForeground(table.getForeground());
renderButton.setBackground(UIManager.getColor("Button.background"));
}
if (hasFocus) {
renderButton.setBorder(focusBorder);
} else {
renderButton.setBorder(originalBorder);
}
if (value == null) {
renderButton.setText("");
renderButton.setIcon(null);
renderButton.setEnabled(false);
} else if (value instanceof Icon) {
renderButton.setText("");
renderButton.setIcon((Icon) value);
renderButton.setEnabled(true);
} else {
renderButton.setText(value.toString());
renderButton.setIcon(null);
renderButton.setEnabled(true);
}
return renderButton;
}