Example usage for com.jgoodies.looks.plastic PlasticLookAndFeel setTabStyle

List of usage examples for com.jgoodies.looks.plastic PlasticLookAndFeel setTabStyle

Introduction

In this page you can find the example usage for com.jgoodies.looks.plastic PlasticLookAndFeel setTabStyle.

Prototype

public static void setTabStyle(String tabStyle) 

Source Link

Usage

From source file:net.pms.newgui.LooksFrame.java

License:Open Source License

static void initializeLookAndFeel() {
    if (lookAndFeelInitialized) {
        return;/*from   www  .  j  ava 2  s  .c o  m*/
    }

    LookAndFeel selectedLaf = null;
    if (Platform.isWindows()) {
        try {
            selectedLaf = (LookAndFeel) Class.forName("com.jgoodies.looks.windows.WindowsLookAndFeel")
                    .newInstance();
        } catch (Exception e) {
            selectedLaf = new PlasticLookAndFeel();
        }
    } else if (System.getProperty("nativelook") == null && !Platform.isMac()) {
        selectedLaf = new PlasticLookAndFeel();
    } 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 (Exception e1) {
            selectedLaf = new PlasticLookAndFeel();
            logger.error("Error while setting native look and feel: ", e1);
        }
    }

    if (selectedLaf instanceof PlasticLookAndFeel) {
        PlasticLookAndFeel.setPlasticTheme(PlasticLookAndFeel.createMyDefaultTheme());
        PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE);
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(false);
    } else if (selectedLaf != null && 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);

    if (selectedLaf != null) {
        try {
            UIManager.setLookAndFeel(selectedLaf);
        } catch (UnsupportedLookAndFeelException e) {
            logger.warn("Can't change look and feel", e);
        }
    }

    lookAndFeelInitialized = true;
}

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  a va2  s  . co 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.qedeq.gui.se.util.GuiHelper.java

License:Open Source License

/**
 * Configures the user interface; requests Swing settings and JGoodies Looks
 * options from the launcher./* w ww . j  a va 2  s .  c om*/
 *
 * @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());
            }
        }
    }
}

From source file:org.springframework.richclient.application.config.JGoodiesLooksConfigurer.java

License:Apache License

/**
 * @param tabStyle set the tab style that should be used.
 * @see com.jgoodies.looks.plastic.PlasticLookAndFeel#setTabStyle(String)   
 */// ww w .j a  v  a  2  s  .c  o m
public void setTabStyle(String tabStyle) {
    PlasticLookAndFeel.setTabStyle(tabStyle);
}

From source file:org.tentackle.plaf.tlooks.TLooksLookAndFeel.java

License:Open Source License

public void configureTLooksLookAndFeel() {
    PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE);
    PlasticLookAndFeel.set3DEnabled(true);
    Options.setPopupDropShadowEnabled(true);
    UIManager.put(Options.PLASTIC_MICRO_LAYOUT_POLICY_KEY, TLooksMicroLayoutPolicies.getDefaultPlasticPolicy());
}

From source file:pl.otros.logview.gui.LogViewMainFrame.java

License:Apache License

/**
 * @param args porgram CLI arguments//from  w  ww . j  a  v  a  2s .c o  m
 * @throws InitializationException
 * @throws InvocationTargetException
 * @throws InterruptedException
 */
