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

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

Introduction

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

Prototype

public PlasticLookAndFeel() 

Source Link

Document

Constructs the PlasticLookAndFeel, creates the default theme and sets it as current Plastic theme.

Usage

From source file:at.lux.fotoannotation.AnnotationFrame.java

License:Open Source License

/**
 * Main method used to embedGraph Caliph
 *
 * @param args/*from   w ww  .j  a v a2 s. com*/
 */
public static void main(String[] args) {
    JWindow w = new JWindow();
    try {
        w = new JWindow();
        BufferedImage img = ImageIO.read(AnnotationFrame.class.getResourceAsStream("data/SplashCaliph.png"));
        FullSizeImagePanel panel = new FullSizeImagePanel(img);
        w.getContentPane().add(panel, BorderLayout.CENTER);
        w.pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        w.setLocation((screenSize.width - w.getWidth()) / 2, (screenSize.height - w.getHeight()) / 2);
        w.setVisible(true);
    } catch (IOException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }
    UIManager.put("Application.useSystemFontSettings", Boolean.TRUE);
    //        PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE);
    try {
        UIManager.setLookAndFeel(new PlasticLookAndFeel());
    } catch (Exception e) {
        System.err.println("Could not set Look & Feel: " + e.toString());
    }
    boolean showSplash = true;

    // get config file from splashscreen class
    File splashProps = new File(SplashScreen.LICENSE_ACCEPTED_FILENAME);
    // look if exists
    if (splashProps.exists()) {
        // load props
        try {
            Properties licenseAcceptedProps = new Properties();
            licenseAcceptedProps.load(new FileInputStream(splashProps));
            // if property is set we do not have to show the splashscreen:
            String tmp = licenseAcceptedProps.getProperty("license.accepted");
            if (tmp != null && tmp.equals("true")) {
                showSplash = false;
            }
        } catch (IOException e) {
            System.err.println("Warn: Could not read license properties file.");
        }
    }
    // if there is some problem starting Caliph the program exits
    // and gives some error message:
    try {
        AnnotationFrame frame = new AnnotationFrame();
        if (showSplash) {
            // now show the splash screen if this has not been done before.
            SplashScreen splash = new SplashScreen(frame);
            splash.setVisible(true);
        }
        if (w != null)
            w.setVisible(false);
        frame.setVisible(true);
    } catch (Exception e) {
        JOptionPane.showConfirmDialog(null, "Error: " + e.toString(), "Error starting Caliph!",
                JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE);
        e.printStackTrace();
        System.exit(0);
    }
}

From source file:at.lux.fotoretrieval.RetrievalFrame.java

License:Open Source License

public static void main(String[] args) {
    JWindow w = null;/*from   w ww  .ja va  2  s.c o  m*/
    try {
        w = new JWindow();
        BufferedImage img = ImageIO.read(AnnotationFrame.class.getResourceAsStream("data/SplashEmir.png"));
        FullSizeImagePanel panel = new FullSizeImagePanel(img);
        w.getContentPane().add(panel, BorderLayout.CENTER);
        w.pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        w.setLocation((screenSize.width - w.getWidth()) / 2, (screenSize.height - w.getHeight()) / 2);
        w.setVisible(true);
    } catch (IOException e) {
        e.printStackTrace();
    }
    try {
        //            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        UIManager.setLookAndFeel(new PlasticLookAndFeel());
    } catch (Exception e) {
        System.err.println("Could not set Look & Feel: " + e.toString());
    }
    boolean showSplash = true;

    // get config file from splashscreen class
    File splashProps = new File(SplashScreen.LICENSE_ACCEPTED_FILENAME);
    // look if exists
    if (splashProps.exists()) {
        // load props
        try {
            Properties licenseAcceptedProps = new Properties();
            licenseAcceptedProps.load(new FileInputStream(splashProps));
            // if property is set we do not have to show the splashscreen:
            String tmp = licenseAcceptedProps.getProperty("license.accepted");
            if (tmp != null && tmp.equals("true")) {
                showSplash = false;
            }
        } catch (IOException e) {
            System.err.println("Warn: Could not read license properties file.");
        }
    }

    try {
        RetrievalFrame rf = new RetrievalFrame();
        SplashScreen splash = new SplashScreen(rf);
        if (showSplash) {
            // now show the splash screen if this has not been done before.
            splash.setVisible(true);
        }
        w.setVisible(false);
        rf.setVisible(true);
    } catch (Exception e) {
        JOptionPane.showConfirmDialog(null, "Error: " + e.toString(), "Error starting Emir!",
                JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE);
        e.printStackTrace();
        System.exit(0);
    }
}

