List of usage examples for javax.swing UIManager setLookAndFeel
@SuppressWarnings("deprecation") public static void setLookAndFeel(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
From source file:cytoscape.CyMain.java
License:asdf
protected void setupLookAndFeel() { try {/*from ww w .j av a 2s . co m*/ if (LookUtils.IS_OS_WINDOWS) { /* * For Windows: just use platform default look & feel. */ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } else if (LookUtils.IS_OS_MAC) { /* * For Mac: move menu bar to OS X default bar (next to Apple * icon) */ System.setProperty("apple.laf.useScreenMenuBar", "true"); } else { final JavaVersion javaVersion = JavaVersion.getJavaVersion(); if (javaVersion.getMajor() >= 2 || javaVersion.getMinor() > 6 || (javaVersion.getMinor() == 6 && javaVersion.getUpdate() >= 10)) UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); else { /* * For Unix platforms, use JGoodies Looks */ UIManager.setLookAndFeel(new Plastic3DLookAndFeel()); Plastic3DLookAndFeel.set3DEnabled(true); Plastic3DLookAndFeel.setCurrentTheme(new com.jgoodies.looks.plastic.theme.SkyBluer()); Plastic3DLookAndFeel.setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE); Plastic3DLookAndFeel.setHighContrastFocusColorsEnabled(true); Options.setDefaultIconSize(new Dimension(18, 18)); Options.setHiResGrayFilterEnabled(true); Options.setPopupDropShadowEnabled(true); Options.setUseSystemFonts(true); UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE); UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE); } } } catch (Exception e) { logger.warn("Can't set look & feel:" + e.getMessage(), e); } }
From source file:lcmc.LCMC.java
/** Inits the application. */ protected static String initApp(final String[] args) { try {/*from w w w . j a va2 s.c o m*/ /* 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:QueryConnector.java
public static void silentUpdateAll(XComponentContext componentContext, XModel model) { QueryConnector connector = null;//from w w w .j a v a 2 s. co m try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); connector = new QueryConnector(model, componentContext); connector.setSilent(true); connector.updateAll(); } catch (Exception ex) { if (connector != null) connector.enableEdit(); ExceptionDialog.show(null, ex); } }
From source file:net.sf.profiler4j.console.Console.java
public static void main(String[] args) { System.out.println();//from ww w . j a va 2 s . c o m System.out.println("+--------------------------------------------------------+"); System.out.println("| Profiler4j-Fork Console " + String.format("%-31s", AgentConstants.VERSION) + "|"); System.out.println("| Copyright 2006 Antonio S. R. Gomes |"); System.out.println("| Copyright 2009 Murat Knecht |"); System.out.println("| See LICENSE-2.0.txt for details |"); System.out.println("+--------------------------------------------------------+"); Prefs prefs = new Prefs(); System.setProperty("swing.aatext", String.valueOf(prefs.isAntialiasing())); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { // ignore } final Console app = new Console(prefs); SwingUtilities.invokeLater(new Runnable() { public void run() { MainFrame f = new MainFrame(app); app.setMainFrame(f); f.pack(); f.setVisible(true); } }); }
From source file:com.igormaznitsa.sciareto.ui.MainFrame.java
public MainFrame(@Nonnull @MustNotContainNull final String... args) { super();// w w w. j a v a 2s . c o m initComponents(); this.stackPanel = new JPanel(); this.stackPanel.setFocusable(false); this.stackPanel.setOpaque(false); this.stackPanel.setBorder(BorderFactory.createEmptyBorder(32, 32, 16, 32)); this.stackPanel.setLayout(new BoxLayout(this.stackPanel, BoxLayout.Y_AXIS)); final JPanel glassPanel = (JPanel) this.getGlassPane(); glassPanel.setOpaque(false); this.setGlassPane(glassPanel); glassPanel.setLayout(new BorderLayout(8, 8)); glassPanel.add(Box.createGlue(), BorderLayout.CENTER); final JPanel ppanel = new JPanel(new BorderLayout(0, 0)); ppanel.setFocusable(false); ppanel.setOpaque(false); ppanel.setCursor(null); ppanel.add(this.stackPanel, BorderLayout.SOUTH); glassPanel.add(ppanel, BorderLayout.EAST); this.stackPanel.add(Box.createGlue()); glassPanel.setVisible(false); this.setTitle("Scia Reto"); setIconImage(UiUtils.loadImage("logo256x256.png")); this.stateless = args.length > 0; final MainFrame theInstance = this; this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(@Nonnull final WindowEvent e) { if (doClosing()) { dispose(); } } }); this.tabPane = new EditorTabPane(this); this.explorerTree = new ExplorerTree(this); final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(250); splitPane.setResizeWeight(0.0d); splitPane.setLeftComponent(this.explorerTree); splitPane.setRightComponent(this.tabPane); add(splitPane, BorderLayout.CENTER); this.menuOpenRecentProject.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { final File[] lastOpenedProjects = FileHistoryManager.getInstance().getLastOpenedProjects(); if (lastOpenedProjects.length > 0) { for (final File folder : lastOpenedProjects) { final JMenuItem item = new JMenuItem(folder.getName()); item.setToolTipText(folder.getAbsolutePath()); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openProject(folder, false); } }); menuOpenRecentProject.add(item); } } } @Override public void menuDeselected(MenuEvent e) { menuOpenRecentProject.removeAll(); } @Override public void menuCanceled(MenuEvent e) { } }); this.menuOpenRecentFile.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { final File[] lastOpenedFiles = FileHistoryManager.getInstance().getLastOpenedFiles(); if (lastOpenedFiles.length > 0) { for (final File file : lastOpenedFiles) { final JMenuItem item = new JMenuItem(file.getName()); item.setToolTipText(file.getAbsolutePath()); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openFileAsTab(file); } }); menuOpenRecentFile.add(item); } } } @Override public void menuDeselected(MenuEvent e) { menuOpenRecentFile.removeAll(); } @Override public void menuCanceled(MenuEvent e) { } }); if (!this.stateless) { restoreState(); } else { boolean openedProject = false; for (final String filePath : args) { final File file = new File(filePath); if (file.isDirectory()) { openedProject = true; openProject(file, true); } else if (file.isFile()) { openFileAsTab(file); } } if (!openedProject) { //TODO try to hide project panel! } } final LookAndFeel current = UIManager.getLookAndFeel(); final ButtonGroup lfGroup = new ButtonGroup(); final String currentLFClassName = current.getClass().getName(); for (final UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { final JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(info.getName()); lfGroup.add(menuItem); if (currentLFClassName.equals(info.getClassName())) { menuItem.setSelected(true); } menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(@Nonnull final ActionEvent e) { try { UIManager.setLookAndFeel(info.getClassName()); SwingUtilities.updateComponentTreeUI(theInstance); PreferencesManager.getInstance().getPreferences().put(Main.PROPERTY_LOOKANDFEEL, info.getClassName()); PreferencesManager.getInstance().flush(); } catch (Exception ex) { LOGGER.error("Can't change LF", ex); } } }); this.menuLookAndFeel.add(menuItem); } }
From source file:com.moteiv.trawler.Trawler.java
public Trawler(String[] args) { init(args);/*from w w w . j a v a2 s.c o m*/ // Install a different look and feel; specifically, the Windows look and feel try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //"com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (InstantiationException e) { } catch (ClassNotFoundException e) { } catch (UnsupportedLookAndFeelException e) { } catch (IllegalAccessException e) { } jf = new JFrame("Trawler"); jf.setJMenuBar(getMainMenuBar()); g = new SparseGraph(); layout = new FRLayout(g); indexer = Indexer.newIndexer(g, 0); // layout.initialize(new Dimension(100, 100)); mif = new MoteInterface(g, Trawler.GROUPID, layout); uartDetect = new UartDetect(mif.getMoteIF()); Thread th = new Thread(uartDetect); th.start(); pr = new myPluggableRenderer(); vv = new VisualizationViewer(layout, pr); vv.init(); vv.setPickSupport(new ShapePickSupport()); vv.setBackground(Color.white); vv.setToolTipListener(new NodeTips(vv)); myVertexShapeFunction vsf = new myVertexShapeFunction(uartDetect); pr.setVertexShapeFunction(vsf); pr.setVertexIconFunction(vsf);//new myVertexShapeFunction()); m_vs = new VertexLabel(); java.awt.Font f = new java.awt.Font("Arial", Font.PLAIN, 12); pr.setEdgeFontFunction(new ConstantEdgeFontFunction(f)); pr.setVertexStringer(m_vs); m_es = new myEdgeLabel(); pr.setEdgeStringer(m_es); ((AbstractEdgeShapeFunction) pr.getEdgeShapeFunction()).setControlOffsetIncrement(-50.f); // pr.setVertexColorFunction(new myVertexColorFunction(Color.RED.darker().darker(), Color.RED, 500l)); pr.setEdgeStrokeFunction(new EdgeWeightStrokeFunction()); pr.setEdgeLabelClosenessFunction(new ConstantDirectionalEdgeValue(0.5, 0.5)); pr.setEdgePaintFunction(new myEdgeColorFunction()); scrollPane = new GraphZoomScrollPane(vv); jf.getContentPane().setLayout(new BoxLayout(jf.getContentPane(), BoxLayout.LINE_AXIS)); JTabbedPane pane = new JTabbedPane(); pane.addTab("Network Topology", scrollPane); pane.addTab("Sensor readings", createOscopePanel(mif.getMoteIF(), "ADC Readings", -33, -456, 300, 4100, "Time (seconds)", "ADC counts")); pane.addTab("Link Quality", createOscopePanel(mif.getMoteIF(), "LinkQualityPanel", -33, -15, 300, 135, "Time (seconds)", "Link Quality Indicator")); ImageIcon trawlerIcon = new ImageIcon(Trawler.class.getResource("images/trawler-icon.gif")); Image imageTrawler = trawlerIcon.getImage(); jf.getContentPane().add(pane); controlBoxFrame = new JFrame("Vizualization Control"); controlBoxFrame.getContentPane().add(getControls()); controlBoxFrame.setIconImage(imageTrawler); controlBoxFrame.pack(); // jf.getContentPane().add(getControls()); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); layout.initialize(vv.getSize()); layout.resize(vv.getSize()); layout.update(); loadPrefs(); GraphIO.loadGraph(g, layout, mif, Trawler.NODEFILE); // need this mouse model to keep the mouse clicks // aligned with the nodes DefaultModalGraphMouse gm = new DefaultModalGraphMouse(); gm.setMode(ModalGraphMouse.Mode.PICKING); vv.setGraphMouse(gm); jf.setIconImage(imageTrawler); jf.pack(); jf.show(); controlBoxFrame.setVisible(true); timer = new Timer(); timer.schedule(new UpdateTask(), 500, 500); }
From source file:gov.nih.nci.nbia.StandaloneDMV3.java
private void constructDownloadManager(List<String> seriesInfo, String userId, String password) { try {/* w w w. ja v a2 s.c o m*/ String[] strResult = new String[seriesInfo.size()]; seriesInfo.toArray(strResult); List<SeriesData> seriesData = JnlpArgumentsParser.parse(strResult); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { ex.printStackTrace(); } DownloadManagerFrame manager = new DownloadManagerFrame(true, userId, password, includeAnnotation, seriesData, serverUrl, noOfRetry); manager.setTitle(winTitle); String os = System.getProperty("os.name").toLowerCase(); if (os.startsWith("mac")) { //manager.setDefaultDownloadDir("Please select a directory for downloading images."); } else manager.setDefaultDownloadDir(System.getProperty("user.home") + File.separator + "Desktop"); manager.setVisible(true); if (frame != null) frame.setVisible(false); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:EditorPaneExample18.java
public static void main(String[] args) { try {/*ww w.j a v a 2 s . c om*/ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) { } JFrame f = new EditorPaneExample18(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); f.setSize(500, 400); f.setVisible(true); }
From source file:edu.ku.brc.specify.utilapps.DataModelClassGenerator.java
/** * @param args//from w w w.jav a 2 s . c o m */ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @SuppressWarnings("synthetic-access") public void run() { try { UIHelper.OSTYPE osType = UIHelper.getOSType(); if (osType == UIHelper.OSTYPE.Windows) { //UIManager.setLookAndFeel(new WindowsLookAndFeel()); UIManager.setLookAndFeel(new PlasticLookAndFeel()); PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue()); } else if (osType == UIHelper.OSTYPE.Linux) { //UIManager.setLookAndFeel(new GTKLookAndFeel()); UIManager.setLookAndFeel(new PlasticLookAndFeel()); //PlasticLookAndFeel.setPlasticTheme(new SkyKrupp()); //PlasticLookAndFeel.setPlasticTheme(new DesertBlue()); //PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue()); //PlasticLookAndFeel.setPlasticTheme(new DesertGreen()); } } catch (Exception e) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(DataModelClassGenerator.class, e); //log.error("Can't change L&F: ", e); } DataModelClassGenerator dmcg = new DataModelClassGenerator(Appraisal.class); UIHelper.centerAndShow(dmcg); } }); }
From source file:net.sf.dsig.DSApplet.java
private void initSwing() { try {/*from w w w .ja v a 2s . c o m*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { logger.warn("UIManager.setLookAndFeel() failed", e); } JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS)); panel.setBackground(Color.decode(backgroundColor)); add(panel); boolean lockPrinted = false; if (formId != null) { Icon lockIcon = new ImageIcon(getClass().getResource("/icons/lock.png")); lockPrinted = true; JButton button = new JButton("Sign", lockIcon); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { available.acquireUninterruptibly(); try { signInternal(formId, null); } catch (Exception ex) { logger.error("Internal sign failed", e); } finally { available.release(); } } }); panel.add(button); } Icon infoIcon = new ImageIcon(getClass().getResource(lockPrinted ? "/icons/info.png" : "/icons/lock.png")); JLabel infoLabel = new JLabel(infoIcon); infoLabel.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { JOptionPane.showMessageDialog(null, printInfoMessage()); } public void mouseEntered(MouseEvent e) { /* NOOP */ } public void mouseExited(MouseEvent e) { /* NOOP */ } public void mousePressed(MouseEvent e) { /* NOOP */ } public void mouseReleased(MouseEvent e) { /* NOOP */ } }); panel.add(infoLabel); }