List of usage examples for javax.swing.plaf.metal OceanTheme OceanTheme
public OceanTheme()
OceanTheme
From source file:lookandfeel.LookAndFeelDemo.java
private static void initLookAndFeel() { String lookAndFeel = null;//from w ww. j a v a2s . co m if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); // an alternative way to set the Metal L&F is to replace the // previous line with: // lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel"; } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); // If L&F = "Metal", set the theme if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); else MetalLookAndFeel.setCurrentTheme(new TestTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } }
From source file:LookAndFeelDemo.java
private static void initLookAndFeel() { String lookAndFeel = null;/*from www. ja v a 2s.c o m*/ if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); // an alternative way to set the Metal L&F is to replace the // previous line with: // lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel"; } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); // If L&F = "Metal", set the theme if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); else MetalLookAndFeel.setCurrentTheme(new TestTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } }
From source file:llc.rockford.webcast.EC2Driver.java
private void initLookAndFeel() { String lookAndFeel = null;/*from www. j a v a 2 s .c o m*/ if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); // If L&F = "Metal", set the theme if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } }
From source file:lcmc.LCMC.java
/** Inits the application. */ protected static String initApp(final String[] args) { try {/*w w w . ja va2 s .c om*/ /* Metal */ UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); MetalLookAndFeel.setCurrentTheme(new OceanTheme() { /** e.g. arrows on split pane... */ protected ColorUIResource getPrimary1() { return new ColorUIResource(ClusterBrowser.STATUS_BACKGROUND); } /** unknown to me */ protected ColorUIResource getPrimary2() { return new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND); } /** unknown to me */ protected ColorUIResource getPrimary3() { return new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND); } /** Button and other borders. */ protected ColorUIResource getSecondary1() { return new ColorUIResource(AppDefaults.BACKGROUND_DARK); } protected ColorUIResource getSecondary2() { return new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND); } /** Split pane divider. Line in the main menu. */ protected ColorUIResource getSecondary3() { return new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND); } }); } catch (final Exception e) { /* ignore it then */ } Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { public void uncaughtException(final Thread t, final Throwable ex) { Tools.appError("uncaught exception", ex.toString(), (Exception) ex); } }); float fps = 20.0f; final Options options = new Options(); options.addOption("h", HELP_OP, false, "print this help"); options.addOption(null, KEEP_HELPER_OP, false, "do not overwrite the lcmc-gui-helper program"); options.addOption(null, RO_OP, false, "read only mode"); options.addOption(null, OP_OP, false, "operator mode"); options.addOption(null, ADMIN_OP, false, "administrator mode"); options.addOption(null, OP_MODE_OP, true, "operating mode. <arg> can be:\n" + "ro - read only\n" + "op - operator\n" + "admin - administrator"); options.addOption(null, NOLRM_OP, false, "do not show removed resources from LRM."); options.addOption(null, "auto", true, "for testing"); options.addOption("v", VERSION_OP, false, "print version"); options.addOption(null, AUTO_OP, true, "for testing"); options.addOption(null, NO_UPGRADE_CHECK_OP, false, "disable upgrade check"); options.addOption(null, NO_PLUGIN_CHECK_OP, false, "disable plugin check, DEPRECATED: there are no plugins"); options.addOption(null, TIGHTVNC_OP, false, "enable tight vnc viewer"); options.addOption(null, ULTRAVNC_OP, false, "enable ultra vnc viewer"); options.addOption(null, REALVNC_OP, false, "enable real vnc viewer"); options.addOption(null, BIGDRBDCONF_OP, false, "create one big drbd.conf, instead of many" + " files in drbd.d/ directory"); options.addOption(null, STAGING_DRBD_OP, false, "enable more DRBD installation options"); options.addOption(null, STAGING_PACEMAKER_OP, false, "enable more Pacemaker installation options"); options.addOption(null, VNC_PORT_OFFSET_OP, true, "offset for port forwarding"); options.addOption(null, SLOW_OP, false, "specify this if you have slow computer"); options.addOption(null, RESTORE_MOUSE_OP, false, "for testing"); options.addOption(null, SCALE_OP, true, "scale fonts and sizes of elements in percent (100)"); options.addOption(null, ID_DSA_OP, true, "location of id_dsa file ($HOME/.ssh/id_dsa)"); options.addOption(null, ID_RSA_OP, true, "location of id_rsa file ($HOME/.ssh/id_rsa)"); options.addOption(null, KNOWN_HOSTS_OP, true, "location of known_hosts file ($HOME/.ssh/known_hosts)"); options.addOption(null, OUT_OP, true, "where to redirect the standard out"); options.addOption(null, DEBUG_OP, true, "debug level, 0 - none, 3 - all"); options.addOption("c", CLUSTER_OP, true, "define a cluster"); final Option hostOp = new Option("h", HOST_OP, true, "define a cluster, used with --cluster option"); hostOp.setArgs(10000); options.addOption(hostOp); options.addOption(null, SUDO_OP, false, "whether to use sudo, used with --cluster option"); options.addOption(null, USER_OP, true, "user to use with sudo, used with --cluster option"); options.addOption(null, PORT_OP, true, "ssh port, used with --cluster option"); options.addOption(null, ADVANCED_OP, false, "start in an advanced mode"); options.addOption(null, ONE_HOST_CLUSTER_OP, false, "allow one host cluster"); final CommandLineParser parser = new PosixParser(); String autoArgs = null; try { final CommandLine cmd = parser.parse(options, args); if (cmd.hasOption(OUT_OP)) { final String out = cmd.getOptionValue(OUT_OP); if (out != null) { try { System.setOut(new PrintStream(new FileOutputStream(out))); } catch (final FileNotFoundException e) { System.exit(2); } } } if (cmd.hasOption(DEBUG_OP)) { final String level = cmd.getOptionValue(DEBUG_OP); if (level != null && Tools.isNumber(level)) { Tools.setDebugLevel(Integer.parseInt(level)); } else { throw new ParseException("cannot parse debug level: " + level); } } boolean tightvnc = cmd.hasOption(TIGHTVNC_OP); boolean ultravnc = cmd.hasOption(ULTRAVNC_OP); final boolean realvnc = cmd.hasOption(REALVNC_OP); if (!tightvnc && !ultravnc && !realvnc) { if (Tools.isLinux()) { tightvnc = true; } else if (Tools.isWindows()) { ultravnc = true; } else { tightvnc = true; ultravnc = true; } } boolean advanced = cmd.hasOption(ADVANCED_OP); Tools.getConfigData().setAdvancedMode(advanced); Tools.getConfigData().setTightvnc(tightvnc); Tools.getConfigData().setUltravnc(ultravnc); Tools.getConfigData().setRealvnc(realvnc); Tools.getConfigData().setUpgradeCheckEnabled(!cmd.hasOption(NO_UPGRADE_CHECK_OP)); Tools.getConfigData().setBigDRBDConf(cmd.hasOption(BIGDRBDCONF_OP)); Tools.getConfigData().setStagingDrbd(cmd.hasOption(STAGING_DRBD_OP)); Tools.getConfigData().setStagingPacemaker(cmd.hasOption(STAGING_PACEMAKER_OP)); Tools.getConfigData().setNoLRM(cmd.hasOption(NOLRM_OP)); Tools.getConfigData().setKeepHelper(cmd.hasOption(KEEP_HELPER_OP)); Tools.getConfigData().setOneHostCluster(cmd.hasOption(ONE_HOST_CLUSTER_OP)); final String pwd = System.getProperty("user.home"); final String scaleOp = cmd.getOptionValue(SCALE_OP, "100"); try { final int scale = Integer.parseInt(scaleOp); Tools.getConfigData().setScale(scale); Tools.resizeFonts(scale); } catch (java.lang.NumberFormatException e) { Tools.appWarning("cannot parse scale: " + scaleOp); } final String idDsaPath = cmd.getOptionValue(ID_DSA_OP, pwd + "/.ssh/id_dsa"); final String idRsaPath = cmd.getOptionValue(ID_RSA_OP, pwd + "/.ssh/id_rsa"); final String knownHostsPath = cmd.getOptionValue(KNOWN_HOSTS_OP, pwd + "/.ssh/known_hosts"); Tools.getConfigData().setIdDSAPath(idDsaPath); Tools.getConfigData().setIdRSAPath(idRsaPath); Tools.getConfigData().setKnownHostPath(knownHostsPath); final String opMode = cmd.getOptionValue(OP_MODE_OP); autoArgs = cmd.getOptionValue(AUTO_OP); if (cmd.hasOption(HELP_OP)) { final HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("java -jar LCMC.jar [OPTIONS]", options); System.exit(0); } if (cmd.hasOption(VERSION_OP)) { System.out.println("LINUX CLUSTER MANAGEMENT CONSOLE " + Tools.getRelease() + " by Rasto Levrinc"); System.exit(0); } if (cmd.hasOption("ro") || "ro".equals(opMode)) { Tools.getConfigData().setAccessType(ConfigData.AccessType.RO); Tools.getConfigData().setMaxAccessType(ConfigData.AccessType.RO); } else if (cmd.hasOption("op") || "op".equals(opMode)) { Tools.getConfigData().setAccessType(ConfigData.AccessType.OP); Tools.getConfigData().setMaxAccessType(ConfigData.AccessType.OP); } else if (cmd.hasOption("admin") || "admin".equals(opMode)) { Tools.getConfigData().setAccessType(ConfigData.AccessType.ADMIN); Tools.getConfigData().setMaxAccessType(ConfigData.AccessType.ADMIN); } else if (opMode != null) { Tools.appWarning("unknown operating mode: " + opMode); } if (cmd.hasOption(SLOW_OP)) { fps = fps / 2; } if (cmd.hasOption(RESTORE_MOUSE_OP)) { /* restore mouse if it is stuck in pressed state, during * robot tests. */ RoboTest.restoreMouse(); } final String vncPortOffsetString = cmd.getOptionValue(VNC_PORT_OFFSET_OP); if (vncPortOffsetString != null && Tools.isNumber(vncPortOffsetString)) { Tools.getConfigData().setVncPortOffset(Integer.parseInt(vncPortOffsetString)); } Tools.getConfigData().setAnimFPS(fps); if (cmd.hasOption(CLUSTER_OP) || cmd.hasOption(HOST_OP)) { parseClusterOptions(cmd); } } catch (ParseException exp) { System.out.println("ERROR: " + exp.getMessage()); System.exit(1); } Tools.debug(null, "max mem: " + Runtime.getRuntime().maxMemory() / 1024 / 1024 + "m", 1); return autoArgs; }
From source file:com.commander4j.util.JUtility.java
public static void SetLookAndFeel(String LOOKANDFEEL, String THEME) { try {/*from w w w .j av a 2s .c o m*/ if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.trianacode.gui.hci.ApplicationFrame.java
/** * Initialise the application// ww w . j av a 2s. c om */ public static ApplicationFrame initTriana(String args[]) { // todo: this is crap, use andrew's UI stuff // Andrew Sept 2010: Done - 6 years on... :-) UIDefaults uiDefaults = UIManager.getDefaults(); Object font = ((FontUIResource) uiDefaults.get("TextArea.font")).deriveFont((float) 11); Enumeration enumeration = uiDefaults.keys(); while (enumeration.hasMoreElements()) { Object key = enumeration.nextElement(); if (key.toString().endsWith("font")) { uiDefaults.put(key, font); } } String myOSName = Locations.os(); if (myOSName.equals("windows")) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } } else { if (!myOSName.equals("osx")) { try { MetalLookAndFeel.setCurrentTheme(new OceanTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch (Exception e) { } } } ApplicationFrame app = new ApplicationFrame("Triana"); app.init(args); return app; }