From source file:com.frinika.simphoney.Simphoney2Main.java

License:Open Source License

private static void configureUI_MacOS() {
    try {//  w  ww.ja va 2  s.co  m

        ismac = true;

        System.setProperty("apple.laf.useScreenMenuBar", "true");
        System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Frinika");

        Object cMenuBarUI = UIManager.get("MenuBarUI");
        Object cMenuItemUI = UIManager.get("MenuItemUI");
        Object cMenuUI = UIManager.get("MenuUI");
        Object cCheckBoxMenuItemUI = UIManager.get("CheckBoxMenuItemUI");
        Object cRadioButtonMenuItemUI = UIManager.get("RadioButtonMenuItemUI");
        Object cPopupMenuUI = UIManager.get("PopupMenuUI");
        Object cProgressBarUI = UIManager.get("ProgressBarUI");

        UIManager.setLookAndFeel(new PlasticLookAndFeel());

        UIManager.put("MenuBarUI", cMenuBarUI);
        UIManager.put("MenuItemUI", cMenuItemUI);
        UIManager.put("MenuUI", cMenuUI);
        UIManager.put("CheckBoxMenuItemUI", cCheckBoxMenuItemUI);
        UIManager.put("RadioButtonMenuItemUI", cRadioButtonMenuItemUI);
        UIManager.put("PopupMenuUI", cPopupMenuUI);
        UIManager.put("ProgressBarUI", cProgressBarUI);

        Application.getInstance().getAboutJMenuItem().addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                About.about(null);
            }
        });

        Application.getInstance().getQuitJMenuItem().addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                ProjectFrame.getFocusFrame().tryQuit();
            }
        });

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.github.mgeiss.xls2ora.Xls2Ora.java

License:Apache License

public static void main(String[] args) {
    try {//w  ww.j a  v a 2  s . com
        PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());
        UIManager.setLookAndFeel(new PlasticLookAndFeel());
    } catch (Exception ex) {
    }

    WorkflowController controller = new WorkflowController();
    controller.setStartPanel(new SelectSourcePanel(controller));
}

From source file:com.prodp.apsim.APProcessHandler.java

License:Apache License

/**
 * /* ww w.  j  ava  2  s  . c o m*/
 * 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:com.sdi.pws.gui.Pws.java

License:Open Source License

