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

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

Introduction

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

Prototype

public Plastic3DLookAndFeel() 

Source Link

Document

Constructs the JGoodies Plastic3D look&feel.

Usage

From source file:org.drools.examples.broker.Main.java

License:Apache License

/**
 * @param args/*  ww w . j a v  a  2  s  .  c o  m*/
 * @throws UnsupportedLookAndFeelException 
 */
public static void main(String[] args) throws Exception {
    // set up and show main window
    UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    Locale.setDefault(Locale.US);
    CompanyRegistry registry = new CompanyRegistry();
    BrokerWindow window = new BrokerWindow(registry.getCompanies());
    window.show();
    //Thread.sleep( 10000 );
    Broker broker = new Broker(window, registry);

    TimerService clock = new JDKTimerService(1);

    //        StockTickPersister source = new StockTickPersister();
    //        source.openForRead( new InputStreamReader( Main.class.getResourceAsStream( "/stocktickstream.dat" ) ),
    //                            System.currentTimeMillis() );

    SmooksEventSource source = new SmooksEventSource();
    source.processFeed(Main.class.getResourceAsStream("/stocktickstream.dat"));

    EventFeeder feeder = new EventFeeder(clock, source, broker);
    feeder.feed();

}

From source file:org.fibs.geotag.Geotag.java

License:Open Source License

/**
 * Application entry point.//from  w w  w .j a  v a  2s .  co  m
 * 
 * @param args
 *          Command line arguments
 */
public static void main(String[] args) {
    // check command line arguments
    // all of this is "developer only"
    // use Settings instead for end users
    for (String arg : args) {
        // each argument must be of form -key=value
        int equalsPos = arg.indexOf('='); // position of first equals sign
        if (arg.length() >= "-k=v".length() && // minimum -k=v //$NON-NLS-1$
                arg.charAt(0) == '-' && // first char is minus
                equalsPos >= 2 && // first value at least one character long
                equalsPos < arg.length() - 1) { // something follows the =
            // looks good so far, let's split the argument
            // start at 1, skipping the minus sign and going to just before
            // the equals sign
            String key = arg.substring(1, equalsPos);
            // start just after the equals sign
            String value = arg.substring(equalsPos + 1);
            // now see what to do with them
            if (key.equals("po") && value.length() > 0) { //$NON-NLS-1$
                Messages_po.processPoFile(value);
                I18n.setOverrideBundle(new Messages_po());
            } else if (key.equals("language") && value.length() > 0) { //$NON-NLS-1$
                Locale locale = LocaleUtil.localeFromString(value);
                Locale.setDefault(locale);
            } else if (key.equals("console") && value.equals("yes")) { //$NON-NLS-1$ //$NON-NLS-2$
                redirectConsole = false;
            }
        }
    }
    i18n = I18nFactory.getI18n(Geotag.class);
    // first of all we redirect the console output to a file
    if (redirectConsole) {
        File logFile = new File(System.getProperty("java.io.tmpdir") //$NON-NLS-1$
                + File.separator + NAME + ".log"); //$NON-NLS-1$
        try {
            @SuppressWarnings("resource")
            PrintStream printStream = new PrintStream(logFile);
            System.setOut(printStream);
            System.setErr(printStream);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
    // log java version
    logJavaVersion();
    logLocale();
    try {
        UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    } catch (Exception e) {
        e.printStackTrace();
    }
    // check that the program has enough memory available
    int maxMemory = (int) Math.round(Runtime.getRuntime().maxMemory() / Util.square(Constants.ONE_K));
    if (maxMemory < MIN_MEMORY) {
        String message = "<html><center>" //$NON-NLS-1$
                + String.format(i18n.tr(
                        "%1$s has only detected %2$d MB of memory.<br> Please run it with 'Java Web Start' from <b>%3$s</b><br>or run %1$s like this:") //$NON-NLS-1$
                        + "<br><b><code>java -Xmx256M -jar geotag.jar</code></b>", //$NON-NLS-1$
                        NAME, Integer.valueOf(maxMemory), WEBSITE)
                + "</center></html>"; //$NON-NLS-1$
        JOptionPane.showMessageDialog(null, message, i18n.tr("Not enough memory"), //$NON-NLS-1$
                JOptionPane.WARNING_MESSAGE);
    }
    // check for new version
    String latestVersion = Version.updateAvaiable();
    String message = "<html><center>" //$NON-NLS-1$
            + String.format(i18n.tr("A new version %1$s of <b>%2$s</b><br>is available at %3$s"), //$NON-NLS-1$
                    latestVersion, NAME, WEBSITE)
            + "</center></html>"; //$NON-NLS-1$
    if (latestVersion != null) {
        JOptionPane.showMessageDialog(null, message, i18n.tr("New version"), //$NON-NLS-1$
                JOptionPane.INFORMATION_MESSAGE);
    }
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            // Kick off the image loading process (will return null, so ignore);
            FlattrImageLoader.getImageIcon();
            MainWindow mainWindow = new MainWindow();
            mainWindow.setVisible(true);
            if (!Exiftool.isAvailable()) {
                WhatNext.helpWhatNext(mainWindow, mainWindow.getTableModel());
            }
        }
    });

}