public static void main(final String[] args)
        throws InitializationException, InterruptedException, InvocationTargetException {
    if (args.length > 0 && "-batch".equals(args[0])) {
        try {
            String[] batchArgs = new String[args.length - 1];
            System.arraycopy(args, 1, batchArgs, 0, batchArgs.length);
            BatchProcessor.main(batchArgs);
        } catch (IOException | ConfigurationException e) {
            System.err.println("Error during batch processing: " + e.getMessage());
            e.printStackTrace();
        }
        return;
    }
    SingleInstanceRequestResponseDelegate singleInstanceRequestResponseDelegate = SingleInstanceRequestResponseDelegate
            .getInstance();
    singleInstance = SingleInstance.request("OtrosLogViewer", singleInstanceRequestResponseDelegate,
            singleInstanceRequestResponseDelegate, args);
    if (singleInstance == null) {
        LOGGER.info("OtrosLogViewer is already running, params send using requestAction");
        System.exit(0);
    }

    LOGGER.info("Starting application");
    OtrosSplash.setMessage("Starting application");
    OtrosSplash.setMessage("Loading configuration");
    final XMLConfiguration c = getConfiguration("config.xml");
    if (!c.containsKey(ConfKeys.UUID)) {
        c.setProperty(ConfKeys.UUID, UUID.randomUUID().toString());
    }
    IconsLoader.loadIcons();
    OtrosSplash.setMessage("Loading icons");
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            try {
                OtrosSplash.setMessage("Loading L&F");
                String lookAndFeel = c.getString("lookAndFeel",
                        "com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
                LOGGER.debug("Initializing look and feel: " + lookAndFeel);
                PlasticLookAndFeel.setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE);
                UIManager.setLookAndFeel(lookAndFeel);
            } catch (Throwable e1) {
                LOGGER.warn("Cannot initialize LookAndFeel: " + e1.getMessage());
            }
            try {
                final DataConfiguration c1 = new OtrosConfiguration(c);
                final LogViewMainFrame mf = new LogViewMainFrame(c1);
                // mf.exitAction was instantiated in the constructor (previous line)
                // Not sure retrieving this from most appropriate Apache config
                // object.
                mf.exitAction.setConfirm(c.getBoolean("generalBehavior.confirmExit", true));
                /* TODO:  Implement User Preferences screen or checkbox on exit widget
                 * that will update the same config object something like:
                 *     c.setProperty("generalBehavior.confirmExit", newValue);
                 */
                mf.addComponentListener(new ComponentAdapter() {
                    @Override
                    public void componentResized(ComponentEvent e) {
                        c.setProperty("gui.state", mf.getExtendedState());
                        if (mf.getExtendedState() == Frame.NORMAL) {
                            c.setProperty("gui.width", mf.getWidth());
                            c.setProperty("gui.height", mf.getHeight());
                        }
                    }

                    @Override
                    public void componentMoved(ComponentEvent e) {
                        c.setProperty("gui.location.x", mf.getLocation().x);
                        c.setProperty("gui.location.y", mf.getLocation().y);
                    }
                });
                mf.addWindowListener(mf.exitAction);
                SingleInstanceRequestResponseDelegate.openFilesFromStartArgs(mf.otrosApplication,
                        Arrays.asList(args), mf.otrosApplication.getAppProperties().getCurrentDir());
            } catch (InitializationException e) {
                LOGGER.error("Cannot initialize main frame", e);
            }
        }
    });
}

From source file:salomon.engine.controller.LocalController.java

License:Open Source License

/**
 * @see salomon.engine.controller.IController#start(salomon.engine.platform.IManagerEngine)
 *///w  ww .j av  a 2  s.c o m
public void start(IManagerEngine managerEngine) {
    _managerEngine = managerEngine;
    SplashScreen.show();
    try {
        PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE);
        PlasticLookAndFeel.setMyCurrentTheme(new ExperienceBlue());
        UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
    } catch (Exception e) {
        LOGGER.warn("Cannot set look&feel!", e); //$NON-NLS-1$
    }
    //TODO: add cascade model support (?)
    try {
        _solutionManagerGUI = new SolutionManagerGUI(_managerEngine.getSolutionManager());
        _projectManagerGUI = new ProjectManagerGUI(_managerEngine.getProjectManager());
        _taskManagerGUI = new TaskManagerGUI(_managerEngine.getTasksManager());
        _pluginMangerGUI = new PluginManagerGUI(_managerEngine.getPluginManager());
    } catch (PlatformException e) {
        LOGGER.fatal("", e); //$NON-NLS-1$
        Utils.showErrorMessage("ERR_CANNOT_SHOW_GUI"); //$NON-NLS-1$
        return;
    }

    _actionManager = new ActionManager(_solutionManagerGUI, _projectManagerGUI, _taskManagerGUI,
            _pluginMangerGUI);

    _guiMenu = new LocalGUIMenu(_actionManager);
    ControllerFrame frame = new ControllerFrame();
    _solutionManagerGUI.setParent(frame);
    _projectManagerGUI.setParent(frame);
    _pluginMangerGUI.setParent(frame);
    _taskManagerGUI.setParent(frame);

    _solutionManagerGUI.setActionManager(_actionManager);
    _pluginMangerGUI.setActionManager(_actionManager);
    _taskManagerGUI.setActionManager(_actionManager);
    _projectManagerGUI.setTaskManagerGUI(_taskManagerGUI);

    SplashScreen.hide();

    frame.setContentPane(getJContentPane());
    frame.setJMenuBar(getJMenuBar());
    frame.setJToolBar(getToolBar());
    frame.setControllerPanel(_contentPane);
    Utils.setParent(frame);

    //showSolutionChooser();
    _solutionManagerGUI.showSolutionChooser();
}