List of usage examples for com.jgoodies.looks Options setUseNarrowButtons
public static void setUseNarrowButtons(boolean b)
In previous versions of the JGoodies Looks this setting was supported also for individual buttons - primarily to offer visual backward compatibility with Sun L&Fs.
From source file:com.prodp.apsim.APProcessHandler.java
License:Apache License
/** * /*from ww w . j a v a2 s . com*/ * Sets up the whole game. * * Sets up things like the GUI, put through {@link APGUI}, the scene * objects, and other things in {@link APFinalData}. * * @throws AWTException * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException * @throws UnsupportedLookAndFeelException * @throws CloneNotSupportedException */ public void init() throws AWTException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, CloneNotSupportedException { // Get the icon try { APFinalData.apIconImage = new ImageIcon( ImageIO.read(new APMain().getClass().getResource("icons/apsim.png"))).getImage(); } catch (IOException e) { e.printStackTrace(); } // For mouse control and screenshots center = new Robot(); // Set Graphics graphics.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED); graphics.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED); graphicsConfig = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getBestConfiguration(graphics); c3d = new APRenderer(graphicsConfig, (JComponent) APFinalData.mainFrame.getContentPane()); c3d.setVisible(true); // setLookAndFeel PlasticLookAndFeel.set3DEnabled(true); PlasticLookAndFeel.setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE); PlasticLookAndFeel.setPlasticTheme(new DesertBluer()); UIManager.setLookAndFeel(new PlasticLookAndFeel()); Options.setPopupDropShadowEnabled(true); Options.setUseNarrowButtons(true); // This is the Processor initialization final APProcess firstProcess = new APProcess("Untitled" + untitled + ".aps"); APList.addProcess(firstProcess); APProcess process = APList.getCurrentProcess(); // The default position mainRoutineFinalTransform.setTranslation(new Vector3f(0, 0, 0)); // Set up the grass Transform3D grass3d = new Transform3D(); grass3d.setScale(50); TextureAttributes ta = new TextureAttributes(); ta.setTextureMode(TextureAttributes.MODULATE); ta.setPerspectiveCorrectionMode(TextureAttributes.FASTEST); ta.setTextureTransform(grass3d); Appearance floorapp = new Appearance(); floorapp.setTexture( new TextureLoader(new APRandImage(1024, 1024, BufferedImage.TYPE_3BYTE_BGR, new Color(111, 71, 40), new Color(50, 30, 7), new Color(104, 57, 23), new Color(22, 12, 6)), "RGB", null) .getTexture()); floorapp.setTextureAttributes(ta); // Referencing the position of the floor to floorcoord APFinalData.floor.setCoordRefFloat(APFinalData.floorcoord); APFinalData.floor.setTexCoordRefFloat(0, APFinalData.floortex); // Hide the cursor c3d.setCursor(APFinalData.transparentCursor); // Main geometry array cMain = new QuadArray(APFinalData.LIMIT * 24, QuadArray.COORDINATES | QuadArray.COLOR_4 | QuadArray.BY_REFERENCE | QuadArray.TEXTURE_COORDINATE_2); // Wind geometry array windLoc = new LineArray(2 * APFinalData.PRESSURE_COUNT, LineArray.COORDINATES | LineArray.COLOR_3 | LineArray.BY_REFERENCE); // Dynamic positioning cMain.setCapability(GeometryArray.ALLOW_REF_DATA_READ); cMain.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE); windLoc.setCapability(GeometryArray.ALLOW_REF_DATA_READ); windLoc.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE); // Set the reference of the geometry array to the coordinates and the // colors cMain.setCoordRefFloat(process.coords); cMain.setColorRefByte(process.colors); cMain.setTexCoordRefFloat(0, process.texturecoords); windLoc.setCoordRefFloat(process.windcoords); windLoc.setColorRefByte(process.windcolors); // Now add the reactionary components APRList.addReaction(new APReaction(new APPair(APMaterial.WOOD.getID(), APMaterial.LAVA.getID()), APMaterial.FIRE, 0.2f, APFinalData.CHANGE_BLOCK_FLAG)); APRList.addReaction(new APReaction(new APPair(APMaterial.WOOD.getID(), APMaterial.FIRE.getID()), APMaterial.FIRE, 0.1f, APFinalData.CHANGE_BLOCK_FLAG)); APRList.addReaction(new APReaction(new APPair(APMaterial.STONE.getID(), APMaterial.LAVA.getID()), APMaterial.LAVA, 0.1f, APFinalData.CHANGE_BLOCK_FLAG)); APRList.addReaction(new APReaction(new APPair(APMaterial.WATER.getID(), APMaterial.LAVA.getID()), APMaterial.STEAM, 0.4f, APFinalData.CHANGE_BLOCK_FLAG)); APRList.addReaction(new APReaction(new APPair(APMaterial.LAVA.getID(), APMaterial.WATER.getID()), APMaterial.STONE, 0.9f, APFinalData.CHANGE_BLOCK_FLAG)); APRList.addReaction(new APReaction(new APPair(APMaterial.FIRE.getID(), APMaterial.WATER.getID()), APMaterial.NULL, 0.9f, APFinalData.REMOVE_BLOCK_FLAG)); APRList.addReaction(new APReaction(new APPair(APMaterial.WATER.getID(), APMaterial.ICE.getID()), APMaterial.ICE, 0.01f, APFinalData.CHANGE_BLOCK_FLAG)); APRList.addReaction(new APReaction(new APPair(APMaterial.ICE.getID(), APMaterial.LAVA.getID()), APMaterial.WATER, 1, APFinalData.CHANGE_BLOCK_FLAG)); APFinalData.mainFrame.init(); // Set the canvas size c3d.setPreferredSize(new Dimension(550, 300)); c3d.setLocation(0, 0); // Don't let the geometry clip off final Appearance polyAppearance = new Appearance(); polyAppearance.setPolygonAttributes( new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0)); polyAppearance.setTextureAttributes(new TextureAttributes()); polyAppearance.setTexture(APFinalData.textures); final Appearance lineAppearance = new Appearance(); lineAppearance.setLineAttributes(new LineAttributes(1, LineAttributes.PATTERN_SOLID, false)); TransparencyAttributes trans = new TransparencyAttributes(); trans.setTransparencyMode(TransparencyAttributes.BLENDED); polyAppearance.setTransparencyAttributes(trans); // Add the GeometryArray to the Shape3D aobjects.addGeometry(cMain); aobjects.setAppearance(polyAppearance); lobjects.addGeometry(windLoc); lobjects.setAppearance(lineAppearance); ground.addGeometry(APFinalData.floor); ground.setAppearance(floorapp); // Initialize the AmbientLight APFinalData.whiteLight.setInfluencingBounds(bounds); // Sky Background back = new Background(); back.setApplicationBounds(new BoundingSphere(new Point3d(0, 0, 0), 1)); skyTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); skyTrans.rotX(0); skyTG.setTransform(skyTrans); skyTG.addChild(sky); BranchGroup backgeom = new BranchGroup(); backgeom.addChild(skyTG); back.setGeometry(backgeom); // Add the brush selection.setCapability(QuadArray.ALLOW_REF_DATA_WRITE); selections.addGeometry(selection); selections.setAppearance(APFinalData.wireframe); APFinalData.brushes.addChild(selections); // Scene initialization scene = new APSceneGraph(c3d); scene.addChild(APFinalData.whiteLight, aobjects, lobjects, ground, back, APFinalData.brushes); // Add it to the world scene.addBranchGraph(); // Prepare the world scene.prepare(mainRoutineFinalTransform); // Make the Canvas draw right c3d.setDoubleBufferEnable(true); // Stereo Red-blue c3d.getView().getPhysicalBody().setLeftEyePosition(new Point3d(-0.01, 0, 0)); c3d.getView().getPhysicalBody().setRightEyePosition(new Point3d(0.01, 0, 0)); c3d.getView().setDepthBufferFreezeTransparent(false); // Note: c3d has no anaglyphs c3d.setStereoMode(StereoMode.OFF); // Add Canvas listeners c3d.addMouseListener(this); c3d.addMouseMotionListener(this); c3d.addKeyListener(this); // Add menubar listeners APFinalData.Exit.addActionListener(this); APFinalData.New.addActionListener(this); APFinalData.Open.addActionListener(this); APFinalData.Save.addActionListener(this); APFinalData.Save_As.addActionListener(this); APFinalData.Import.addActionListener(this); APFinalData.Export.addActionListener(this); APFinalData.Element.addActionListener(this); APFinalData.Exit.addActionListener(this); APFinalData.Join_Server.addActionListener(this); APFinalData.Create_Server.addActionListener(this); APFinalData.View_Options.addActionListener(this); APFinalData.Sound.addActionListener(this); APFinalData.Online_Help.addActionListener(this); APFinalData.About_Us.addActionListener(this); APFinalData.Update.addActionListener(this); APFinalData.View_Ok.addActionListener(this); APFinalData.View_Cancel.addActionListener(this); APFinalData.Element_Ok.addActionListener(this); APFinalData.Element_Cancel.addActionListener(this); APFinalData.antiaDisable.addActionListener(this); APFinalData.antiaEnable.addActionListener(this); APFinalData.anaglyphFull.addActionListener(this); APFinalData.anaglyphGray.addActionListener(this); APFinalData.anaglyphHalf.addActionListener(this); APFinalData.anaglyphNone.addActionListener(this); APFinalData.anaglyphOptim.addActionListener(this); APFinalData.anaglyphRedBlue.addActionListener(this); APFinalData.anaglyphRedGreen.addActionListener(this); APFinalData.senseSlider.addChangeListener(this); APFinalData.elementChooser.addActionListener(this); APFinalData.SprayVacuum.addActionListener(this); APFinalData.Wind.addActionListener(this); APFinalData.processSwitch.setBackground(Color.WHITE); APFinalData.processSwitch.addChangeListener(this); APFinalData.processSwitch.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); // APFinalData.mainFrame.setVisible(true); // Make the thread if (threedanim == null) threedanim = new Thread(new APMain(), "APThread"); // Make it the best thread threedanim.setPriority(APSceneGraph.getJ3DThreadPriority()); threedanim.setDaemon(false); threedanim.start(); // Make it live isRunning = true; APFinalData.mainFrame.setVisible(true); }
From source file:de.dfki.dmas.owls2wsdl.gui.OWLS2WSDLGui.java
License:Open Source License
private void configureUI() { // UIManager.put("ToolTip.hideAccelerator", Boolean.FALSE); Options.setDefaultIconSize(new Dimension(18, 18)); Options.setUseNarrowButtons(settings.isUseNarrowButtons()); Options.setTabIconsEnabled(settings.isTabIconsEnabled()); UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled()); // Swing Settings LookAndFeel selectedLaf = settings.getSelectedLookAndFeel(); // Work around caching in MetalRadioButtonUI JRadioButton radio = new JRadioButton(); radio.getUI().uninstallUI(radio);/*w w w .j a v a 2 s . c o m*/ JCheckBox checkBox = new JCheckBox(); checkBox.getUI().uninstallUI(checkBox); try { UIManager.setLookAndFeel(selectedLaf); SwingUtilities.updateComponentTreeUI(this); } catch (UnsupportedLookAndFeelException uslafe) { System.out.println("UnsupportedLookAndFeelException: " + uslafe.getMessage()); } catch (Exception e) { System.out.println("Can't change L&F: " + e); } // // FensterIcon // String IconLocation = ResourceManager.getString("icon.IconImage"); // System.out.println("[i] set IconImage: " + // getClass().getResource(IconLocation).toString()); // setIconImage( new // ImageIcon(getClass().getResource(IconLocation)).getImage()); }
From source file:de.xplib.xdbm.ui.Application.java
License:Open Source License
/** * Sets global user interface options./*from w ww . j a v a 2s. c o 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); } }
From source file:etomica.virial.cluster2.mvc.view.ApplicationUI.java
License:Mozilla Public License
/** * Configures the user interface; requests Swing settings and JGoodies Looks options * from the launcher.//from w w w. j a va2 s . c o m */ public static void configure() { // UIManager.put("ToolTip.hideAccelerator", Boolean.FALSE); Options.setDefaultIconSize(DF_ICON_SIZE); Options.setUseNarrowButtons(uiSettings.isUseNarrowButtons()); // Global options Options.setTabIconsEnabled(uiSettings.isTabIconsEnabled()); UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, uiSettings.isPopupDropShadowEnabled()); // Swing Settings LookAndFeel selectedLaf = uiSettings.getSelectedLookAndFeel(); if (selectedLaf instanceof PlasticLookAndFeel) { PlasticLookAndFeel.setPlasticTheme(uiSettings.getSelectedTheme()); PlasticLookAndFeel.setTabStyle(uiSettings.getPlasticTabStyle()); PlasticLookAndFeel.setHighContrastFocusColorsEnabled(uiSettings.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 setting the look and feel try { UIManager.setLookAndFeel(selectedLaf); } catch (Exception e) { System.out.println("Can't change the look and feel: " + e); } }
From source file:net.dpml.depot.desktop.Desktop.java
License:Apache License
/** * Configures the UI; tries to set the system look on Mac, * WindowsLookAndFeel on general Windows, and * Plastic3DLookAndFeel on Windows XP and all other OS. *//*from w ww .j a v a 2 s . 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.setTabIconsEnabled(settings.isTabIconsEnabled()); UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled()); 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()); } // MetalRadioButtonUI caching work around JRadioButton radio = new JRadioButton(); radio.getUI().uninstallUI(radio); JCheckBox checkBox = new JCheckBox(); checkBox.getUI().uninstallUI(checkBox); try { UIManager.setLookAndFeel(selectedLaf); } catch (Exception e) { e.printStackTrace(); } }
From source file:net.pms.newgui.LooksFrame.java
License:Open Source License
/** * Constructs a <code>DemoFrame</code>, configures the UI, * and builds the content.//from w w w. j a v a2 s . c om */ public LooksFrame(AutoUpdater autoUpdater, PmsConfiguration configuration) { this.autoUpdater = autoUpdater; this.configuration = configuration; assert this.configuration != null; Options.setDefaultIconSize(new Dimension(18, 18)); Options.setUseNarrowButtons(true); // Global options Options.setTabIconsEnabled(true); UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, null); // Swing Settings initializeLookAndFeel(); // wait till the look and feel has been initialized before (possibly) displaying the update notification dialog if (autoUpdater != null) { autoUpdater.addObserver(this); autoUpdater.pollServer(); } // http://propedit.sourceforge.jp/propertieseditor.jnlp Font sf = null; // Set an unicode font for testing exotics languages (japanese) final String language = configuration.getLanguage(); if (language != null && (language.equals("ja") || language.startsWith("zh"))) { sf = new Font("Serif", Font.PLAIN, 12); } if (sf != null) { UIManager.put("Button.font", sf); UIManager.put("ToggleButton.font", sf); UIManager.put("RadioButton.font", sf); UIManager.put("CheckBox.font", sf); UIManager.put("ColorChooser.font", sf); UIManager.put("ToggleButton.font", sf); UIManager.put("ComboBox.font", sf); UIManager.put("ComboBoxItem.font", sf); UIManager.put("InternalFrame.titleFont", sf); UIManager.put("Label.font", sf); UIManager.put("List.font", sf); UIManager.put("MenuBar.font", sf); UIManager.put("Menu.font", sf); UIManager.put("MenuItem.font", sf); UIManager.put("RadioButtonMenuItem.font", sf); UIManager.put("CheckBoxMenuItem.font", sf); UIManager.put("PopupMenu.font", sf); UIManager.put("OptionPane.font", sf); UIManager.put("Panel.font", sf); UIManager.put("ProgressBar.font", sf); UIManager.put("ScrollPane.font", sf); UIManager.put("Viewport", sf); UIManager.put("TabbedPane.font", sf); UIManager.put("TableHeader.font", sf); UIManager.put("TextField.font", sf); UIManager.put("PasswordFiled.font", sf); UIManager.put("TextArea.font", sf); UIManager.put("TextPane.font", sf); UIManager.put("EditorPane.font", sf); UIManager.put("TitledBorder.font", sf); UIManager.put("ToolBar.font", sf); UIManager.put("ToolTip.font", sf); UIManager.put("Tree.font", sf); } setTitle("Test"); setIconImage(readImageIcon("icon-32.png").getImage()); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JComponent jp = buildContent(); String showScrollbars = System.getProperty("scrollbars", "").toLowerCase(); /* * handle scrollbars: * * 1) forced scrollbars (-Dscrollbars=true): always display them * 2) optional scrollbars (-Dscrollbars=optional): display them as needed * 3) otherwise (default): don't display them */ if (showScrollbars.equals("true")) { setContentPane(new JScrollPane(jp, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS)); } else if (showScrollbars.equals("optional")) { setContentPane(new JScrollPane(jp, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED)); } else { setContentPane(jp); } String projectName = PropertiesUtil.getProjectProperties().get("project.name"); String projectVersion = PropertiesUtil.getProjectProperties().get("project.version"); String title = projectName + " " + projectVersion; // If the version contains a "-" (e.g. "1.50.1-SNAPSHOT" or "1.50.1-beta1"), add a warning message if (projectVersion.indexOf("-") > -1) { title = title + " - " + Messages.getString("LooksFrame.26"); } this.setTitle(title); this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); Dimension screenSize = getToolkit().getScreenSize(); if (screenSize.width < minimumSize.width || screenSize.height < minimumSize.height) { setMinimumSize(screenSize); } else { setMinimumSize(minimumSize); } if (screenSize.width < preferredSize.width || screenSize.height < preferredSize.height) { setSize(screenSize); } else { setSize(preferredSize); } setResizable(true); Dimension paneSize = getSize(); setLocation(((screenSize.width > paneSize.width) ? ((screenSize.width - paneSize.width) / 2) : 0), ((screenSize.height > paneSize.height) ? ((screenSize.height - paneSize.height) / 2) : 0)); if (!configuration.isMinimized() && System.getProperty(START_SERVICE) == null) { setVisible(true); } PMS.get().getRegistry().addSystemTray(this); }
From source file:net.sf.nmedit.nomad.core.NomadLoader.java
License:Open Source License
private void initLookAndFeel(String lafClassName, String themeClassName, String defaultLafOnPlatform) { EnumSet<Platform.OS> defaultLafPlatforms = EnumSet.noneOf(Platform.OS.class); {/*from w ww . j ava 2 s .c o m*/ // remove whitespace + lowercase defaultLafOnPlatform = defaultLafOnPlatform.replaceAll("\\s", "").toLowerCase(); // split comma separated list String[] dlop = defaultLafOnPlatform.split(","); // check items for (String s : dlop) { if (s.equals("all")) { // on all platforms defaultLafPlatforms.addAll(EnumSet.allOf(Platform.OS.class)); break; } else if (s.equals("mac")) { defaultLafPlatforms.add(Platform.OS.MacOSFlavor); } else if (s.equals("unix")) { defaultLafPlatforms.add(Platform.OS.UnixFlavor); } else if (s.equals("windows")) { defaultLafPlatforms.add(Platform.OS.WindowsFlavor); } } } // jgoodies specific properties PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE); //UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, Boolean.FALSE); Options.setPopupDropShadowEnabled(false); Options.setUseNarrowButtons(true); //UIManager.put(Options.PLASTIC_MENU_FONT_KEY, new FontUIResource("Verdana", Font.PLAIN, 9)); //PlasticLookAndFeel.setFontPolicy(FontPolicies.getDefaultWindowsPolicy()); /* UIManager.put("MenuItem.margin", new InsetsUIResource(2,2,1,2)); UIManager.put("Menu.margin", new InsetsUIResource(1,2,1,2)); */ // set the metal theme if (defaultLafPlatforms.contains(Platform.flavor())) { // use default LAF on current platform try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable e) { Log log = LogFactory.getLog(getClass()); log.warn("could not set look and feel theme", e); } if (Platform.isFlavor(Platform.OS.MacOSFlavor)) { System.setProperty("apple.laf.useScreenMenuBar", "true"); } } else { // use LAF setting MetalTheme theme = null; if (themeClassName != null) { try { theme = (MetalTheme) Class.forName(themeClassName).newInstance(); UIManager.put("Plastic.theme", themeClassName); if (theme instanceof PlasticTheme) { PlasticLookAndFeel.setPlasticTheme((PlasticTheme) theme); // PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle()); } else if (theme instanceof MetalTheme) { MetalLookAndFeel.setCurrentTheme(theme); } } catch (Throwable e) { Log log = LogFactory.getLog(getClass()); log.warn("could not set look and feel theme", e); } } // set the look and feel if (lafClassName != null) { try { LookAndFeel LAF = (LookAndFeel) Class.forName(lafClassName).newInstance(); // it is very important to set the classloader UIManager.getDefaults().put("ClassLoader", getClass().getClassLoader()); UIManager.setLookAndFeel(LAF); } catch (Throwable e) { Log log = LogFactory.getLog(getClass()); log.warn("could not set custom look and feel", e); } } } }
From source file:org.columba.core.gui.themes.plugin.PlasticLookAndFeelPlugin.java
License:Mozilla Public License
/** * @see org.columba.core.gui.themes.plugin.AbstractThemePlugin#setLookAndFeel() *///from w w w. j a v a 2 s.co m public void setLookAndFeel() throws Exception { Options.setDefaultIconSize(new Dimension(16, 16)); Options.setUseNarrowButtons(false); Options.setPopupDropShadowEnabled(true); XmlElement options = Config.getInstance().get("options").getElement("/options"); XmlElement gui = options.getElement("gui"); XmlElement themeElement = gui.getElement("theme"); try { // UIManager.setLookAndFeel(lafName); String theme = themeElement.getAttribute("theme"); if (theme != null) { PlasticTheme t = getTheme(theme); LookUtils.setLookAndTheme(new PlasticXPLookAndFeel(), t); } else { PlasticTheme t = PlasticLookAndFeel.createMyDefaultTheme(); LookUtils.setLookAndTheme(new PlasticXPLookAndFeel(), t); } } catch (Exception e) { System.err.println("Can't set look & feel:" + e); } ; }
From source file:org.qedeq.gui.se.util.GuiHelper.java
License:Open Source License
/** * Configures the user interface; requests Swing settings and JGoodies Looks * options from the launcher./*from w ww.ja v a 2s . co m*/ * * @param options Set these options. */ public static void configureUI(final GuiOptions options) { UIManager.put("ClassLoader", CLASS.getClassLoader()); Options.setDefaultIconSize(new Dimension(18, 18)); Options.setUseNarrowButtons(options.isUseNarrowButtons()); Options.setTabIconsEnabled(options.isTabIconsEnabled()); UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, options.isPopupDropShadowEnabled()); // LATER m31 20100319: we make this now direct in QedeqPane, this line // didn't help. Why? // we want our disabled TextAreas to look same if not editable UIManager.put("TextArea.disabledBackground", UIManager.get("TextArea.background")); UIManager.put("ToolTip.font", new FontUIResource("Lucida Sans Unicode", Font.PLAIN, UIManager.getFont("ToolTip.font").getSize())); // Swing Settings LookAndFeel selectedLaf = options.getSelectedLookAndFeel(); if (selectedLaf instanceof PlasticLookAndFeel) { PlasticLookAndFeel.setPlasticTheme(options.getSelectedTheme()); PlasticLookAndFeel.setTabStyle(options.getPlasticTabStyle()); PlasticLookAndFeel.setHighContrastFocusColorsEnabled(options.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) { Trace.trace(CLASS, "configureUI", "Can't change L&F", e); } }
From source file:org.qi4j.envisage.Envisage.java
License:Apache License
private void initLookAndFeel() { String osName = System.getProperty("os.name").toUpperCase(); // set to use swing anti alias text only for JVM <= 1.5 System.setProperty("swing.aatext", "true"); // set default swing bold to false, only for JVM 1.5 or above UIManager.put("swing.boldMetal", Boolean.FALSE); // set LaF/* w w w.j a va2 s . c o m*/ LookAndFeel lnf = UIManager.getLookAndFeel(); if (lnf != null && lnf.getID().equalsIgnoreCase("Metal")) { final String lnfClassName; if (osName.startsWith("MAC")) { System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Envisage"); //TODO i18n System.setProperty("apple.laf.useScreenMenuBar", "true"); lnfClassName = UIManager.getSystemLookAndFeelClassName(); } else if (osName.startsWith("WINDOWS")) { UIManager.put("ClassLoader", LookUtils.class.getClassLoader()); lnfClassName = Options.getSystemLookAndFeelClassName(); Options.setUseNarrowButtons(false); } else { UIManager.put("ClassLoader", LookUtils.class.getClassLoader()); lnfClassName = Options.getCrossPlatformLookAndFeelClassName(); PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE); PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue()); Options.setUseNarrowButtons(false); //PlasticLookAndFeel.setMyCurrentTheme(new ExperienceBlueDefaultFont()); // for CJK Font } if (lnfClassName != null) { try { UIManager.setLookAndFeel(lnfClassName); } catch (Exception ex) { System.err.println("Unable to set LookAndFeel, use default LookAndFeel.\n" + ex.getMessage()); } } } }