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:daylightchart.Main.java

License:Open Source License

/**
 * Main window./*from w ww.  ja  va 2 s  .c  o m*/
 *
 * @param args
 *        Arguments
 */
public static void main(final String[] args) {

    CommandLineUtility.setLogLevel(args);

    // Parse command line
    final CommandLineParser parser = new CommandLineParser();
    parser.addOption(new BooleanOption(Option.NO_SHORT_FORM, OPTION_SLIMUI));
    parser.addOption(new StringOption(Option.NO_SHORT_FORM, OPTION_PREFERENCES, null));
    parser.addOption(new StringOption(Option.NO_SHORT_FORM, OPTION_LOCATION, null));
    parser.parse(args);
    boolean slimUi = parser.getBooleanOptionValue(OPTION_SLIMUI);
    final String preferencesDirectory = parser.getStringOptionValue(OPTION_PREFERENCES);
    final String locationString = parser.getStringOptionValue(OPTION_LOCATION);
    Location location = null;
    if (locationString != null) {
        try {
            location = LocationsListParser.parseLocation(locationString);
        } catch (final ParserException e) {
            location = null;
        }
    }

    if (StringUtils.isNotBlank(preferencesDirectory)) {
        UserPreferences.initialize(Paths.get(preferencesDirectory));
    }

    // Set UI look and feel
    try {
        PlasticLookAndFeel.setPlasticTheme(new LightGray());
        UIManager.setLookAndFeel(new PlasticLookAndFeel());
    } catch (final Exception e) {
        LOGGER.log(Level.WARNING, "Cannot set look and feel");
    }

    final Options options = UserPreferences.optionsFile().getData();
    if (!slimUi) {
        slimUi = options.isSlimUi();
    }
    options.setSlimUi(slimUi);
    UserPreferences.optionsFile().save(options);
    new DaylightChartGui(location, slimUi).setVisible(true);

}

From source file:de.modlab.smilib.gui.HelpFrame.java

License:Open Source License

/** Creates new form HelpFrame */
public HelpFrame() {

    //custom look and feel
    PlasticLookAndFeel.setPlasticTheme(new ExperienceRoyale());
    try {//from   w  ww. ja  v  a 2 s.  co  m
        UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
    } catch (UnsupportedLookAndFeelException ex) {
        ex.printStackTrace();
    }

    initComponents();
    this.setVisible(false);
    this.center();
}

From source file:de.modlab.smilib.gui.SmiLibFrame.java

License:Open Source License

/**
 * Creates new form SmiLibFrame//  w  ww.  ja  v  a2  s. c  om
 */
public SmiLibFrame() {
    //third party look and feel
    PlasticLookAndFeel.setPlasticTheme(new ExperienceRoyale());
    try {
        UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
    } catch (UnsupportedLookAndFeelException ex) {
        ex.printStackTrace();
    }

    //init
    this.initComponents();

    //custom panels are added
    this.addCustomComponents();

    //frame gets centered
    this.center();

    //frame gets shown
    this.setVisible(true);

    //init of message box
    messageBox = new javax.swing.JOptionPane();
}

From source file:edu.ku.brc.specify.BackupAndRestoreApp.java

License:Open Source License

/**
 * //from  ww  w  .j av  a2  s .c  o m
 */
public static void startApp() {
    // Then set this
    IconManager.setApplicationClass(BackupAndRestoreApp.class);
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_datamodel.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_plugins.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_disciplines.xml")); //$NON-NLS-1$

    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) {
        UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(BackupAndRestoreApp.class, e);
        log.error("Can't change L&F: ", e); //$NON-NLS-1$
    }

    ImageIcon helpIcon = IconManager.getIcon("AppIcon", IconSize.Std16); //$NON-NLS-1$
    HelpMgr.initializeHelp("SpecifyHelp", helpIcon.getImage()); //$NON-NLS-1$

    // Startup Specify
    BackupAndRestoreApp backupAndRestoreApp = new BackupAndRestoreApp();

    RolloverCommand.setHoverImg(IconManager.getIcon("DropIndicator")); //$NON-NLS-1$

    // THis type of start up ALWAYS assumes the .Specify directory is in there "home" directory.
    backupAndRestoreApp.preStartUp();
    backupAndRestoreApp.startUp();
}

From source file:edu.ku.brc.specify.config.init.secwiz.SpecifyDBSecurityWizardFrame.java

License:Open Source License

/**
 * @param args/* w  w  w  .j a v  a  2s  .c o  m*/
 */