From source file:org.jdal.swing.ApplicationContextGuiFactory.java

License:Apache License

public static void setPlasticLookAndFeel() {
    try {/* ww  w  .j  a  v a 2 s  .  c  o m*/
        UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
        UIManager.put("Table.gridColor", new ColorUIResource(Color.GRAY));
        UIManager.put("TableHeader.background", new ColorUIResource(220, 220, 220));

    } catch (UnsupportedLookAndFeelException e) {
        log.error(e);
    }
}

From source file:org.pmedv.blackboard.test.PanelTest.java

License:Open Source License

public static void main(String[] args) {

    Plastic3DLookAndFeel.setPlasticTheme(new SkyRed());

    try {/*w w  w  . j a v  a2  s. c  o m*/
        UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
        com.jgoodies.looks.Options.setPopupDropShadowEnabled(true);
    } catch (Exception e) {
        System.out.println("failed to set look and feel.");
    }

    final PixelEditor pixelEditor = new PixelEditor(16, 16);

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));

    JButton clearButton = new JButton("Clear");
    clearButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            pixelEditor.clear();
        }
    });

    JButton colorButton = new JButton("Color");
    colorButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            pixelEditor.triggerColorSelect();
        }
    });

    JButton fillButton = new JButton("Fill");
    fillButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            pixelEditor.fill();
        }
    });

    JButton saveImageButton = new JButton("Export");

    saveImageButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final JFileChooser fc = new JFileChooser(System.getProperty("user.home"));

            fc.setDialogTitle("Save image");
            fc.setApproveButtonText("Save");

            int result = fc.showOpenDialog(frame);

            if (result == JFileChooser.APPROVE_OPTION) {

                if (fc.getSelectedFile() == null)
                    return;

                File selectedFile = fc.getSelectedFile();
                try {
                    ImageIO.write(pixelEditor.getImage(), "PNG", selectedFile);
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }

        }
    });

    JButton saveButton = new JButton("Save");

    saveButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final JFileChooser fc = new JFileChooser(System.getProperty("user.home"));

            fc.setDialogTitle("Save image");
            fc.setApproveButtonText("Save");

            int result = fc.showOpenDialog(frame);

            if (result == JFileChooser.APPROVE_OPTION) {

                if (fc.getSelectedFile() == null)
                    return;

                File selectedFile = fc.getSelectedFile();

                try {
                    ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(selectedFile));
                    oos.writeObject(pixelEditor.getPixels());

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

            }

        }
    });

    JButton loadButton = new JButton("Load");

    loadButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final JFileChooser fc = new JFileChooser(System.getProperty("user.home"));

            fc.setDialogTitle("Open image");
            fc.setApproveButtonText("Open");

            int result = fc.showOpenDialog(frame);

            if (result == JFileChooser.APPROVE_OPTION) {

                if (fc.getSelectedFile() == null)
                    return;

                File selectedFile = fc.getSelectedFile();

                try {
                    ObjectInputStream ois = new ObjectInputStream(new FileInputStream(selectedFile));
                    Pixel[][] pixels = (Pixel[][]) ois.readObject();
                    pixelEditor.setPixels(pixels);
                } catch (Exception e1) {
                    e1.printStackTrace();
                }

            }

        }
    });

    buttonPanel.add(clearButton);
    buttonPanel.add(colorButton);
    buttonPanel.add(fillButton);
    buttonPanel.add(saveImageButton);
    buttonPanel.add(saveButton);
    buttonPanel.add(loadButton);

    frame = new JFrame("Pixel-O-Mat");
    frame.setSize(new Dimension(330, 380));
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(new BorderLayout());
    frame.add(pixelEditor, BorderLayout.CENTER);
    frame.add(buttonPanel, BorderLayout.SOUTH);
    frame.setLocationRelativeTo(frame.getRootPane());
    frame.setVisible(true);

}

