List of usage examples for javax.swing JRadioButton getUI
public ButtonUI getUI()
From source file:net.pms.newgui.LooksFrame.java
public static void initializeLookAndFeel() { synchronized (lookAndFeelInitializedLock) { if (lookAndFeelInitialized) { return; }//from w w w . j a v a 2 s. c om if (Platform.isWindows()) { try { UIManager.setLookAndFeel(WINDOWS_LNF); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { LOGGER.error("Error while setting Windows look and feel: ", e); } } else if (System.getProperty("nativelook") == null && !Platform.isMac()) { try { UIManager.setLookAndFeel(PLASTICXP_LNF); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { LOGGER.error("Error while setting Plastic XP look and feel: ", e); } } else { try { String systemClassName = UIManager.getSystemLookAndFeelClassName(); // Workaround for Gnome try { String gtkLAF = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; Class.forName(gtkLAF); if (systemClassName.equals("javax.swing.plaf.metal.MetalLookAndFeel")) { systemClassName = gtkLAF; } } catch (ClassNotFoundException ce) { LOGGER.error("Error loading GTK look and feel: ", ce); } LOGGER.trace("Choosing Java look and feel: " + systemClassName); UIManager.setLookAndFeel(systemClassName); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) { try { UIManager.setLookAndFeel(PLASTICXP_LNF); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { LOGGER.error("Error while setting Plastic XP look and feel: ", e); } LOGGER.error("Error while setting native look and feel: ", e1); } } if (isParticularLaFSet(UIManager.getLookAndFeel(), PLASTICXP_LNF)) { PlasticLookAndFeel.setPlasticTheme(PlasticLookAndFeel.createMyDefaultTheme()); PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE); PlasticLookAndFeel.setHighContrastFocusColorsEnabled(false); } else if (isParticularLaFSet(UIManager.getLookAndFeel(), METAL_LNF)) { MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); } // Work around caching in MetalRadioButtonUI JRadioButton radio = new JRadioButton(); radio.getUI().uninstallUI(radio); JCheckBox checkBox = new JCheckBox(); checkBox.getUI().uninstallUI(checkBox); // Workaround for JDK-8179014: JFileChooser with Windows look and feel crashes on win 10 // https://bugs.openjdk.java.net/browse/JDK-8179014 if (isParticularLaFSet(UIManager.getLookAndFeel(), WINDOWS_LNF)) { UIManager.put("FileChooser.useSystemExtensionHiding", false); } lookAndFeelInitialized = true; } }
From source file:de.xplib.xdbm.ui.Application.java
/** * Sets global user interface options.//from w ww. j a v a 2s .co m */ private void configureUI() { Options.setDefaultIconSize(new Dimension(18, 18)); // Set font options UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, settings.isUseSystemFonts()); Options.setGlobalFontSizeHints(settings.getFontSizeHints()); Options.setUseNarrowButtons(settings.isUseNarrowButtons()); Options.setPopupDropShadowEnabled(settings.isPopupDropShadowEnabled().booleanValue()); // Global options Options.setTabIconsEnabled(settings.isTabIconsEnabled()); UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled()); // Swing Settings LookAndFeel selectedLaf = settings.getSelectedLookAndFeel(); if (selectedLaf instanceof PlasticLookAndFeel) { PlasticLookAndFeel.setMyCurrentTheme(settings.getSelectedTheme()); PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle()); PlasticLookAndFeel.setHighContrastFocusColorsEnabled(settings.isPlasticHighContrastFocusEnabled()); } else if (selectedLaf.getClass() == MetalLookAndFeel.class) { MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); } // Work around caching in MetalRadioButtonUI JRadioButton radio = new JRadioButton(); radio.getUI().uninstallUI(radio); JCheckBox checkBox = new JCheckBox(); checkBox.getUI().uninstallUI(checkBox); try { UIManager.setLookAndFeel(selectedLaf); } catch (Exception e) { System.out.println("Can't change L&F: " + e); } }