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

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

Introduction

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

Prototype

public static void setPlasticTheme(PlasticTheme theme) 

Source Link

Document

Sets the theme for colors and fonts used by the Plastic L&F.

After setting the theme, you need to re-install the Look&Feel, as well as update the UI's of any previously created components - just as if you'd change the Look&Feel.

Usage

From source file:edu.ku.brc.specify.utilapps.BuildSampleDatabase.java

License:Open Source License

/**
 * @param args/*from w  w w. j  av a  2s  .  co m*/
 */
public static void main(final String[] args) {
    System.setProperty(DBMSUserMgr.factoryName, "edu.ku.brc.dbsupport.MySQLDMBSUserMgr");
    try {
        ResourceBundle.getBundle("resources", Locale.getDefault()); //$NON-NLS-1$

    } catch (MissingResourceException ex) {
        Locale.setDefault(Locale.ENGLISH);
        setResourceLocale(Locale.ENGLISH);
    }

    new HiddenTableMgr();
    try {
        if (!System.getProperty("os.name").equals("Mac OS X")) {
            UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
            PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (StringUtils.isEmpty(getAppName())) {
        setAppName("Specify");
    }

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            BuildSampleDatabase builder = new BuildSampleDatabase();
            builder.buildSetup(args);
        }
    });
}

From source file:edu.ku.brc.specify.utilapps.CreateTextSchema.java

License:Open Source License

/**
 * @param args/*from w w w. j  a  v a 2  s .  co m*/
 */
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        @SuppressWarnings("synthetic-access") //$NON-NLS-1$
        public void run() {
            try {
                UIHelper.OSTYPE osType = UIHelper.getOSType();
                if (osType == UIHelper.OSTYPE.Windows) {
                    UIManager.setLookAndFeel(new PlasticLookAndFeel());
                    PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());

                } else if (osType == UIHelper.OSTYPE.Linux) {
                    UIManager.setLookAndFeel(new PlasticLookAndFeel());
                }
            } catch (Exception e) {
            }

            String schemaVersion = JOptionPane.showInputDialog("Enter Schema Version:");

            Locale.setDefault(currLang);

            try {
                ResourceBundle.getBundle("resources", Locale.getDefault()); //$NON-NLS-1$

            } catch (MissingResourceException ex) {
                Locale.setDefault(Locale.ENGLISH);
                UIRegistry.setResourceLocale(Locale.ENGLISH);
            }

            CreateTextSchema cts = new CreateTextSchema();
            cts.process(schemaVersion);

            //File file = XMLHelper.getConfigDir(specifyDescFileName);
            //file.delete();

            JOptionPane.showMessageDialog(null, "Done");
        }
    });
}

From source file:edu.ku.brc.specify.utilapps.DataModelClassGenerator.java

License:Open Source License

/**
 * @param args//from w  ww  . jav  a 2  s . c o m
 */
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        @SuppressWarnings("synthetic-access")
        public void run() {
            try {
                UIHelper.OSTYPE osType = UIHelper.getOSType();
                if (osType == UIHelper.OSTYPE.Windows) {
                    //UIManager.setLookAndFeel(new WindowsLookAndFeel());
                    UIManager.setLookAndFeel(new PlasticLookAndFeel());
                    PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());

                } else if (osType == UIHelper.OSTYPE.Linux) {
                    //UIManager.setLookAndFeel(new GTKLookAndFeel());
                    UIManager.setLookAndFeel(new PlasticLookAndFeel());
                    //PlasticLookAndFeel.setPlasticTheme(new SkyKrupp());
                    //PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
                    //PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());
                    //PlasticLookAndFeel.setPlasticTheme(new DesertGreen());

                }
            } catch (Exception e) {
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(DataModelClassGenerator.class, e);
                //log.error("Can't change L&F: ", e);
            }
            DataModelClassGenerator dmcg = new DataModelClassGenerator(Appraisal.class);
            UIHelper.centerAndShow(dmcg);

        }
    });
}

From source file:edu.ku.brc.specify.utilapps.sp5utils.Sp5Forms.java

License:Open Source License

/**
 * @param args// www.j av  a2s .c o  m
 */