private static void startgGui() {
    // Set the look and feel.
    PlasticLookAndFeel.setPlasticTheme(new DesertRed());
    try {/*w ww . j  av  a  2 s.c o  m*/
        UIManager.setLookAndFeel(new PlasticLookAndFeel());
    } catch (Exception ignored) {
    }

    // Change the default JOptionPane icons.
    UIManager.put("OptionPane.okIcon", new ImageIcon(Pws.class.getClassLoader().getResource("assets/go.png")));
    UIManager.put("OptionPane.cancelIcon",
            new ImageIcon(Pws.class.getClassLoader().getResource("assets/cancel.png")));

    // Load user preferences.
    final Preferences lPrefs = new PreferencesImpl();
    PrefStorage.loadPreferences(lPrefs);
    final ChangeViewPreferences lGlobalPreferences = new ChangeViewPreferences(lPrefs);

    // Application Frame.
    final JFrame lAppFrame = new JFrame();
    lAppFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    final ImageIcon lAppIcon = new ImageIcon(Pws.class.getClassLoader().getResource("assets/pwt-icon.gif"));
    lAppFrame.setIconImage(lAppIcon.getImage());

    // Application Menu Bar.
    final JMenuBar lAppMenu = new JMenuBar();
    lAppFrame.setJMenuBar(lAppMenu);

    // File menu.
    final JMenu lFileMenu = new JMenu(GuiUtil.getText("menu.file"));
    lFileMenu.setMnemonic('F');
    lAppMenu.add(lFileMenu);

    final JMenu lConvertMenu = new JMenu(GuiUtil.getText("menu.convert"));
    lConvertMenu.setMnemonic('C');
    final ImageIcon lConvertIcon = new ImageIcon(Pws.class.getClassLoader().getResource("assets/convert.png"));
    lConvertMenu.setIcon(lConvertIcon);

    final JMenu lImportMenu = new JMenu(GuiUtil.getText("menu.import"));
    lImportMenu.setMnemonic('I');
    // Install the icon.
    final ImageIcon lImportIcon = new ImageIcon(Pws.class.getClassLoader().getResource("assets/import.png"));
    lImportMenu.setIcon(lImportIcon);

    final JMenu lExportMenu = new JMenu(GuiUtil.getText("menu.export"));
    lExportMenu.setMnemonic('E');
    // Install the icon.
    final ImageIcon lExportIcon = new ImageIcon(Pws.class.getClassLoader().getResource("assets/export.png"));
    lExportMenu.setIcon(lExportIcon);

    // Password menu.
    final JMenu lPasswordMenu = new JMenu(GuiUtil.getText("menu.password"));
    lPasswordMenu.setMnemonic('P');
    lAppMenu.add(lPasswordMenu);

    // View menu.
    final JMenu lViewMenu = new JMenu(GuiUtil.getText("menu.view"));
    lViewMenu.setMnemonic('V');
    lAppMenu.add(lViewMenu);

    // Help menu.
    final JMenu lHelpMenu = new JMenu(GuiUtil.getText("menu.help"));
    lHelpMenu.setMnemonic('H');
    lAppMenu.add(lHelpMenu);
    // Listen for help.
    final JMenuItem lHelpItem = new JMenuItem(GuiUtil.getText("menuitem.help"),
            new ImageIcon(Pws.class.getClassLoader().getResource("assets/help.png")));
    final HelpBroker lBroker = GuiUtil.getHelpBroker();
    lBroker.setCurrentID("intro_html");
    lHelpItem.addActionListener(new CSH.DisplayHelpFromSource(lBroker));
    lHelpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    lHelpMenu.add(lHelpItem);

    // Vertical button panel size.
    final int lButtonPanelWidth = 27;

    // Left button panel.
    final JPanel lLeftButtonPanel = new JPanel();
    lLeftButtonPanel.setLayout(new GridLayout(2, 1));
    lLeftButtonPanel.setMaximumSize(new Dimension(lButtonPanelWidth, 0));
    lLeftButtonPanel.setMinimumSize(new Dimension(lButtonPanelWidth, 0));
    lLeftButtonPanel.setPreferredSize(new Dimension(lButtonPanelWidth, 0));
    lAppFrame.getRootPane().getContentPane().add(lLeftButtonPanel, BorderLayout.WEST);
    // Button panel buttons.
    JButton lLeftCopyUID = new JButton();
    lLeftButtonPanel.add(lLeftCopyUID);
    JButton lLeftCopyPwd = new JButton();
    lLeftButtonPanel.add(lLeftCopyPwd);
    // Set startup visibility.
    try {
        lLeftButtonPanel.setVisible(lGlobalPreferences.getBoolPref(Preferences.PREF_BUTTONS_LEFT));
    } catch (PreferencesException ignored) {
    }
    // Set dynamic visibility.
    lGlobalPreferences.addPropertyChangeListener(Preferences.PREF_BUTTONS_LEFT, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            try {
                lLeftButtonPanel.setVisible(lGlobalPreferences.getBoolPref(Preferences.PREF_BUTTONS_LEFT));
            } catch (PreferencesException ignored) {
            }
        }
    });

    // Right button panel.
    final JPanel lRightButtonPanel = new JPanel();
    lRightButtonPanel.setLayout(new GridLayout(2, 1));
    lRightButtonPanel.setMaximumSize(new Dimension(lButtonPanelWidth, 0));
    lRightButtonPanel.setMinimumSize(new Dimension(lButtonPanelWidth, 0));
    lRightButtonPanel.setPreferredSize(new Dimension(lButtonPanelWidth, 0));
    lAppFrame.getRootPane().getContentPane().add(lRightButtonPanel, BorderLayout.EAST);
    // Button panel buttons.
    JButton lRightCopyUID = new JButton();
    lRightButtonPanel.add(lRightCopyUID);
    JButton lRightCopyPWD = new JButton();
    lRightButtonPanel.add(lRightCopyPWD);
    // Set startup visibility.
    try {
        lRightButtonPanel.setVisible(lGlobalPreferences.getBoolPref(Preferences.PREF_BUTTONS_RIGHT));
    } catch (PreferencesException ignored) {
    }
    // Set dynamic visibility.
    lGlobalPreferences.addPropertyChangeListener(Preferences.PREF_BUTTONS_RIGHT, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            try {
                lRightButtonPanel.setVisible(lGlobalPreferences.getBoolPref(Preferences.PREF_BUTTONS_RIGHT));
            } catch (PreferencesException eIgnore) {
            }
        }
    });

    // View stack.
    final JPanel lViews = new JPanel();
    final CardLayout lViewLayout = new CardLayout();
    lViews.setLayout(lViewLayout);
    lAppFrame.getRootPane().getContentPane().add(lViews, BorderLayout.CENTER);

    // Table view.
    final JTable lTableView = new JTable();
    lTableView.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    final JScrollPane lTableViewScroll = new JScrollPane(lTableView);
    final FilteredCellRenderer lFilteredRenderer = new FilteredCellRenderer();
    lTableView.setDefaultRenderer(ChangeViewField.class, lFilteredRenderer);
    final Box lTableBox = Box.createVerticalBox();
    // Create the filter panel.
    final JPanel lFilterPanel = new JPanel();
    lFilterPanel.setLayout(new BorderLayout());
    final JLabel lFilterLabel = new JLabel(
            new ImageIcon(Start.class.getClassLoader().getResource("assets/loep.png")));
    lFilterLabel.setBorder(new EmptyBorder(1, 1, 1, 5));
    lFilterPanel.setBackground(Color.white);
    lFilterPanel.add(lFilterLabel, BorderLayout.WEST);
    final JTextField lTableFilter = new JTextField();
    lFilterPanel.add(lTableFilter, BorderLayout.CENTER);
    lFilterPanel.setBorder(lTableFilter.getBorder());
    lTableFilter.setBorder(null);
    // Force fixed height filter box. Widht can vary, but height should remain the same.
    lFilterPanel.setMaximumSize(new Dimension(10000, 50));
    lTableBox.add(lFilterPanel);
    lTableBox.add(lTableViewScroll);
    lViews.add(lTableBox, Preferences.VIEW_TABLE);

    // Tree view.
    final JTree lTreeView = new JTree();
    lTreeView.setBorder(new EmptyBorder(3, 3, 3, 3));
    final JScrollPane lTreeViewScroll = new JScrollPane(lTreeView);
    lViews.add(lTreeViewScroll, Preferences.VIEW_TREE);

    // Select current view and initialize view name holder.
    final String lDefaultView = lGlobalPreferences.getPref(Preferences.PREF_DEFAULT_VIEW);
    final StringHolder lViewName = new StringHolderImpl(lDefaultView);
    lViewLayout.show(lViews, lDefaultView);

    // Initialize a default empty database.
    final ChangeViewDatabase lDb = new ChangeViewDatabase(new PwsDatabaseImpl());
    lDb.setCodec(new Codec2());
    lDb.setChanged(false);
    final DatabaseHolder lDbHolder = new DatabaseHolderImpl(lDb);

    // Application title.
    final TitleRenderer lTitlemgr = new TitleRenderer(lAppFrame, lDbHolder);

    // Init the table view. Several wrappers are added for additional table functionality.
    final TableViewDatabase lTableModel = new TableViewDatabase(lDb);
    final SortableTableModel lSortedTableModel = new SortableTableModel(lTableModel);
    final FilteredTableModel lFilteredTableModel = new FilteredTableModel(lSortedTableModel);
    final TreeViewDatabase lTreeModel = new TreeViewDatabase(lDb);
    lTableView.setModel(lFilteredTableModel);
    lTreeView.setModel(lTreeModel);
    // Add a filter feedback.
    lTableFilter.addKeyListener(new KeyListener() {
        public void keyPressed(KeyEvent e) {
            doit();
        }

        public void keyReleased(KeyEvent e) {
            doit();
        }

        public void keyTyped(KeyEvent e) {
        }

        private void doit() {
            // Apply the search pattern to the table model.
            final String lSearchString = lTableFilter.getText();
            lFilteredRenderer.setSearchString(lSearchString);
            lFilteredTableModel.search(lSearchString);
            // If there is one and only one row left in the table, we automatically select it.
            if (lFilteredTableModel.getRowCount() == 1)
                lTableView.getSelectionModel().setSelectionInterval(0, 0);
        }
    });

    // Selector.
    final TableViewSelector lTableSelector = new TableViewSelector(lFilteredTableModel, lTableView);
    final TreeViewSelector lTreeSelector = new TreeViewSelector(lTreeView);
    final DynamicRecordSelector lRecordSelector = new DynamicRecordSelector(
            (("tree".equals(lViewName)) ? lTreeSelector : lTableSelector));

    lDbHolder.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            // Get the new plain database.
            final ChangeViewDatabase lCurrentDb = lDbHolder.getCurrentDatabase();

            // Give it to the models.
            lTableModel.setDatabase(lCurrentDb);
            lTreeModel.setDatabase(lCurrentDb);
        }
    });

    // Actions.
    final ClipboardMonitor lMonitor = new ClipboardMonitor();
    final Action lCopyUidAction = new CopyUid(lRecordSelector, lMonitor);
    lPasswordMenu.add(lCopyUidAction).setAccelerator(
            KeyStroke.getKeyStroke('U', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
    lLeftCopyUID.setAction(new ActionNoName(lCopyUidAction));
    lRightCopyUID.setAction(new ActionNoName(lCopyUidAction));

    final Action lCopyPwdAction = new CopyPwd(lRecordSelector, lMonitor);
    lPasswordMenu.add(lCopyPwdAction).setAccelerator(
            KeyStroke.getKeyStroke('P', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
    lLeftCopyPwd.setAction(new ActionNoName(lCopyPwdAction));
    lRightCopyPWD.setAction(new ActionNoName(lCopyPwdAction));

    final Action lClearClipboardAction = new ClearClipboard(lMonitor);
    lPasswordMenu.add(lClearClipboardAction).setAccelerator(
            KeyStroke.getKeyStroke('D', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));

    final Action lOpenFileAction = new FileOpen(lAppFrame.getRootPane(), lDbHolder, lGlobalPreferences);
    lFileMenu.add(lOpenFileAction).setAccelerator(
            KeyStroke.getKeyStroke('O', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));

    final Action lSaveFileAction = new FileSave(lAppFrame.getRootPane(), lDbHolder, lGlobalPreferences);
    lFileMenu.add(lSaveFileAction).setAccelerator(
            KeyStroke.getKeyStroke('S', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));

    final Action lSaveAsFileAction = new FileSaveAs(lAppFrame.getRootPane(), lDbHolder, lGlobalPreferences);
    lFileMenu.add(lSaveAsFileAction).setAccelerator(
            KeyStroke.getKeyStroke('A', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));

    final Action lNewFileAction = new FileNew(lAppFrame.getRootPane(), lDbHolder);
    lFileMenu.add(lNewFileAction).setAccelerator(
            KeyStroke.getKeyStroke('N', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));

    final Action lChangePassphraseAction = new PassphraseChange(lAppFrame, lDbHolder, lGlobalPreferences);
    lFileMenu.add(lChangePassphraseAction);

    lFileMenu.addSeparator();
    lFileMenu.add(lConvertMenu);
    lFileMenu.add(lImportMenu);
    lFileMenu.add(lExportMenu);

    final Action lAppPrefsAction = new AppPrefsEdit(lAppFrame.getRootPane(), lGlobalPreferences);
    lFileMenu.add(lAppPrefsAction);

    final Action lAppExitAction = new AppExit(lAppFrame.getRootPane(), lDbHolder, lGlobalPreferences);
    lFileMenu.addSeparator();
    lFileMenu.add(lAppExitAction).setAccelerator(
            KeyStroke.getKeyStroke('Q', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
    lAppFrame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            lAppExitAction.actionPerformed(new ActionEvent(lAppFrame, 0, null));
        }
    });

    final Action lEditEntryAction = new EntryEdit(lAppFrame.getRootPane(), lRecordSelector, lDbHolder,
            lGlobalPreferences);
    lPasswordMenu.addSeparator();
    lPasswordMenu.add(lEditEntryAction).setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
    // Force the Enter key on the table and tree to do an edit.
    // If we don't force this, the enter will have the same effect as walking through the list/tree.
    lTableView.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "EDIT");
    lTableView.getActionMap().put("EDIT", lEditEntryAction);
    lTreeView.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "EDIT");
    lTreeView.getActionMap().put("EDIT", lEditEntryAction);

    final Action lNewEntryAction = new EntryNew(lAppFrame.getRootPane(), lTreeModel, lGlobalPreferences);
    lPasswordMenu.add(lNewEntryAction).setAccelerator(
            KeyStroke.getKeyStroke('E', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));

    // Force the CTRL-A key on the table and tree to do a new.
    // If we don't force this, the CTRL-A will have the same effect as selecting all entries.
    lTableView.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK), "NEW");
    lTableView.getActionMap().put("NEW", lNewEntryAction);
    lTreeView.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK), "NEW");
    lTreeView.getActionMap().put("NEW", lNewEntryAction);

    final Action lDeleteEntryAction = new EntryDelete(lAppFrame.getRootPane(), lTreeModel, lRecordSelector);
    lPasswordMenu.add(lDeleteEntryAction).setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));

    final int lTextGap = 3;

    final Action lTableViewAction = new ViewTable(lViews, lRecordSelector, lTableSelector, lViewName);
    final JRadioButton lTableButton = new JRadioButton(lTableViewAction);
    lTableButton.setIconTextGap(lTextGap);
    lTableButton.setSelected(!lTableViewAction.isEnabled());
    lTableViewAction.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent aPropertyChangeEvent) {
            lTableButton.setSelected(!lTableViewAction.isEnabled());
        }
    });
    lViewMenu.add(lTableButton);

    final Action lTreeViewAction = new ViewTree(lViews, lRecordSelector, lTreeSelector, lViewName);
    final JRadioButton lTreeButton = new JRadioButton(lTreeViewAction);
    lTreeButton.setIconTextGap(lTextGap);
    lTreeButton.setSelected(!lTreeViewAction.isEnabled());
    lTreeButton.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent aPropertyChangeEvent) {
            lTreeButton.setSelected(!lTreeViewAction.isEnabled());
        }
    });
    lViewMenu.add(lTreeButton);

    // The stay on top option.
    final JCheckBox lStayPut = new JCheckBox(GuiUtil.getText("action.stayontop"));
    try {
        lStayPut.setSelected(lGlobalPreferences.getBoolPref(Preferences.PREF_STAY_ON_TOP));
    } catch (PreferencesException e) {
    }
    lStayPut.setIconTextGap(lTextGap);
    lViewMenu.add(lStayPut);
    lAppFrame.setAlwaysOnTop(lStayPut.isSelected());
    lStayPut.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent aPropertyChangeEvent) {
            lAppFrame.setAlwaysOnTop(lStayPut.isSelected());
        }
    });

    // Add right mouse button popup to the table view.
    lTableView.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            checkPopup(e);
        }

        public void mouseClicked(MouseEvent e) {
            checkPopup(e);
        }

        public void mouseReleased(MouseEvent e) {
            checkPopup(e);
        }

        private void checkPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {
                // See if we have a selection.
                final PwsRecord lRecord = lRecordSelector.getSelectedRecord();

                // Create an array of URL actions if there any URL's hidden in the notes field.
                // URL actions are only possible if there is a selected record.
                Action[] lUrlActions = null;
                String lNotes = null;
                if (lRecord != null && lRecord.hasType(PwsField.FIELD_NOTES)) {
                    try {
                        lNotes = lRecord.get(PwsField.FIELD_NOTES).getAsString();
                    } catch (Exception eIgnore) {
                    }
                    java.util.List<String> lUrls = SwinglibUtil.extractUrl(lNotes);
                    if (lUrls.size() > 0) {
                        lUrlActions = new Action[lUrls.size()];
                        for (int i = 0; i < lUrls.size(); i++)
                            lUrlActions[i] = new BrowseUrl(lUrls.get(i));
                    }
                }
                // Create the popup menu dynamically.
                JPopupMenu lPop;

                lPop = SwinglibUtil.popupBuilder(
                        new Action[] { lCopyUidAction, lCopyPwdAction, lClearClipboardAction },
                        new Action[] { lEditEntryAction, lNewEntryAction, lDeleteEntryAction }, lUrlActions);
                // Show the popup to the user.
                lPop.show(lTableView, e.getX(), e.getY());
            }
        }
    });
    // Add right mouse button popup.
    lTreeView.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            checkPopup(e);
        }

        public void mouseClicked(MouseEvent e) {
            checkPopup(e);
        }

        public void mouseReleased(MouseEvent e) {
            checkPopup(e);
        }

        private void checkPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {

                // See if we have a selection.
                final PwsRecord lRecord = lRecordSelector.getSelectedRecord();

                // Create an array of URL actions if there any URL's hidden in the notes field.
                // URL actions are only possible if there is a selected record.
                Action[] lUrlActions = null;
                String lNotes = null;
                if (lRecord != null && lRecord.hasType(PwsField.FIELD_NOTES)) {
                    try {
                        lNotes = lRecord.get(PwsField.FIELD_NOTES).getAsString();
                    } catch (Exception eIgnore) {
                    }
                    java.util.List<String> lUrls = SwinglibUtil.extractUrl(lNotes);
                    if (lUrls.size() > 0) {
                        lUrlActions = new Action[lUrls.size()];
                        for (int i = 0; i < lUrls.size(); i++)
                            lUrlActions[i] = new BrowseUrl(lUrls.get(i));
                    }
                }
                // Create the popup menu dynamically.
                JPopupMenu lPop;
                lPop = SwinglibUtil.popupBuilder(
                        new Action[] { lCopyUidAction, lCopyPwdAction, lClearClipboardAction },
                        new Action[] { lEditEntryAction, lNewEntryAction, lDeleteEntryAction }, lUrlActions);

                // Show the popup to the user.
                lPop.show(lTreeView, e.getX(), e.getY());
            }
        }
    });

    final Action lFileUpgradeAction = new FileVersionUpgrade(lAppFrame.getRootPane(), lDbHolder,
            lGlobalPreferences);
    lConvertMenu.add(lFileUpgradeAction);

    final Action lFiledowngradeAction = new FileVersionDowngrade(lAppFrame.getRootPane(), lDbHolder);
    lConvertMenu.add(lFiledowngradeAction);

    final Action lFileExportCsvAction = new FileCsvExport(lAppFrame.getRootPane(), lDbHolder,
            lGlobalPreferences);
    lExportMenu.add(lFileExportCsvAction);

    final Action lFileImportCsvAction = new FileCsvImport(lAppFrame.getRootPane(), lDbHolder,
            lGlobalPreferences);
    lImportMenu.add(lFileImportCsvAction);

    final Action lFileImportPwsAction = new FilePwsImport(lAppFrame.getRootPane(), lDbHolder,
            lGlobalPreferences);
    lImportMenu.add(lFileImportPwsAction);

    final Action lFileExportXmlAction = new FileXmlExport(lAppFrame.getRootPane(), lDbHolder,
            lGlobalPreferences);
    lExportMenu.add(lFileExportXmlAction);

    final Action lFileImportXmlAction = new FileXmlImport(lAppFrame.getRootPane(), lDbHolder,
            lGlobalPreferences);
    lImportMenu.add(lFileImportXmlAction);

    final Action lAboutAction = new AppAbout(lAppFrame.getRootPane());
    lHelpMenu.add(lAboutAction);

    // Start screen.
    Start.startPws(lAppFrame, lDbHolder, lGlobalPreferences);

    // Start the GUI.
    lAppFrame.pack();
    GuiUtil.centerComponent(lAppFrame);
    lAppFrame.setVisible(true);
}

