Java Code Examples for javax.swing.UIManager
The following are top voted examples for showing how to use
javax.swing.UIManager. These examples are extracted from open source projects.
You can vote up the examples you like and your votes will be used in our system to generate
more good examples.
Example 1
Project: EMC-Installer File: Installer.java View source code | 7 votes |
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(); }
Example 2
Project: Equella File: BaseUtility.java View source code | 7 votes |
@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(); }
Example 3
Project: AgentWorkbench File: ProgressMonitor.java View source code | 6 votes |
/** * 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()); } }
Example 4
Project: Neukoelln_SER316 File: TaskTable.java View source code | 6 votes |
/** * 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")); } }
Example 5
Project: jdk8u-jdk File: DefaultEditorKit.java View source code | 6 votes |
/** 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); } } }
Example 6
Project: openjdk-jdk10 File: Test4319113.java View source code | 6 votes |
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); }
Example 7
Project: openjdk-jdk10 File: MenuItemIconTest.java View source code | 6 votes |
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); } }
Example 8
Project: incubator-netbeans File: DebuggingViewComponent.java View source code | 6 votes |
private static Color getTreeBackgroundColor() { Color c = null; if ("Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N c = UIManager.getColor("NbExplorerView.background"); //NOI18N } if (c == null) { c = UIManager.getColor("Tree.textBackground"); // NOI18N } return c; }
Example 9
Project: school-game File: ToolsLauncher.java View source code | 6 votes |
/** * 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(); } }); }
Example 10
Project: incubator-netbeans File: ColorHelper.java View source code | 6 votes |
public static Color getJxdatetimepickerMonthStringBackground() { Color managerColor = UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringBackground"); if (managerColor == null) { UIManager.put("nb.dataview.jxdatetimepicker.monthStringBackground", UIManager.getColor("JXMonthView.monthStringBackground")); //NOI18N return UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringBackground"); //NOI18N } else { return managerColor; } }
Example 11
Project: incubator-netbeans File: AquaViewTabDisplayerUI.java View source code | 6 votes |
@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); }
Example 12
Project: FJSTSeniorProjectSpring2017 File: RegisterGUI.java View source code | 6 votes |
/** 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); }
Example 13
Project: jdk8u-jdk File: MenuItemIconTest.java View source code | 6 votes |
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); } }
Example 14
Project: openjdk-jdk10 File: TableHeaderRendererExceptionTest.java View source code | 6 votes |
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); } }
Example 15
Project: incubator-netbeans File: OptionsAction.java View source code | 6 votes |
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; }
Example 16
Project: incubator-netbeans File: NotificationImpl.java View source code | 6 votes |
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; }
Example 17
Project: swing-memory-game File: MemoryGame.java View source code | 6 votes |
/** * 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); } }
Example 18
Project: ObsidianSuite File: ObsidianAnimator.java View source code | 6 votes |
@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"); }
Example 19
Project: jdk8u-jdk File: TableExample2.java View source code | 6 votes |
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]); }
Example 20
Project: incubator-netbeans File: RunAnalysisPanel.java View source code | 6 votes |
@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); }
Example 21
Project: incubator-netbeans File: ProjectInfoPanel.java View source code | 6 votes |
/** 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 } }
Example 22
Project: openjdk-jdk10 File: HiDPIPropertiesUnixTest.java View source code | 6 votes |
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); } }
Example 23
Project: incubator-netbeans File: HtmlLabelUI.java View source code | 6 votes |
/** 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; }
Example 24
Project: incubator-netbeans File: TermOptionsPanel.java View source code | 6 votes |
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 } } }
Example 25
Project: Pixie File: GUILabelingTool.java View source code | 6 votes |
/** * 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); } }); }
Example 26
Project: OpenJSharp File: DefaultEditorKit.java View source code | 6 votes |
/** 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); } } }
Example 27
Project: VisualGraphviz File: MainFrame.java View source code | 6 votes |
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); }
Example 28
Project: NoMoreOversleeps File: Main.java View source code | 6 votes |
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); } }
Example 29
Project: Rubus File: SetupUtils.java View source code | 5 votes |
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; }
Example 30
Project: openjdk-jdk10 File: MetalThemeMenu.java View source code | 5 votes |
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); } }
Example 31
Project: Reinickendorf_SER316 File: SetApplicationPanel.java View source code | 5 votes |
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()); }
Example 32
Project: incubator-netbeans File: OutputOptions.java View source code | 5 votes |
static Color getDefaultColorError() { Color err = UIManager.getColor("nb.output.err.foreground"); //NOI18N if (err == null) { err = LFCustoms.shiftColor(Color.red); } return err; }
Example 33
Project: jdk8u-jdk File: NimbusLookAndFeel.java View source code | 5 votes |
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); }
Example 34
Project: incubator-netbeans File: BoldVariablesTableModelFilter.java View source code | 5 votes |
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 (); }
Example 35
Project: jdk8u-jdk File: WindowsSplitPaneDivider.java View source code | 5 votes |
/** * 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); }
Example 36
Project: openjdk-jdk10 File: bug8008657.java View source code | 5 votes |
public static void main(String[] args) throws Exception { robot = new Robot(); UIManager.LookAndFeelInfo[] lookAndFeelArray = UIManager.getInstalledLookAndFeels(); for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) { executeCase(lookAndFeelItem.getClassName()); } }
Example 37
Project: jdk8u-jdk File: Test6860438.java View source code | 5 votes |
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); }
Example 38
Project: SER316-Ingolstadt File: SetApplicationPanel.java View source code | 5 votes |
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()); }
Example 39
Project: openjdk-jdk10 File: JInternalFrameIconTest.java View source code | 5 votes |
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); } }
Example 40
Project: incubator-netbeans File: ButtonCellRenderer.java View source code | 5 votes |
@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; } }