public static void main(String[] args) {

    // Set App Name, MUST be done very first thing!
    UIRegistry.setAppName("Specify"); //$NON-NLS-1$

    log.debug("********* Current [" + (new File(".").getAbsolutePath()) + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    UIRegistry.setEmbeddedDBPath(UIRegistry.getDefaultEmbeddedDBPath()); // on the local machine

    for (String s : args) {
        String[] pairs = s.split("="); //$NON-NLS-1$
        if (pairs.length == 2) {
            if (pairs[0].startsWith("-D")) //$NON-NLS-1$
            {
                //System.err.println("["+pairs[0].substring(2, pairs[0].length())+"]["+pairs[1]+"]");
                System.setProperty(pairs[0].substring(2, pairs[0].length()), pairs[1]);
            }
        } else {
            String symbol = pairs[0].substring(2, pairs[0].length());
            //System.err.println("["+symbol+"]");
            System.setProperty(symbol, symbol);
        }
    }

    // Now check the System Properties
    String appDir = System.getProperty("appdir");
    if (StringUtils.isNotEmpty(appDir)) {
        UIRegistry.setDefaultWorkingPath(appDir);
    }

    String appdatadir = System.getProperty("appdatadir");
    if (StringUtils.isNotEmpty(appdatadir)) {
        UIRegistry.setBaseAppDataDir(appdatadir);
    }

    Logger logger = LogManager.getLogger("edu.ku.brc");
    if (logger != null) {
        logger.setLevel(Level.ALL);
        System.out.println("Setting " + logger.getName() + " to " + logger.getLevel());
    }

    logger = LogManager.getLogger(edu.ku.brc.dbsupport.HibernateUtil.class);
    if (logger != null) {
        logger.setLevel(Level.INFO);
        System.out.println("Setting " + logger.getName() + " to " + logger.getLevel());
    }

    // Create Specify Application
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try {
                if (!System.getProperty("os.name").equals("Mac OS X")) {
                    UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
                    PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
                }

                final Sp5Forms frame = new Sp5Forms();
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setBounds(0, 0, 800, 800);

                new MacOSAppHandler(frame);

                frame.startup();

                frame.createUI();
                JMenuBar mb = new JMenuBar();
                JMenu fileMenu = new JMenu("File");

                JMenuItem openMI = new JMenuItem("Open XML File");
                fileMenu.add(openMI);
                openMI.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        frame.openXML();
                    }
                });

                JMenuItem openDBMI = new JMenuItem("Open Database");
                fileMenu.add(openDBMI);
                openDBMI.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        frame.openDB();
                    }
                });

                JMenuItem saveMI = new JMenuItem("Save");
                fileMenu.add(saveMI);
                saveMI.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        frame.saveXML();
                    }
                });

                if (!UIHelper.isMacOS()) {
                    fileMenu.addSeparator();
                    JMenuItem mi = new JMenuItem("Exit");
                    fileMenu.add(mi);

                    mi.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            System.exit(0);
                        }
                    });
                }

                mb.add(fileMenu);
                frame.setJMenuBar(mb);

                centerAndShow(frame);
            } catch (Exception e) {
                log.error("Can't change L&F: ", e);
            }
        }
    });
}

From source file:es.GRelatorio.java

/**
 * Creates new form GRelatorio//from  w  ww  .  ja va 2s  .  c  o  m
 */
public GRelatorio() {
    initComponents();

    setLocationRelativeTo(null); //projela tela centralizada
    setIconImage(new ImageIcon(getClass().getResource("/es/imagens/logomtbranco2.png")).getImage()); //icone da empresa 

    //mudar design da tela
    try {
        PlasticLookAndFeel.setPlasticTheme(new ExperienceRoyale());
        try {
            UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
        } catch (InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
        }

    } catch (ClassNotFoundException ex) {
    }
    SwingUtilities.updateComponentTreeUI(this);
}

From source file:es.TelaPrototipo.java

/**
 * Creates new form TelaPrototipo/*from   ww w . j  a  v a 2  s .  c  o m*/
 */
public TelaPrototipo() {
    initComponents();

    setLocationRelativeTo(null); //projela tela centralizada
    setIconImage(new ImageIcon(getClass().getResource("/es/imagens/logomtbranco2.png")).getImage()); //icone da empresa 

    //mudar design da tela
    try {
        PlasticLookAndFeel.setPlasticTheme(new ExperienceRoyale());
        try {
            UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
        } catch (InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
        }

    } catch (ClassNotFoundException ex) {
    }
    SwingUtilities.updateComponentTreeUI(this);

}

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 ww  w. ja v  a  2  s . co 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:it.pdfsam.util.ThemeSelector.java