public static void main(String[] args) {
    // Set App Name, MUST be done very first thing!
    UIRegistry.setAppName("Specify"); //$NON-NLS-1$

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

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

    try {
        if (!System.getProperty("os.name").equals("Mac OS X")) {
            UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
            PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
        }
    } catch (Exception e) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpecifyDBSecurityWizard.class, e);
        e.printStackTrace();
    }

    AppBase.processArgs(args);
    AppBase.setupTeeForStdErrStdOut(true, false);

    System.setProperty("appdatadir", "..");

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            // Then set this
            IconManager.setApplicationClass(Specify.class);
            IconManager.loadIcons(XMLHelper.getConfigDir("icons_datamodel.xml")); //$NON-NLS-1$
            IconManager.loadIcons(XMLHelper.getConfigDir("icons_plugins.xml")); //$NON-NLS-1$
            IconManager.loadIcons(XMLHelper.getConfigDir("icons_disciplines.xml")); //$NON-NLS-1$

            // Load Local Prefs
            AppPreferences localPrefs = AppPreferences.getLocalPrefs();
            //try {
            //System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+(new File(UIRegistry.getAppDataDir()).getCanonicalPath())+"]");
            //} catch (IOException ex) {}

            localPrefs.setDirPath(UIRegistry.getAppDataDir());

            // Check to see if we should check for a new version
            String VERSION_CHECK = "version_check.auto";
            if (localPrefs.getBoolean(VERSION_CHECK, null) == null) {
                localPrefs.putBoolean(VERSION_CHECK, true);
            }

            String EXTRA_CHECK = "extra.check";
            if (localPrefs.getBoolean(EXTRA_CHECK, null) == null) {
                localPrefs.putBoolean(EXTRA_CHECK, true);
            }

            if (UIHelper.isLinux()) {
                Specify.checkForSpecifyAppsRunning();
            }

            if (UIRegistry.isEmbedded()) {
                checkForMySQLProcesses();
            }

            Specify.setUpSystemProperties();

            final SpecifyDBSecurityWizardFrame wizardFrame = new SpecifyDBSecurityWizardFrame();

            if (localPrefs.getBoolean(VERSION_CHECK, true) && localPrefs.getBoolean(EXTRA_CHECK, true)) {
                try {
                    com.install4j.api.launcher.SplashScreen.hide();
                    ApplicationLauncher.Callback callback = new ApplicationLauncher.Callback() {
                        public void exited(int exitValue) {
                            UIHelper.centerAndShow(wizardFrame);
                        }

                        public void prepareShutdown() {

                        }
                    };
                    ApplicationLauncher.launchApplication("100", null, true, callback);

                } catch (Exception ex) {
                    UIHelper.centerAndShow(wizardFrame);
                }
            } else {
                UIHelper.centerAndShow(wizardFrame);
            }
        }
    });
}

From source file:edu.ku.brc.specify.config.init.SpecifyDBSetupWizardFrame.java

License:Open Source License

/**
 * @param args/*w ww  .  j  a  v  a  2s  .c  o m*/
 */
public static void main(String[] args) {
    // Set App Name, MUST be done very first thing!
    UIRegistry.setAppName("Specify"); //$NON-NLS-1$

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

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

    try {
        if (!System.getProperty("os.name").equals("Mac OS X")) {
            UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
            PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
        }
    } catch (Exception e) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpecifyDBSetupWizard.class, e);
        e.printStackTrace();
    }

    AppBase.processArgs(args);
    AppBase.setupTeeForStdErrStdOut(true, false);

    System.setProperty("appdatadir", "..");

    // Then set this
    IconManager.setApplicationClass(Specify.class);
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_datamodel.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_plugins.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_disciplines.xml")); //$NON-NLS-1$

    // Load Local Prefs
    AppPreferences localPrefs = AppPreferences.getLocalPrefs();
    //try {
    //System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+(new File(UIRegistry.getAppDataDir()).getCanonicalPath())+"]");
    //} catch (IOException ex) {}

    localPrefs.setDirPath(UIRegistry.getAppDataDir());

    // Check to see if we should check for a new version
    if (localPrefs.getBoolean(VERSION_CHECK, null) == null) {
        localPrefs.putBoolean(VERSION_CHECK, true);
    }

    if (localPrefs.getBoolean(EXTRA_CHECK, null) == null) {
        localPrefs.putBoolean(EXTRA_CHECK, true);
    }

    if (UIHelper.isLinux()) {
        Specify.checkForSpecifyAppsRunning();
    }

    if (UIRegistry.isEmbedded()) {
        ProcessListUtil.checkForMySQLProcesses(new ProcessListener() {
            @Override
            public void done(PROC_STATUS status) // called on the UI thread
            {
                if (status == PROC_STATUS.eOK || status == PROC_STATUS.eFoundAndKilled) {
                    startupContinuing();
                }
            }
        });
    } else {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                startupContinuing();
            }
        });
    }
}

From source file:edu.ku.brc.specify.conversion.ConvertVerifier.java

License:Open Source License

/**
 * @param args//from www  . j  a v  a 2  s.c om
 */