From source file:daylightchart.Main.java

License:Open Source License

/**
 * Main window.//from  w ww . j  av a  2 s .c  om
 *
 * @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:edu.ku.brc.specify.BackupAndRestoreApp.java

License:Open Source License

/**
 * /*from  w  ww.  j  a  va 2  s. co 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.extras.FixSQLString.java

License:Open Source License

/**
 * @param args//from  w  w w.  j a v a  2s .  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 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);

        }
    });
}

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

License:Open Source License

/**
 *
 *//*from w w w.  j  ava 2  s  . c om*/
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$

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

    //UIHelper.attachUnhandledException();

    SwingUtilities.invokeLater(new Runnable() {
        @SuppressWarnings("synthetic-access") //$NON-NLS-1$
        public void run() {
            log.debug("Checking for update....");
            try {
                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());

                    } else {
                        //PlafOptions.setAsLookAndFeel();
                    }
                } catch (Exception e) {
                    log.error("Can't change L&F: ", e); //$NON-NLS-1$
                }

                // Load Local Prefs
                AppPreferences localPrefs = AppPreferences.getLocalPrefs();
                localPrefs.setDirPath(UIRegistry.getAppDataDir());

                ProxyHelper.setProxySettingsFromPrefs();

                checkDebugLoggerSettings();

                //log.error("LocalPrefs: "+(new File(UIRegistry.getAppDataDir())).getCanonicalPath());

                // 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);
                }

                // For Proxies
                boolean isOKToGetSpecialMsgs = AppPreferences.getLocalPrefs().getBoolean("GET_SPECIAL_MSGS",
                        true);
                if (isOKToGetSpecialMsgs) {
                    SpecialMsgNotifier smn = new SpecialMsgNotifier();
                    smn.checkForMessages();
                }

                if (UIRegistry.isEmbedded() && !UIRegistry.isMobile()) {
                    String EZDB_FIRSTTIME = "ezdb.firsttime";
                    if (localPrefs.getBoolean(EZDB_FIRSTTIME, null) == null) {
                        UIRegistry.showLocalizedMsg("EZDB_FIRSTTIME");
                        localPrefs.putBoolean(EZDB_FIRSTTIME, true);
                        localPrefs.flush();
                    }
                }

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

                // Managed Releases
                // it's never managed for the Release Manager
                //                  boolean isReleaseManager = localPrefs.getBoolean("RELEASE_MANAGER", false);
                //                  boolean isManagedRelease = localPrefs.getBoolean(MANAGED_RELEASES, false);
                //                  boolean isMgrRel         = !isReleaseManager && isManagedRelease;
                //
                //                  // Never check if it is a managed release
                //                  boolean verChk = localPrefs.getBoolean(VERSION_CHECK, true);
                //                  if (localPrefs.getBoolean(VERSION_CHECK, true) && !isMgrRel)
                //                  {
                //                      if (!isMgrRel)
                //                      {
                //                          localPrefs.getBoolean(MANAGED_RELEASES, false); // remove it in case it was turned on
                //                      }

                //                      try
                //                      {
                //                        com.install4j.api.launcher.SplashScreen.hide();
                //                         ApplicationLauncher.Callback callback = new ApplicationLauncher.Callback()
                //                         {
                //                             @Override
                //                             public void exited(int exitValue)
                //                             {
                //                                 startApp();
                //                             }
                //                             
                //                             @Override
                //                             public void prepareShutdown()
                //                             {
                //                                 
                //                             }
                //                          };
                //                          //ApplicationLauncher.launchApplication("100", getProxySettings(), true, callback);
                //                          
                //                      } catch (Exception ex)
                //                      {
                //                          //ex.printStackTrace();
                //                          log.error(ex);
                //                          startApp();
                //                      }
                //                  } else
                //                  {
                //                      if (!isExtraCheck && StringUtils.isNotEmpty(UIRegistry.getAppVersion()))
                //                      {
                //                          UIRegistry.showLocalizedMsg(null, "SpReg.NOT_REGISTERED");
                //                      }
                startApp();
                //                  }
            } catch (Exception ex) {
                ex.printStackTrace();
                log.error(ex);
            }
        }
    });

}