public static void main(String[] args) { if (args.length == 0) usageError(); if (args[0].equals("cross")) { try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } } else if (args[0].equals("system")) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } } else if (args[0].equals("motif")) { try { UIManager.setLookAndFeel("com.sun.java." + "swing.plaf.motif.MotifLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } } else usageError(); // Note the look & feel must be set before // any components are created. run(new LookAndFeel(), 300, 300); }
/** Sets look and feel. */ private void setLookAndFeel() { try { // Sets system look UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // Force Numbus (for Said happiness ) for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } // Force fullScreen Toolkit tk = Toolkit.getDefaultToolkit(); int xSize = ((int) tk.getScreenSize().getWidth()); int ySize = ((int) tk.getScreenSize().getHeight() - 40); this.setSize(xSize, ySize); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { showErrorMessage(ex); } }
public static int getNimbusFontSize() { Preferences p = Preferences.userNodeForPackage(ThemeManager.class); int preferredSize = p.getInt(NIMBUS_FONT_SIZE, 0); // if the returned value is zero, determine the default base font size // and save it if (preferredSize == 0) { LookAndFeel old = UIManager.getLookAndFeel(); try { UIManager.setLookAndFeel(new NimbusLookAndFeel()); preferredSize = NimbusUtils.getBaseFontSize(); p.putInt(NIMBUS_FONT_SIZE, preferredSize); UIManager.setLookAndFeel(old); } catch (Exception e) { Logger.getLogger(ThemeManager.class.getName()).log(Level.SEVERE, e.toString(), e); } } return preferredSize; }
private static void setLookAndFeel(final String lookAndFeel) { Preferences pref = Preferences.userNodeForPackage(ThemeManager.class); String theme = pref.get(THEME, DEFAULT_THEME); try { Class<?> lafClass = Class.forName(lookAndFeel); Object lafInstance = lafClass.newInstance(); if (lafInstance instanceof SubstanceSkin) { UIManager.put(SubstanceLookAndFeel.SHOW_EXTRA_WIDGETS, Boolean.TRUE); if (isSubstanceAnimationsEnabled()) { AnimationConfigurationManager.getInstance().setTimelineDuration(animationDuration); } else { AnimationConfigurationManager.getInstance().setTimelineDuration(0); } SubstanceLookAndFeel.setSkin(lookAndFeel); } else if (lafInstance instanceof NimbusLookAndFeel) { UIManager.setLookAndFeel((LookAndFeel) lafInstance); NimbusUtils.changeFontSize(getNimbusFontSize()); } else if (lafInstance instanceof MetalLookAndFeel) { UIManager.setLookAndFeel((LookAndFeel) lafInstance); setTheme(theme); } else if (lafInstance instanceof LookAndFeel) { UIManager.setLookAndFeel((LookAndFeel) lafInstance); } } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { Logger.getLogger(ThemeManager.class.getName()).log(Level.WARNING, null, e); } }
/** Installs the JGoodies Look & Feels, if available, in classpath. */ public final void initializeLookAndFeels() { // if in classpath thry to load JGoodies Plastic Look & Feel try { LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels(); boolean found = false; for (int i = 0; i < lnfs.length; i++) { if (lnfs[i].getName().equals("JGoodies Plastic 3D")) { found = true; } } if (!found) { UIManager.installLookAndFeel( "JGoodies Plastic 3D", "com.jgoodies.looks.plastic.Plastic3DLookAndFeel"); } String os = System.getProperty("os.name"); FontSet fontSet = null; if (os.startsWith("Windows")) { fontSet = FontSets.createDefaultFontSet(new Font("arial unicode MS", Font.PLAIN, 12)); } else { fontSet = FontSets.createDefaultFontSet(new Font("arial unicode", Font.PLAIN, 12)); } FontPolicy fixedPolicy = FontPolicies.createFixedPolicy(fontSet); PlasticLookAndFeel.setFontPolicy(fixedPolicy); UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel"); } catch (Throwable t) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } } }
private static void setLookAndFeel(String os) { if (os == null) { os = System.getProperty("os.name"); } os = os.trim().toLowerCase(); try { if (os.contains("windows")) { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } else if (os.contains("mac")) { UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel"); } else if (os.contains("javametal")) { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } else if (os.contains("weblookandfeel")) { WebLookAndFeel.install(); } else { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (InstantiationException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IllegalAccessException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (UnsupportedLookAndFeelException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }
/** Sets current LAF. The method doesn't update component hierarchy. */ @Override public void setCurrentLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo) { if (findLaf(lookAndFeelInfo.getClassName()) == null) { LOG.error("unknown LookAndFeel : " + lookAndFeelInfo); return; } // Set L&F if (IdeaLookAndFeelInfo.CLASS_NAME.equals( lookAndFeelInfo.getClassName())) { // that is IDEA default LAF IdeaLaf laf = new IdeaLaf(); MetalLookAndFeel.setCurrentTheme(new IdeaBlueMetalTheme()); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { Messages.showMessageDialog( IdeBundle.message( "error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; } } else if (DarculaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) { DarculaLaf laf = new DarculaLaf(); try { UIManager.setLookAndFeel(laf); JBColor.setDark(true); IconLoader.setUseDarkIcons(true); } catch (Exception e) { Messages.showMessageDialog( IdeBundle.message( "error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; } } else { // non default LAF try { LookAndFeel laf = ((LookAndFeel) Class.forName(lookAndFeelInfo.getClassName()).newInstance()); if (laf instanceof MetalLookAndFeel) { MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); } UIManager.setLookAndFeel(laf); } catch (Exception e) { Messages.showMessageDialog( IdeBundle.message( "error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; } } myCurrentLaf = ObjectUtils.chooseNotNull(findLaf(lookAndFeelInfo.getClassName()), lookAndFeelInfo); checkLookAndFeel(lookAndFeelInfo, false); }
public static void main(String[] args) { try { UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); UIManager.setLookAndFeel("com.jtattoo.plaf.mcwin.McWinLookAndFeel"); } catch (Exception a) { } new UserGUI(); }
public void setLookAndFeel() throws UnsupportedLookAndFeelException, ClassNotFoundException, InstantiationException, IllegalAccessException { if (mName != null) //noinspection StringConcatenation System.out.println( "Theme = " + mName); // ((MetalLookAndFeel)mLF).getCurrentTheme()); // NON-NLS if (mName == null) UIManager.setLookAndFeel(makeLF()); else UIManager.setLookAndFeel(mName); }
private void initLookAndFeelAplicacion(String loolAndFeelStr) { if (lookAndFeel != null) { if (loolAndFeelStr.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 (loolAndFeelStr.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (loolAndFeelStr.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (loolAndFeelStr.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else if (loolAndFeelStr.equals("Nimbus")) { lookAndFeel = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"; } else { System.err.println("Valor inesperado para LOOKANDFEEL especificado: " + 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(); } } }
/** * ������ѡ���� * * @param cp ����Ҫ�ı�Ŀؼ� * @param style ���ܽ����±� * @return ���سɹ�������� */ public static boolean setUI(Component cp, int style) { try { switch (style) { case 0: UIManager.setLookAndFeel("com.sun.java.swing.plaf." + "windows.WindowsLookAndFeel"); break; case 1: UIManager.setLookAndFeel("javax.swing.plaf." + "metal.MetalLookAndFeel"); break; case 2: UIManager.setLookAndFeel("com.sun.java.swing.plaf." + "motif.MotifLookAndFeel"); break; case 3: UIManager.setLookAndFeel( "com.sun.java.swing.plaf." + "windows.WindowsClassicLookAndFeel"); break; case 4: UIManager.setLookAndFeel("com.incors.plaf." + "alloy.AlloyLookAndFeel"); break; case 5: UIManager.setLookAndFeel("soft.wes.feels." + "GlassThemeAlloyLookAndFeel"); break; case 6: UIManager.setLookAndFeel("soft.wes.feels." + "AcidThemeAlloyLookAndFeel"); break; case 7: UIManager.setLookAndFeel("soft.wes.feels." + "BedouinThemeAlloyLookAndFeel"); break; case 8: UIManager.setLookAndFeel("soft.wes.feels." + "DefaultThemeAlloyLookAndFeel"); break; case 9: UIManager.put("swing.boldMetal", Boolean.FALSE); // �����öԻ������ JDialog.setDefaultLookAndFeelDecorated(true); // ���������ô������ JFrame.setDefaultLookAndFeelDecorated(true); Toolkit.getDefaultToolkit().setDynamicLayout(true); System.setProperty("sun.awt.noerasebackground", "true"); UIManager.setLookAndFeel(new MetalLookAndFeel()); break; } } catch (Exception ex) { JOptionPane.showMessageDialog(null, "����ʧ��,��ԭ�����ʾ"); return false; } SwingUtilities.updateComponentTreeUI(cp); cp.repaint(); return true; }
/** Installs the Kunststoff and Plastic Look And Feels if available in classpath. */ private static void initializeLookAndFeels() { // if in classpath thry to load JGoodies Plastic Look & Feel try { UIManager.installLookAndFeel( "JGoodies Plastic 3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); } catch (Throwable t) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } } }
protected void initializeLookAndFeel() { try { String osName = System.getProperty("os.name"); if (osName.startsWith("Windows")) { UIManager.setLookAndFeel("com.jgoodies.looks.windows.WindowsLookAndFeel"); } else if (osName.startsWith("Mac")) { // do nothing, use the Mac Aqua L&f } else { UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); } } catch (Exception e) { // Likely the Looks library is not in the class path; ignore. } }
public MainFrame() { super("P2 Auto Update and Automatic Build Test"); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println("Error loading System Look and Feel: " + e.getMessage()); try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception ex) { System.out.println("Error loading CrossPlatform Look and Feel: " + e.getMessage()); } } LabelOne one = new LabelOne(); LabelTwo two = new LabelTwo(); LabelThree three = new LabelThree(); LabelFour four = new LabelFour(); JPanel mainPanel = new JPanel(); GroupLayout layout = new GroupLayout(mainPanel); mainPanel.setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setAutoCreateGaps(true); layout.setHorizontalGroup( layout .createParallelGroup() .addComponent(one) .addComponent(two) .addComponent(three) .addComponent(four)); layout.setVerticalGroup( layout .createSequentialGroup() .addComponent(one) .addComponent(two) .addComponent(three) .addComponent(four)); this.addWindowListener(this); this.add(mainPanel); this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); this.pack(); this.setVisible(true); }
public void initializeLookAndFeels() { // if in classpath try to load JGoodies Plastic Look & Feel try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); System.out.println(UIManager.getLookAndFeel().getName()); } catch (Throwable t) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); System.out.println( "Non ho il nimbus. ClassName:com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } } }
private static void setLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); if (UIManager.getSystemLookAndFeelClassName() != null && UIManager.getSystemLookAndFeelClassName().toLowerCase().indexOf("windows") != -1) { UIManager.put("TextArea.font", UIManager.get("TextField.font")); } } catch (Throwable t) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable tt) { // ignore } } }
/** * On Mac OS X there is no text field for regexes with the default look and feel {@link * JFileChooser}. Therefore on Mac OS X the {@link MacHackedFileChooserPanel} gets the * UIManager.getCrossPlatformLookAndFeelClassName() * * @return */ private MacHackedFileChooserPanel getFileChooserWithLookAndFeel() { MacHackedFileChooserPanel fileChooser = null; if (System.getProperty("os.name").equals("Mac OS X")) { LookAndFeel lookAndFeel = UIManager.getLookAndFeel(); try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); fileChooser = new MacHackedFileChooserPanel(); UIManager.setLookAndFeel(lookAndFeel); } catch (Exception e) { // mac hack } } return (fileChooser != null) ? fileChooser : new MacHackedFileChooserPanel(); }
/** @param args the command line arguments */ public static void main(String args[]) { try { /* Set the Nimbus look and feel */ // <editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(F2T2C1.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(F2T2C1.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(F2T2C1.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(F2T2C1.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } // </editor-fold> UIManager.setLookAndFeel("com.jtattoo.plaf.hifi.HiFiLookAndFeel"); /* Create and display the form */ java.awt.EventQueue.invokeLater( new Runnable() { public void run() { new F2T2C1().setVisible(true); } }); } catch (ClassNotFoundException ex) { Logger.getLogger(F2T2C1.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(F2T2C1.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(F2T2C1.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(F2T2C1.class.getName()).log(Level.SEVERE, null, ex); } }
public static void main(final String[] args) { List<String> names = new ArrayList<String>(); names.add("Michael"); names.add("Stephen"); names.add("Josh"); names.add("Will"); ModelFacade.createInstance(new Model(false, false, false, false, names)); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } SwingUtilities.invokeLater( new Runnable() { public void run() { new Catan(); PlayerWaitingView playerWaitingView = new PlayerWaitingView(); final PlayerWaitingController playerWaitingController = new PlayerWaitingController(playerWaitingView); playerWaitingView.setController(playerWaitingController); JoinGameView joinView = new JoinGameView(); NewGameView newGameView = new NewGameView(); SelectColorView selectColorView = new SelectColorView(); MessageView joinMessageView = new MessageView(); final JoinGameController joinController = new JoinGameController(joinView, newGameView, selectColorView, joinMessageView); joinController.setJoinAction( new IAction() { @Override public void execute() { playerWaitingController.start(); } }); joinView.setController(joinController); newGameView.setController(joinController); selectColorView.setController(joinController); joinMessageView.setController(joinController); LoginView loginView = new LoginView(); MessageView loginMessageView = new MessageView(); LoginController loginController = new LoginController(loginView, loginMessageView); loginController.setLoginAction( new IAction() { @Override public void execute() { joinController.start(); } }); loginView.setController(loginController); loginView.setController(loginController); ClientServerFacade.createInstance("localhost:8081"); loginController.start(); } }); }
public static void setJavaLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { System.out.println("Error setting Java LAF: " + e); } }
public static void setMotifLookAndFeel() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); } catch (Exception e) { System.out.println("Error setting Motif LAF: " + e); } }
public MacOSController() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } }
/** * Tell system to use native look and feel, as in previous releases. Metal (Java) LAF is the * default otherwise. */ public static void setNativeLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println("Error setting native LAF: " + e); } }
private void setDefaultLnF() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } }
/** @param args the command line arguments */ public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Config.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Config.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Config.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Config.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } // </editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater( new Runnable() { public void run() { new Config(Main.getLocale()).setVisible(true); } }); }
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(TelaVenda.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } java.awt.EventQueue.invokeLater( new Runnable() { @Override public void run() { new TelaVenda().setVisible(true); } }); }
/** Creates new form CallForm */ public Controller() { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { logger.log(java.util.logging.Level.SEVERE, ex.getMessage(), ex); } initComponents(); this.setVisible(true); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.addWindowListener( new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { if (cancelButton.isEnabled()) { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); System.exit(0); } } }); }
/** Sets the Look and Feel to the Systems Look and Feel */ private void setLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println(e); } }
{ // Systemlook try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } }
public static void main(String[] args) { /* Use an appropriate Look and Feel */ try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); // UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } catch (IllegalAccessException ex) { ex.printStackTrace(); } catch (InstantiationException ex) { ex.printStackTrace(); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } /* Turn off metal's use of bold fonts */ UIManager.put("swing.boldMetal", Boolean.FALSE); // Schedule a job for the event-dispatching thread: // adding TrayIcon. SwingUtilities.invokeLater( new Runnable() { public void run() { weather = new Wetter(); createAndShowGUI(); } }); }