public static void main(String[] args) {

    UIRegistry.setAppName("Specify");
    AppBase.processArgs(args);

    // 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());
                }
            } catch (Exception e) {
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ConvertVerifier.class, e);
                log.error("Can't change L&F: ", e);
            }

            final ConvertVerifier cv = new ConvertVerifier();

            if (cv.selectedDBsToConvert()) {
                try {
                    final Pair<String, String> pair = cv.chooseTable();
                    if (pair != null) {
                        SwingWorker workerThread = new SwingWorker() {
                            @Override
                            public Object construct() {
                                try {
                                    boolean compareTo6DBS = false;
                                    if (compareTo6DBS) {
                                        pair.first = "ku_fish";
                                        pair.second = "kui_fish_dbo_6";
                                        cv.setCompareTo6DBs(compareTo6DBS);
                                    }

                                    cv.verifyDB(pair.first, pair.second);

                                } catch (Exception ex) {
                                    ex.printStackTrace();
                                }
                                return null;
                            }

                            @Override
                            public void finished() {
                            }
                        };

                        // start the background task
                        workerThread.start();

                    } else {
                        JOptionPane.showMessageDialog(null, "The ConvertVerifier was unable to login",
                                "Not Logged In", JOptionPane.ERROR_MESSAGE);
                        System.exit(0);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.exit(0);
                }
            }

        }
    });

}

From source file:edu.ku.brc.specify.conversion.GroupPermittedToViewFixer.java

License:Open Source License

/**
 * @param args//from   ww  w .  ja v a  2 s.  c  om
 */
public static void main(String[] args) {

    UIRegistry.setAppName("Specify");

    // 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());
                }
            } catch (Exception e) {
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ConvertVerifier.class, e);
                log.error("Can't change L&F: ", e);
            }

            final GroupPermittedToViewFixer cv = new GroupPermittedToViewFixer();

            if (cv.selectedDBsToConvert()) {
                try {
                    final Pair<String, String> pair = cv.chooseTable();
                    if (pair != null) {
                        SwingWorker workerThread = new SwingWorker() {
                            @Override
                            public Object construct() {
                                try {
                                    cv.fixDB(pair.first, pair.second);

                                } catch (Exception ex) {
                                    ex.printStackTrace();
                                }
                                return null;
                            }

                            @Override
                            public void finished() {
                            }
                        };

                        // start the background task
                        workerThread.start();

                    } else {
                        JOptionPane.showMessageDialog(null, "The GroupPermittedToViewFixer was unable to login",
                                "Not Logged In", JOptionPane.ERROR_MESSAGE);
                        System.exit(0);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.exit(0);
                }
            }

        }
    });

}

From source file:edu.ku.brc.specify.conversion.SpecifyDBConverter.java

License:Open Source License

/**
 * @param args/* w  w w. j  a va2s .co  m*/
 * @throws Exception
 */
public static void main(String args[]) throws Exception {
    /*try
    {
    List<String>   list = FileUtils.readLines(new File("/Users/rods/drop.sql"));
    Vector<String> list2 = new Vector<String>();
    for (String line : list)
    {
        list2.add(line+";");
    }
    FileUtils.writeLines(new File("/Users/rods/drop2.sql"), list2);
    return;
            
    } catch (Exception ex)
    {
    ex.printStackTrace();
    }*/

    // 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

    AppBase.processArgs(args);

    final SpecifyDBConverter converter = new SpecifyDBConverter();

    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());
                }
            } catch (Exception e) {
                log.error("Can't change L&F: ", e);
            }

            Pair<String, String> namePair = null;
            try {
                if (converter.selectedDBsToConvert(false)) {
                    namePair = converter.chooseTable("Select a DB to Convert", "Specify 5 Databases", true);
                }

            } catch (SQLException ex) {
                ex.printStackTrace();
                JOptionPane.showConfirmDialog(null, "The Converter was unable to login.", "Error",
                        JOptionPane.CLOSED_OPTION);
            }

            if (namePair != null) {
                frame = new ProgressFrame("Converting");

                converter.processDB();
            } else {
                JOptionPane.showConfirmDialog(null, "The Converter was unable to login.", "Error",
                        JOptionPane.CLOSED_OPTION);
                System.exit(0);
            }
        }
    });
}

From source file:edu.ku.brc.specify.extras.FixSQLString.java

License:Open Source License

/**
 * @param args/*  w  ww  .  jav a  2s. c om*/
 */
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 PlasticLookAndFeel());
                    PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());

                } else if (osType == UIHelper.OSTYPE.Linux) {
                    UIManager.setLookAndFeel(new PlasticLookAndFeel());
                }
            } 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);
            }
            FixSQLString fix = new FixSQLString();
            fix.setVisible(true);

        }
    });
}