License:Open Source License

/**
 * Sets the theme/*w  w w  . j  a va  2s  . c o  m*/
 * @param theme_number Theme number
 * @return true if no exception in threw
 */
public boolean setTheme(String theme_number) {
    try {
        switch (Integer.parseInt(theme_number)) {
        case 1:
            PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
            break;
        case 2:
            PlasticLookAndFeel.setPlasticTheme(new DesertRed());
            break;
        case 3:
            PlasticLookAndFeel.setPlasticTheme(new Silver());
            break;
        case 4:
            PlasticLookAndFeel.setPlasticTheme(new SkyPink());
            break;
        case 5:
            PlasticLookAndFeel.setPlasticTheme(new SkyKrupp());
            break;
        case 6:
            PlasticLookAndFeel.setPlasticTheme(new SkyYellow());
            break;
        case 7:
            PlasticLookAndFeel.setPlasticTheme(new SkyGreen());
            break;
        case 8:
            PlasticLookAndFeel.setPlasticTheme(new DarkStar());
            break;
        case 9:
            PlasticLookAndFeel.setPlasticTheme(new BrownSugar());
            break;
        case 10:
            PlasticLookAndFeel.setPlasticTheme(new DesertGreen());
            break;
        case 11:
            PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());
            break;
        case 12:
            PlasticLookAndFeel.setPlasticTheme(new ExperienceGreen());
            break;
        case 13:
            PlasticLookAndFeel.setPlasticTheme(new SkyBlue());
            break;
        case 14:
            PlasticLookAndFeel.setPlasticTheme(new SkyBluer());
        default:
            break;
        }
        return true;
    } catch (NumberFormatException e) {
        return false;
    }
}

From source file:it.pdfsam.utils.ThemeSelector.java

License:Open Source License

/**
 * Sets the theme/*from w  w w .  ja v  a  2  s. c o m*/
 * @param theme_number Theme number
 * @return true if no exception in threw
 */
public boolean setTheme(String theme_number) {
    try {
        switch (Integer.parseInt(theme_number)) {
        case 1:
            PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
            break;
        case 2:
            PlasticLookAndFeel.setPlasticTheme(new DesertRed());
            break;
        case 3:
            PlasticLookAndFeel.setPlasticTheme(new Silver());
            break;
        case 4:
            PlasticLookAndFeel.setPlasticTheme(new SkyPink());
            break;
        case 5:
            PlasticLookAndFeel.setPlasticTheme(new SkyKrupp());
            break;
        case 6:
            PlasticLookAndFeel.setPlasticTheme(new SkyYellow());
            break;
        case 7:
            PlasticLookAndFeel.setPlasticTheme(new SkyGreen());
            break;
        case 8:
            PlasticLookAndFeel.setPlasticTheme(new DarkStar());
            break;
        case 9:
            PlasticLookAndFeel.setPlasticTheme(new BrownSugar());
            break;
        case 10:
            PlasticLookAndFeel.setPlasticTheme(new DesertGreen());
            break;
        case 11:
            PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());
            break;
        case 12:
            PlasticLookAndFeel.setPlasticTheme(new ExperienceGreen());
            break;
        case 13:
            PlasticLookAndFeel.setPlasticTheme(new SkyBlue());
            break;
        default:
            break;
        }
        return true;
    } catch (NumberFormatException e) {
        return false;
    }
}

From source file:jsattrak.gui.JSatTrak.java

License:Open Source License

/**
 * @return true if the user has java 6u10 (and therefore Nimbus is
 *         supported/used)// ww w  .jav a2s.c o m
 */
private boolean setLookAndFeel() {
    boolean usingNimbus = false;
    try {
        // TEMP UNTIL NIMBUS WORKS WITH INTERNAL WINDOWS
        String laf = "org.jvnet.substance.skin.Substance" + "Raven" + "LookAndFeel";
        LafChanger.changeLaf(this, laf);
    } catch (Exception ex2) {
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); //
            usingNimbus = true;
        } catch (Exception ex1) // default using jgoodies looks plastic
        // theme
        {
            PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());
            PlasticLookAndFeel.setTabStyle("Metal"); // makes tabes look
            // much better

            try {
                UIManager.setLookAndFeel(new PlasticLookAndFeel());
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
    return usingNimbus;
}