From source file:org.pmedv.core.gui.ApplicationWindowAdvisorImpl.java

License:Open Source License

@Override
public void preWindowCreate() {

    log.info("initializing.");

    String laf = (String) Preferences.values.get("org.pmedv.blackboard.BoardDesignerPerspective.lookAndFeel");

    try {/*  w  w  w .  jav  a 2 s  . c  o  m*/
        if (laf.equals("Nimbus")) {
            UIManager.setLookAndFeel(new NimbusLookAndFeel());
        } else if (laf.equals("SkyBlue")) {
            Plastic3DLookAndFeel.setPlasticTheme(new SkyBluer());
            UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
            com.jgoodies.looks.Options.setPopupDropShadowEnabled(true);
        } else {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
    } catch (Exception e2) {
        log.info("failed to set look and feel.");
    }

    final Color blackboardLightBlue = new Color(225, 234, 242);
    final Color blackBoardDarkBlue = new Color(182, 191, 205);
    final Color blackboardLightGrey = new Color(220, 220, 222);

    UIManager.put("TaskPane.titleBackgroundGradientStart", Color.WHITE);
    UIManager.put("TaskPane.titleBackgroundGradientEnd", blackboardLightBlue);
    UIManager.put("TaksPane.specialTitleBackground", blackboardLightBlue);
    UIManager.put("TaskPane.titleBackground", blackboardLightBlue);
    UIManager.put("TaskPane.borderColor", blackboardLightBlue);
    UIManager.put("TaskPane.background", blackboardLightGrey);
    UIManager.put("TaskPaneContainer.backgroundPainter", new MattePainter(blackBoardDarkBlue));

    log.info("setting look and feel to: " + UIManager.getLookAndFeel());

    // construct app icon

    Image iconImage = resources.getIcon("icon.application").getImage();

    MediaTracker mt = new MediaTracker(win);
    mt.addImage(iconImage, 0);

    try {
        mt.waitForAll();
    } catch (InterruptedException e) {
        // Silently ignore
    }

    InputStream is = getClass().getClassLoader().getResourceAsStream("application.properties");
    Properties properties = new Properties();
    try {
        properties.load(is);
    } catch (IOException e1) {
        properties.setProperty("version", "not set");
    }

    win.setTitle(windowConfig.getConfig().getTitle() + " Version " + properties.get("version"));
    win.setIconImage(iconImage);
    win.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    win.addWindowListener(win);

    ToolTipManager.sharedInstance().setInitialDelay(100);
    ToolTipManager.sharedInstance().setDismissDelay(1000);

}

From source file:org.systemsbiology.mzxmlviewer.Viewer.java

License:Open Source License

/**
 * Configure the application's standard look & feel.
 *//*from  w ww  .jav a2  s.c o  m*/
private static void setupLookAndFeel() {
    PlasticLookAndFeel.setMyCurrentTheme(new SkyBluerTahoma());
    try {
        UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    } catch (Exception e) {
    }
}

From source file:org.wremja.launcher.Launcher.java

License:Open Source License

/**
 * Initialize the look & feel of the application.
 *//*from w w  w .j  ava2  s .  com*/
private static void initLookAndFeel() {
    LOG.debug("Initializing look and feel ...");

    // enable antialiasing
    System.setProperty("swing.aatext", "true");

    // use Xrender pipeline on Linux, if available
    System.setProperty("sun.java2d.xrender", "true");

    try {
        // a) Try windows
        UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
        Plastic3DLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE);
        Plastic3DLookAndFeel.setHighContrastFocusColorsEnabled(true);
    } catch (UnsupportedLookAndFeelException e) {
        // b) Try system look & feel
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception ex) {
            LOG.error(ex, ex);
        }
    }
    String s = LookAndFeelAddons.getBestMatchAddonClassName();
    try {
        LookAndFeelAddons.setAddon(s);
    } catch (Exception e) {
        LOG.warn(e, e);
    }
}

From source file:ro.fortsoft.momo.JcrBrowser.java

License:Apache License

private static void setLookAndFeel() {
    PlasticLookAndFeel laf = new Plastic3DLookAndFeel();
    PlasticLookAndFeel.setCurrentTheme(new ExperienceBlue());
    try {/*from  www  .ja v a 2  s. co m*/
        UIManager.setLookAndFeel(laf);
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();
    }
}

