javax.swing.UIManager Java Examples
The following examples show how to use
javax.swing.UIManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WeaponDataGeneratorPanel.java From gameserver with Apache License 2.0 | 7 votes |
public static void main(String[] args) { EventQueue.invokeLater(new Runnable(){ public void run() { for ( LookAndFeelInfo info : UIManager.getInstalledLookAndFeels() ) { if ( "Nimbus".equals(info.getName()) ) { try { UIManager.setLookAndFeel(info.getClassName()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } break; } } JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(WeaponDataGeneratorPanel.getInstance()); frame.setSize(800, 800); frame.setVisible(true); } }); }
Example #2
Source File: BranchView.java From ramus with GNU General Public License v3.0 | 6 votes |
public void addChildBranch() { int row = table.getSelectedRow(); if (row < 0) return; Node node = (Node) table.getPathForRow(row).getLastPathComponent(); String message = GlobalResourcesManager .getString("BranchCreationWarning"); if (node.branch.getChildren().size() > 0) message = GlobalResourcesManager .getString("BranchNodeCreationWarniong"); if (JOptionPane.showConfirmDialog(framework.getMainFrame(), message, UIManager.getString("OptionPane.titleText"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION) return; String s = JOptionPane.showInputDialog(framework.getMainFrame(), GlobalResourcesManager.getString("BranchCreationReason"), GlobalResourcesManager.getString("BranchCreationReason"), JOptionPane.QUESTION_MESSAGE); if (s == null) return; int type = node.branch.getType() - 1; if (node.branch.getChildren().size() > 0) { type = getMaxType(type, (Node) branchModel.getRoot()); } engine.createBranch(node.branch.getBranchId(), s, type + 1, "core"); }
Example #3
Source File: Hiero.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 6 votes |
public static void main(String[] args) throws Exception { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels(); for (int i = 0, n = lookAndFeels.length; i < n; i++) { if ("Nimbus".equals(lookAndFeels[i].getName())) { try { UIManager.setLookAndFeel(lookAndFeels[i].getClassName()); } catch (Exception ignored) { } break; } } try { new Hiero(); } catch (SlickException ex) { throw new RuntimeException(ex); } } }); }
Example #4
Source File: TransparentSectionButton.java From netbeans with Apache License 2.0 | 6 votes |
public TransparentSectionButton(ActionListener al) { // force initialization of PropSheet look'n'feel values UIManager.get( "nb.propertysheet" ); setMargin(new Insets(0, 3, 0, 3)); setFocusPainted( false ); setHorizontalAlignment( SwingConstants.LEFT ); setHorizontalTextPosition( SwingConstants.RIGHT ); setVerticalTextPosition( SwingConstants.CENTER ); updateProperties(); if( getBorder() instanceof CompoundBorder ) { // from BasicLookAndFeel Dimension pref = getPreferredSize(); pref.height -= 3; setPreferredSize( pref ); } if(al != null) { addActionListener(al); } initActions(); }
Example #5
Source File: SwingSet3.java From beautyeye with Apache License 2.0 | 6 votes |
@Override protected void initialize(String args[]) { try { // TODO Use nimbus L&F by Oracle // UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); // TODO Use Beauty L&F by Jack Jiang BeautyEyeLNFHelper.launchBeautyEyeLNF(); UIManager.put("RootPane.setupButtonVisible", false); } catch (Exception ex) { // not catestrophic } resourceMap = getContext().getResourceMap(); title = resourceMap.getString("mainFrame.title"); runningDemoCache = new HashMap<String, DemoPanel>(); setDemoList(resourceMap.getString("demos.title"), getDemoClassNames(args)); IntroPanel intro = new IntroPanel(); setDemoPlaceholder(intro); }
Example #6
Source File: TableExample2.java From hottub with GNU General Public License v2.0 | 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 #7
Source File: Metalworks.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { UIManager.put("swing.boldMetal", Boolean.FALSE); JDialog.setDefaultLookAndFeelDecorated(true); JFrame.setDefaultLookAndFeelDecorated(true); Toolkit.getDefaultToolkit().setDynamicLayout(true); System.setProperty("sun.awt.noerasebackground", "true"); try { UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { System.out.println( "Metal Look & Feel not supported on this platform. \n" + "Program Terminated"); System.exit(0); } JFrame frame = new MetalworksFrame(); frame.setVisible(true); }
Example #8
Source File: RaceGUI.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Creates a new instance of RaceGUI */ public RaceGUI(String appName) { UIManager.put("swing.boldMetal", Boolean.FALSE); JFrame f = new JFrame(appName); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new BorderLayout()); // Add Track view track = new TrackView(); f.add(track, BorderLayout.CENTER); // Add control panel controlPanel = new RaceControlPanel(); f.add(controlPanel, BorderLayout.SOUTH); f.pack(); f.setVisible(true); }
Example #9
Source File: Main.java From jeveassets with GNU General Public License v2.0 | 6 votes |
private static void initLookAndFeel() { //Allow users to overwrite LaF if (System.getProperty("swing.defaultlaf") != null) { return; } String lookAndFeel; //lookAndFeel = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; lookAndFeel = UIManager.getSystemLookAndFeelClassName(); //System //lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); //Java //lookAndFeel = "javax.swing.plaf.nimbus.NimbusLookAndFeel"; //Nimbus //lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel"; //Metal //lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; //GTK+ //lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; //CDE/Motif try { UIManager.setLookAndFeel(lookAndFeel); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { log.log(Level.SEVERE, "Failed to set LookAndFeel: " + lookAndFeel, ex); } }
Example #10
Source File: AreaX.java From pumpernickel with MIT License | 6 votes |
private static AreaXRules getDefaultRules() { Object rulesObject = UIManager.get("AreaX.rules"); if (rulesObject instanceof AreaXRules) return (AreaXRules) rulesObject; String className = (String) rulesObject; if (className == null) className = "com.pump.geom.BoundsRules"; AreaXRules rules = rulesTable.get(className); try { if (rules == null) { Class<?> theClass = Class.forName(className); Constructor<?> constructor = theClass .getConstructor(new Class[] {}); rules = (AreaXRules) constructor.newInstance(new Object[] {}); } return rules; } catch (Throwable t) { t.printStackTrace(); return minimalRules; } }
Example #11
Source File: StableCompoundEdit.java From netbeans with Apache License 2.0 | 6 votes |
@Override public String getRedoPresentationName() { UndoableEdit last = lastEdit(); if (last != null) { return last.getRedoPresentationName(); } else { String name = getPresentationName(); if (!"".equals(name)) { name = UIManager.getString("AbstractUndoableEdit.redoText") + " " + name; } else { name = UIManager.getString("AbstractUndoableEdit.redoText"); } return name; } }
Example #12
Source File: ColorCustomizationTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
void testNames() { Color defaultColor = label.getBackground(); UIManager.put("\"BlueLabel\"[Enabled].background", new ColorUIResource(Color.BLUE)); UIManager.put("\"RedLabel\"[Enabled].background", new ColorUIResource(Color.RED)); nimbus.register(Region.LABEL, "\"BlueLabel\""); nimbus.register(Region.LABEL, "\"RedLabel\""); label.setName("BlueLabel"); check(Color.BLUE); label.setName("RedLabel"); check(Color.RED); // remove name, color goes back to default label.setName(null); check(defaultColor); }
Example #13
Source File: Outline.java From netbeans with Apache License 2.0 | 6 votes |
/** Calculate the height of rows based on the current font. */ private void calcRowHeight() { //Users of themes can set an explicit row height, so check for it Integer i = (Integer) UIManager.get("netbeans.outline.rowHeight"); //NOI18N int rHeight = 20; if (i != null) { rHeight = i.intValue(); } else { //Derive a row height to accomodate the font and expando icon Font f = getFont(); FontMetrics fm = getFontMetrics(f); int h = Math.max (fm.getHeight () + fm.getMaxDescent (), DefaultOutlineCellRenderer.getExpansionHandleHeight ()); rHeight = Math.max (rHeight, h) + 2; // XXX: two pixels for cell's insets } //Set row height. If displayable, this will generate a new call //to paint() setRowHeight(rHeight); }
Example #14
Source File: bug8046391.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { OSType type = OSInfo.getOSType(); if (type != OSType.WINDOWS) { System.out.println("This test is for Windows only... skipping!"); return; } SwingUtilities.invokeAndWait(() -> { try { UIManager.setLookAndFeel(new WindowsLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } System.out.println("Creating JFileChooser..."); JFileChooser fileChooser = new JFileChooser(); System.out.println("Test passed: chooser = " + fileChooser); }); // Test fails if creating JFileChooser hangs }
Example #15
Source File: Application.java From ramus with GNU General Public License v3.0 | 6 votes |
public static void main(String[] args) { System.setProperty("user.ramus.application.name", "DemoApplication1"); if (args.length == 0) if (JOptionPane.showConfirmDialog(null, "Do you want to create a new file of your application?", UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) { JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new MyFileFilter()); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { args = new String[]{chooser.getSelectedFile() .getAbsolutePath()}; } } new Application().run(args); }
Example #16
Source File: frmMain.java From sourcerabbit-gcode-sender with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new frmMain().setVisible(true); } }); }
Example #17
Source File: bug8080628.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void runTest() { try { LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels(); for (LookAndFeelInfo info : lafInfo) { UIManager.setLookAndFeel(info.getClassName()); for (Locale locale : LOCALES) { for (String key : MNEMONIC_KEYS) { int mnemonic = SwingUtilities2.getUIDefaultsInt(key, locale); if (mnemonic != 0) { throw new RuntimeException("No mnemonic expected (" + mnemonic + ") " + "for '" + key + "' " + "in locale '" + locale + "' " + "in Look-and-Feel '" + UIManager.getLookAndFeel().getClass().getName() + "'"); } } } } System.out.println("Test passed"); } catch (Exception e) { exception = e; } }
Example #18
Source File: BrowserMenu.java From netbeans with Apache License 2.0 | 5 votes |
private JLabel createLabel( String text ) { JLabel res = new JLabel(text); if( GTK ) { Color foreground = UIManager.getColor( "MenuItem.foreground"); //NOI18N if( null != foreground ) { res.setForeground( new Color(foreground.getRGB()) ); } } return res; }
Example #19
Source File: ColorCustomizationTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { nimbus = new NimbusLookAndFeel(); try { UIManager.setLookAndFeel(nimbus); } catch (UnsupportedLookAndFeelException e) { throw new Error("Unable to set Nimbus LAF"); } SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { new ColorCustomizationTest().test(); } }); }
Example #20
Source File: ProfilerTreeTable.java From visualvm with GNU General Public License v2.0 | 5 votes |
public void setUI(TreeUI ui) { if (ui instanceof SynthTreeUI) { // if (synthLikeUI == null) { super.setUI(ui); SynthTreeUI synthUI = (SynthTreeUI)ui; int left = synthUI.getLeftChildIndent(); int right = synthUI.getRightChildIndent(); synthLikeUI = new SynthLikeTreeUI(); super.setUI(synthLikeUI); boolean nimbus = UIUtils.isNimbusLookAndFeel(); synthLikeUI.setLeftChildIndent(left + (nimbus ? 4 : 6)); synthLikeUI.setRightChildIndent(right); // } else { // super.setUI(synthLikeUI); // } } else { synthLikeUI = null; super.setUI(ui); // #269500 - performance workaround for BasicTreeUI if (!DISABLE_TREEUI_FIX && ui instanceof BasicTreeUI) workaroundVerticalLines = UIManager.getBoolean("Tree.paintLines"); // NOI18N } }
Example #21
Source File: CheckTreeCellRenderer.java From netbeans with Apache License 2.0 | 5 votes |
public CheckTreeCellRenderer() { setLayout(new BorderLayout()); setOpaque(false); checkBox.setOpaque(false); // --- Workaround for #205932 - not sure why, but works fine... Font f = UIManager.getFont("Label.font"); // NOI18N if (f != null) treeRenderer.setFont(f.deriveFont(f.getStyle())); // --- add(checkBox, BorderLayout.WEST); }
Example #22
Source File: FixPlatform.java From netbeans with Apache License 2.0 | 5 votes |
@NonNull private static Color getErrorForeground() { Color result = UIManager.getDefaults().getColor("nb.errorForeground"); //NOI18N if (result == null) { result = Color.RED; } return result; }
Example #23
Source File: Test6860438.java From openjdk-jdk9 with GNU General Public License v2.0 | 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 #24
Source File: ColorModel.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
final int getInteger(Component component, String suffix) { Object value = UIManager.get(this.prefix + suffix, component.getLocale()); if (value instanceof Integer) { return (Integer) value; } if (value instanceof String) { try { return Integer.parseInt((String) value); } catch (NumberFormatException exception) { } } return -1; }
Example #25
Source File: CloseableModernTabbedPaneUI.java From SikuliX1 with MIT License | 5 votes |
@Override protected void installDefaults() { UIManager.put("TabbedPane.tabAreaInsets", new Insets(0, 0, 0, 0)); UIManager.put("TabbedPane.font", ((Font) UIManager.get("TabbedPane.font")).deriveFont(Font.BOLD)); /* UIManager.put("TabbedPane.font", new Font("Thoma",Font.BOLD,12)); */ UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0)); UIManager.put("TabbedPane.selectedTabPadInsets", new Insets(0, 0, 0, 0)); super.installDefaults(); }
Example #26
Source File: WindowsInternalFrameTitlePane.java From JDKSourceCode1.8 with MIT License | 5 votes |
private static int getButtonMnemonic(String button) { try { return Integer.parseInt(UIManager.getString( "InternalFrameTitlePane." + button + "Button.mnemonic")); } catch (NumberFormatException e) { return -1; } }
Example #27
Source File: AbstractDocument.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Provides a localized, human readable description of this edit * suitable for use in, say, a change log. * * @return the description */ public String getPresentationName() { DocumentEvent.EventType type = getType(); if(type == DocumentEvent.EventType.INSERT) return UIManager.getString("AbstractDocument.additionText"); if(type == DocumentEvent.EventType.REMOVE) return UIManager.getString("AbstractDocument.deletionText"); return UIManager.getString("AbstractDocument.styleChangeText"); }
Example #28
Source File: InsetsEncapsulation.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void setLookAndFeel(final LookAndFeelInfo laf) { try { UIManager.setLookAndFeel(laf.getClassName()); System.out.println("LookAndFeel: " + laf.getClassName()); } catch (ClassNotFoundException | InstantiationException | UnsupportedLookAndFeelException | IllegalAccessException e) { throw new RuntimeException(e); } }
Example #29
Source File: Bug6530694.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
Bug6530694() { Locale.setDefault(Locale.GERMANY); UIDefaults defs = UIManager.getDefaults(); defs.addResourceBundle("Bug6530694"); String str = defs.getString("testkey"); if (!"testvalue".equals(str)) { throw new RuntimeException("Could not load the resource for de_DE locale"); } }
Example #30
Source File: PropertySheetTable.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public CellBorder() { expandedIcon = (Icon)UIManager.get(TREE_EXPANDED_ICON_KEY); collapsedIcon = (Icon)UIManager.get(TREE_COLLAPSED_ICON_KEY); if (expandedIcon == null) { expandedIcon = new ExpandedIcon(); } if (collapsedIcon == null) { collapsedIcon = new CollapsedIcon(); } }