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); }
public void changeLAF(int iLAFIndex) { try { // Change LAF if (iLAFIndex >= marrLaf.length) iLAFIndex = marrLaf.length - 1; UIManager.setLookAndFeel( (LookAndFeel) Class.forName(marrLaf[iLAFIndex].getClassName()).newInstance()); // Update UI ((JMenuItem) mvtLAFItem.elementAt(iLAFIndex)).setSelected(true); SwingUtilities.updateComponentTreeUI(this); SwingUtilities.updateComponentTreeUI(mnuMain); WindowManager.updateLookAndField(); // Store config try { Hashtable prt = Global.loadHashtable(Global.FILE_CONFIG); prt.put("LAF", String.valueOf(iLAFIndex)); Global.storeHashtable(prt, Global.FILE_CONFIG); } catch (Exception e) { } } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } }
/** * Aware-P Epanet application entry point * * @param args * @throws UnsupportedLookAndFeelException */ public static void main(String[] args) throws UnsupportedLookAndFeelException { if (Utilities.isMac()) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Aware-P Epanet"); Application app = Application.getApplication(); app.setDockIconImage( Toolkit.getDefaultToolkit().getImage(EpanetUI.class.getResource("/uiresources/ae.png"))); JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); menuBar.add(fileMenu); openAction = new JMenuItem("Open"); saveAction = new JMenuItem("Save"); runAction = new JMenuItem("Run"); fileMenu.add(openAction); fileMenu.add(saveAction); fileMenu.add(runAction); app.setDefaultMenuBar(menuBar); } UIManager.setLookAndFeel(new Plastic3DLookAndFeel()); new EpanetUI(); }
/** 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); }
/** * ������ѡ���� * * @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; }
public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(new NimbusLookAndFeel()); Robot robot = new Robot(); robot.setAutoDelay(50); SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); SwingUtilities.invokeAndWait( new Runnable() { public void run() { createAndShowGUI(); } }); toolkit.realSync(); SwingUtilities.invokeAndWait( new Runnable() { public void run() { Component previewPanel = Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel"); point = previewPanel.getLocationOnScreen(); } }); point.translate(5, 5); robot.mouseMove(point.x, point.y); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); }
public static void main(String[] args) throws Exception { if (args.length > 0) { DATABASE_FILE = Paths.get(args[0]); } UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); launch(args); }
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 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(); } }); }
private void initIcon() throws InitializationException { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { throw new InitializationException("Unable to set look and feel for tray icon", e); } tray = SystemTray.getSystemTray(); File defaultIconFile = new File( config.getResDir() + File.separator + Constants.TRAY_DIRNAME + File.separator + Constants.TRAY_FILENAME_DEFAULT); Image image = Toolkit.getDefaultToolkit().getImage(defaultIconFile.getAbsolutePath()); icon = new TrayIcon(image, "Stacksync", menu); icon.setImageAutoSize(true); try { tray.add(icon); } catch (AWTException e) { throw new InitializationException("Unable to add tray icon.", e); } }
/** * 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); } }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { } MainFrame mainFrame = new MainFrame(); }
/** * Start the chooser. * * @param args command line parameters */ public static void main(final String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } new TestChooser().start(args); }
private void setLookAndFeel() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception exc) { // ignore error } }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } new TabbedDialog(); }
/** * Main method. Begins the GUI, and the rest of the program. * * @param args the command line arguments */ public static void main(String args[]) { // playSound(); try { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(mainForm.class.getName()).log(Level.SEVERE, null, ex); } // </editor-fold> /* Create and display the form */ EventQueue.invokeLater( new Runnable() { @Override public void run() { new mainForm().setVisible(true); } }); }
public static void setJavaLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { System.out.println("Error setting Java LAF: " + e); } }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println("Look and feel not set."); } new gui(); }
/** * Initializes Swing's look and feel to the system native look and feel. On Mac, uses the system * menu bar. */ private void initLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ignored) { } System.setProperty("apple.laf.useScreenMenuBar", "true"); UIManager.put("Table.alternateRowColor", new Color(243, 246, 250)); }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception unused) {; // Ignore exception because we can't do anything. Will use // default. } new Dashboard(); }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } new IdeMain(); }
private void setLookAndFeel() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); SwingUtilities.updateComponentTreeUI(this); } catch (Exception exc) { System.err.println("Couldn't use the system " + "look and feel: " + exc); } }
/** Switch to a new Look&Feel */ private void newLookAndFeel(String landf) { try { UIManager.setLookAndFeel(landf); SwingUtilities.updateComponentTreeUI(this); } catch (Exception e) { System.err.println(e); } }
// Workaround to avoid a bug in the java 1.3 VM static { try { if (JTattooUtilities.getJavaVersion() < 1.4) { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } } catch (Exception ex) { } }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { String message = "ExceptionWhileSettingSystemLookAndFeel"; Logging.logger().log(java.util.logging.Level.WARNING, message, e); } start("World Wind - elevations demo", AppFrame.class); }
/** @param args command line params */ public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); f = UIManager.getDefaults().getFont("TabbedPane.font"); f = new Font(f.getFamily(), Font.BOLD, f.getSize()); } catch (Exception x) { } new TestProgram().start(); }
public Perfil() { super.setBounds(181, 61, 700, 538); // (ancho,alto) super.setLayout(null); super.setOpaque(false); super.setVisible(false); try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (Exception ex) { ex.printStackTrace(); } jbtnGuardar = new JButton("Guardar Cambios"); jbtnGuardar.setBounds(55, 457, 150, 40); jbtnGuardar.addActionListener(this); jbtnGuardar.setBorder(null); jbtnGuardar.setBackground(new Color(0, 154, 225)); jbtnGuardar.setForeground(Color.WHITE); jbtnGuardar.setFont(new Font("Segoe UI", Font.PLAIN, 14)); jbtnGuardar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR)); jbtnGuardar.setFocusPainted(false); this.add(jbtnGuardar); nombre = new JLabel("Ninguna imagen seleccionada"); nombre.setBounds(210, 250, 200, 40); nombre.setForeground(Color.GRAY); this.add(nombre); jbtnCargarI = new JButton("Cargar imagen"); jbtnCargarI.setBounds(55, 250, 150, 40); jbtnCargarI.addActionListener(this); jbtnCargarI.setBorder(null); jbtnCargarI.setBackground(new Color(0, 154, 225)); jbtnCargarI.setForeground(Color.WHITE); jbtnCargarI.setFont(new Font("Segoe UI", Font.PLAIN, 14)); jbtnCargarI.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR)); jbtnCargarI.setFocusPainted(false); this.add(jbtnCargarI); jbtnQuitarI = new JButton("Quitar imagen"); jbtnQuitarI.setBounds(55, 186, 150, 40); jbtnQuitarI.addActionListener(this); jbtnQuitarI.setBorder(null); jbtnQuitarI.setBackground(new Color(0, 154, 225)); jbtnQuitarI.setForeground(Color.WHITE); jbtnQuitarI.setFont(new Font("Segoe UI", Font.PLAIN, 14)); jbtnQuitarI.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR)); jbtnQuitarI.setFocusPainted(false); this.add(jbtnQuitarI); jlbimage = new JLabel(); jlbimage.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); jlbimage.setBounds(55, 46, 150, 150); this.add(jlbimage); this.repaint(); }
/** Sets the current L&F on each demo module */ public void updateLookAndFeel() { try { UIManager.setLookAndFeel(currentLookAndFeel); SwingUtilities.updateComponentTreeUI(this); } catch (Exception ex) { System.out.println("Failed loading L&F: " + currentLookAndFeel); System.out.println(ex); } }
public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.invokeLater( new Runnable() { public void run() { new App().setVisible(true); } }); }
static void initLookAndFeel() { MetalLookAndFeel mlf = new MetalLookAndFeel(); mlf.setCurrentTheme(new SipCommunicatorColorTheme()); try { UIManager.setLookAndFeel(mlf); } catch (UnsupportedLookAndFeelException ex) { console.error("Failed to set custom look and feel", ex); } }