From source file:ro.nextreports.designer.ui.wizard.demo.WizardDemo.java

License:Apache License

public static void main(String args[]) {
    // set look and feel
    PlasticLookAndFeel laf = new Plastic3DLookAndFeel();
    PlasticLookAndFeel.setCurrentTheme(new ExperienceBlue());
    try {//  w w  w. j  a v a 2s  .  c  o  m
        UIManager.setLookAndFeel(laf);
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();
    }

    JFrame frame = new JFrame("Wizard Demo");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    Wizard wizard = new Wizard(new WelcomeWizardPanel());
    wizard.addWizardListener(new WizardDemo());
    frame.setContentPane(wizard);
    //        frame.pack();
    frame.setSize(450, 400);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

From source file:tufts.vue.gui.GUI.java

License:Educational Community License

public static void init() {
    if (!initUnderway) {
        if (DEBUG.INIT)
            out("init: already run");
        return;//from   w w w.ja  v a2 s.c o  m
    }

    Log.debug("init");

    if (FORCE_WINDOWS_LAF || SKIP_CUSTOM_LAF || SKIP_OCEAN_THEME || SKIP_WIN_NATIVE_LAF)
        System.out.println("GUI.init; test parameters:" + "\n\tforceWindowsLookAndFeel=" + FORCE_WINDOWS_LAF
                + "\n\tskip_custom_laf=" + SKIP_CUSTOM_LAF + "\n\tskip_ocean_theme=" + SKIP_OCEAN_THEME
                + "\n\tskip_win_native_laf=" + SKIP_WIN_NATIVE_LAF);

    if (SKIP_CUSTOM_LAF)
        Log.info("INIT: skipping installation of custom VUE Look & Feels");

    /* VUE's JIDE open-source license if we end up using this:
    tufts.Util.executeIfFound("com.jidesoft.utils.Lm", "verifyLicense",
                          new Object[] { "Scott Fraize",
                                         "VUE",
                                         "p0HJOS:Y049mQb8BLRr9ntdkv9P6ihW" });
    */

    isMacAqua = Util.isMacPlatform() && !FORCE_WINDOWS_LAF && !VUE.isApplet();

    isMacAquaBrushedMetal = isMacAqua && !VUE.isApplet()
            && VUE.isSystemPropertyTrue("apple.awt.brushMetalLook");

    ToolbarColor = initToolbarColor();

    // Note that it is essential that the theme be set before a single GUI object of
    // any kind is created.  If, for instance, a static member in any class
    // initializes a swing gui object, this will end up having no effect here, and
    // the entire theme will be silently ignored.  This includes the call below to
    // UIManager.setLookAndFeel, or even UIManager.getLookAndFeel, which is also why
    // we need to tell the VueTheme about LAF depended variable sinstead of having
    // it ask for the LAF itself, as it may not have been set yet.  Note that when
    // using the Mac Aqua L&F, we don't need to set the theme for Metal (as it's not
    // being used and would have no effect), but we still need to initialize the
    // theme, as it's still queried througout some of the older code.

    if (false)
        installUIDefaults();

    if (VUE.isApplet() || Util.isUnixPlatform()) {
        try {
            UIManager.put("ClassLoader", LookUtils.class.getClassLoader());
            UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
        } catch (Exception e) {
            Log.error("Couldn't load jlooks look and feel");
        }

    } else if (Util.isMacPlatform() && !VUE.isApplet()) {

        if (!SKIP_CUSTOM_LAF) {

            try {
                // FileChooser:
                Set includes = new HashSet();
                includes.add("ColorChooser");
                includes.add("FileChooser");
                includes.add("Component");
                includes.add("Browser");
                includes.add("Tree");
                includes.add("SplitPane");

                // includes.add("Button");
                // includes.add("CheckBox");
                // includes.add("DesktopPane");
                // includes.add("EditorPane");
                // includes.add("FormattedTextField");
                // includes.add("Label");
                // includes.add("MenuBar");
                // includes.add("OptionPane");
                // includes.add("Panel");
                // includes.add("RadioButton");   

                ch.randelshofer.quaqua.QuaquaManager.setIncludedUIs(includes);
                //System.setProperty("Quaqua.design", "panther");
                UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");

                //UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel());
                //System.setProperty("Quaqua.design", "panther");
            } catch (Throwable t) {
                Log.error("Couldn't load quaqua look and feel", t);
            }
        }

    } else {

        // We're leaving the default look and feel alone (e.g. Windows)

        // if on Windows and forcing windows look, these meants try the native win L&F
        //if (FORCE_WINDOWS_LAF && Util.isWindowsPlatform())
        if (Util.isWindowsPlatform() && !SKIP_WIN_NATIVE_LAF)
            setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        else if (Util.isMacPlatform() && VUE.isApplet()) {
            /////Load up some JLooks stuff here.
        } else {
            if (!SKIP_CUSTOM_LAF)
                installMetalTheme();
        }
    }

    UIManager.put("FileChooser.filesOfTypeLabelText", "Format:");

    if (!VUE.isApplet())
        javax.swing.JPopupMenu.setDefaultLightWeightPopupEnabled(false);

    if (Util.getJavaVersion() < 1.5f)
        UseAlwaysOnTop = false;

    String fontName;
    int fontSize;
    int fontSize2;
    if (isMacAqua) {
        fontName = "Lucida Grande";
        fontSize = 11;
        fontSize2 = fontSize + 2;
    } else {
        fontName = "SansSerif";
        fontSize = 11;
        fontSize2 = 11;
    }

    final String fixedFont = "Lucida Sans Typewriter";
    //final String fixedFont = "Courier New";
    //final String fixedFont = "Courier";

    // Verdana is not fully a fixed font, but it's still much easier to read
    // than any of the truly fixed fonts, and it's not nearly as scary
    // for users to look at.
    final String errorFont = "Verdana";

    LabelFace = new GUI.Face(fontName, Font.PLAIN, fontSize, GUI.LabelColor);
    ValueFace = new GUI.Face(fontName, Font.PLAIN, fontSize, Color.black);
    TitleFace = new GUI.Face(fontName, Font.BOLD, fontSize, GUI.LabelColor);
    FixedFace = new GUI.Face(fixedFont, Font.PLAIN, fontSize, GUI.LabelColor);

    LabelFaceItalic = new GUI.Face(fontName, Font.ITALIC, fontSize, GUI.LabelColor);

    //StatusFace = new GUI.Face(null, 0, 0, Color.darkGray, SystemColor.control);
    //StatusFace = new GUI.Face(null, 0, 0, Color.darkGray);
    StatusFace = new GUI.Face(fontName, Font.PLAIN, fontSize2, Color.darkGray);
    StatusFaceSmall = new GUI.Face(fontName, Font.PLAIN, fontSize, Color.darkGray);
    //StatusFace = new GUI.Face(fontName, Font.PLAIN, fontSize2, Color.darkGray, SystemColor.control);

    ErrorFace = StatusFace;
    //ErrorFace = new GUI.Face(errorFont, Font.PLAIN, fontSize+1, Color.darkGray, SystemColor.control);

    DataFace = new GUI.Face("Verdana", Font.PLAIN, fontSize, null);

    // Verdana & Trebuchet are designed for the screen sans-serif font 
    // Georgia a designed for the screen serif font

    // Both are especially sensitive to handling bolding, small sizes, and character
    // differentiation Studies have not found any actual difference in reading
    // speed, though there may be reduced eye strain.

    // And of course Arial (Microsoft's virtual Helevetica) is a bit more
    // compressed, and reliable in at least that everyone's read it
    // countless times.

    ContentFace = new GUI.Face("Arial", Font.PLAIN, 14, null); // shows underscores below underline
    //ContentFace = new GUI.Face("Verdana", Font.PLAIN, 13, null); // underline hides underscores

    //Focus manager seems to be causing a lot of problems on windows 7 and 8 we've received numerous reports about windows not being 
    //clickable which I've tracked back to having Focus manager enabled going to try without it and see if there are any major 
    //issues arise on win8
    if (!Util.isWindowsPlatform() && !Util.isUnixPlatform())
        FocusManager.install();

    //tufts.Util.executeIfFound("tufts.vue.gui.WindowManager", "install", null);

    org.apache.log4j.Level level = org.apache.log4j.Level.DEBUG;

    // if (!skipCustomLAF) level = org.apache.log4j.Level.DEBUG; // always show for the moment

    Log.log(level, "LAF  name: " + UIManager.getLookAndFeel().getName());
    Log.log(level, "LAF descr: " + UIManager.getLookAndFeel().getDescription());
    Log.log(level, "LAF class: " + UIManager.getLookAndFeel().getClass());

    initUnderway = false;
}