public static void main(String[] args) throws Exception { robot = new Robot(); String name = UIManager.getSystemLookAndFeelClassName(); try { UIManager.setLookAndFeel(name); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { throw new RuntimeException("Test Failed"); } createUI(); robot.waitForIdle(); executeTest(); if (!"".equals(errorMessage)) { throw new RuntimeException(errorMessage); } }
public void init() { JFrame.setDefaultLookAndFeelDecorated(true); try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { throw new RuntimeException("Test Failed. MetalLookAndFeel not set " + "for frame"); } frame = new JFrame("JFrame Maximization Test"); frame.pack(); frame.setSize(450, 260); frame.setVisible(true); }
/** * Initialisationsmethode, die in jedem Konstruktor benutzt wird * @param layout * @param panels */ void initialize(LayoutManager layout, ArrayList<JPanel> panels){ this.setLayout(layout); for(JPanel panel: panels){ this.add(panel); } this.setTitle("Random Music Generator Canon"); this.setSize(1200, 700); //places Frame in the middle of the screen this.setLocationRelativeTo(null); this.setResizable(true); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.addWindowListener(new defaultWindowListener()); //adjusting look to local system try { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } //shows the Frame on the screen this.setVisible(true); }
public void testSinglePlatformInstall () throws IOException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(new MetalLookAndFeel()); InstallerRegistry regs = InstallerRegistryAccessor.prepareForUnitTest(new GeneralPlatformInstall[] { new FileBasedPlatformInstall ("FileBased1", Collections.<WizardDescriptor.Panel<WizardDescriptor>>singletonList( new Panel ("FileBased1_panel1") )) }); PlatformInstallIterator iterator = PlatformInstallIterator.create(); WizardDescriptor wd = new WizardDescriptor (iterator); iterator.initialize(wd); assertEquals("Invalid state", 1, iterator.getPanelIndex()); WizardDescriptor.Panel panel = iterator.current(); assertTrue ("Invalid panel",panel instanceof LocationChooser.Panel); ((JFileChooser)panel.getComponent()).setSelectedFile(this.getWorkDir()); //Select some folder assertTrue ("LocationChooser is not valid after folder was selected",panel.isValid()); assertTrue ("Should have next panel",iterator.hasNext()); assertFalse ("Should not have previous panel", iterator.hasPrevious()); iterator.nextPanel(); assertEquals("Invalid state", 2, iterator.getPanelIndex()); panel = iterator.current(); assertEquals("Invalid panel","FileBased1_panel1",panel.getComponent().getName()); assertFalse ("Should not have next panel",iterator.hasNext()); assertTrue ("Should have previous panel", iterator.hasPrevious()); }
public static void main(String[] args) { if (args.length > 0) { debug = args[0] == "-d"; } try { javax.swing.UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { System.err.print(ex); } Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler()); new Main().setVisible(true); }
/** * Main */ public static void main(String[] args) throws Exception { try { //UIManager.setLookAndFeel("com.jtattoo.plaf.hifi.HiFiLookAndFeel"); // Nero, troppo nero. (L'unico con i jcombobox neri) - brutto rendering dadi/coni dadi //UIManager.setLookAndFeel("com.jtattoo.plaf.noire.NoireLookAndFeel"); // (Nero, troppo nero. (L'unico con i jcombobox neri))^2.Un po' più di arancione in giro, scritte più bianche UIManager.setLookAndFeel("com.jtattoo.plaf.aluminium.AluminiumLookAndFeel"); // Grigio scuro, bottoni bocciatissimi. (forse il mio preferito? Forse serve qualcosa che faccia contrasto? boh) } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex); } StartGameGUI start = new StartGameGUI(); start.setVisible(true); }
static void complain(String message) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException, URISyntaxException, InterruptedException { // Resort to a Swing Y/N dialog asking if the user wants to update Java. // If they click yes, their default browser will open to the JAVA_UPDATE_URL UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); int reply = JOptionPane.showConfirmDialog(null, message, "NoMoreOversleeps", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE); if (reply == 0) { String platformCode = ""; if (PlatformData.platformType == PlatformType.WINDOWS) { platformCode = PlatformData.is64bitOS ? "?platform=win64" : "?platform=win32"; } else if (PlatformData.platformType == PlatformType.MAC) { platformCode = "?platform=mac"; } else { platformCode = "?platform=linux"; } java.awt.Desktop.getDesktop().browse(new URI(Main.JAVA_UPDATE_URL + platformCode)); Thread.sleep(100); } }
/** * @param args the command line arguments */ public static void main(String args[]) { /* 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 (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(() -> { new Main().setVisible(true); }); }
@SuppressWarnings("nls") protected BaseUtility() { try { UIManager.setLookAndFeel(new FlatterLookAndFeel()); System.setProperty("org.apache.commons.logging.LogFactory", "org.apache.commons.logging.impl.SLF4JLogFactory"); BlindSSLSocketFactory.register(); AxisProperties.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory"); } catch( UnsupportedLookAndFeelException e ) { throw new RuntimeException(e); } data = new SharedData(); createGUI(); }
public static void main(String args[]) { //Look and Feel del sistema operativo try { // Set Look and Feel to "System" which means that Swing will use the // OS's native GUI toolkit to render the application, making it look // native UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { System.out.println("Errore GUI: " + ex); JOptionPane.showMessageDialog(null, "Errore GUI: " + ex); } /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new CharRecognizer().setVisible(true); } }); }
public static void main(String[] args) { UIManager.put("swing.boldMetal", Boolean.FALSE); JDialog.setDefaultLookAndFeelDecorated(true); JFrame.setDefaultLookAndFeelDecorated(true); Toolkit.getDefaultToolkit().setDynamicLayout(true); System.setProperty("sun.awt.noerasebackground", "true"); try { UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { System.out.println( "Metal Look & Feel not supported on this platform. \n" + "Program Terminated"); System.exit(0); } JFrame frame = new MetalworksFrame(); frame.setVisible(true); }
public Gui() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); frame = new JFrame("ElectroLight Penetration Testing"); menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); JMenu mnCounterhack = new JMenu("Counter-hack"); menuBar.add(mnCounterhack); JMenuItem mntmArpScan = new JMenuItem("ARP Scan"); mnCounterhack.add(mntmArpScan); frame.setSize(300, 200); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); frame.getContentPane().add(tabbedPane, BorderLayout.CENTER); // Always keep the 2 following lines at the end. //frame.pack(); frame.setVisible(true); }
/** Creates new form WalletLoginGUI */ public LoginGUI() { /* Set Nimbus look and feel. */ try { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { System.err.println(e.getMessage()); } initComponents(); Utils.setWindowCenterOfScreen(this); setVisible(true); }
/** Creates new form RegisterGUI */ public RegisterGUI() { /* Set Nimbus look and feel. */ try { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException exception) { java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, exception); } initComponents(); Utils.setWindowCenterOfScreen(this); setVisible(true); }
public JFrame getGraph() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) { e1.printStackTrace(); } final AlloyInstance instance = StaticInstanceMaker.createInstance(this.universe); final VizState myState = new VizState(instance); final JFrame frame = new JFrame("Visualization"); final VizGraphPanel graph = new VizGraphPanel(myState, false); frame.add(graph); graph.alloyGetViewer().alloyRepaint(); return frame; }
private void setTheme() { try { /* * TODO BUG * * A Fatal Error occurs while setting GTK look and feel on Ubuntu 16.04 * (com.sun.java.swing.plaf.gtk.GTKLookAndFeel). * */ final String LaF = UIManager.getSystemLookAndFeelClassName(); if ("com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(LaF)) { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } else { UIManager.setLookAndFeel(LaF); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) { e1.printStackTrace(); } }
public static void main(String[] args) throws Exception { OSType type = OSInfo.getOSType(); if (type != OSType.WINDOWS) { System.out.println("This test is for Windows only... skipping!"); return; } SwingUtilities.invokeAndWait(() -> { try { UIManager.setLookAndFeel(new WindowsLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } System.out.println("Creating JFileChooser..."); JFileChooser fileChooser = new JFileChooser(); System.out.println("Test passed: chooser = " + fileChooser); }); // Test fails if creating JFileChooser hangs }
public static void main(String[] args) throws Exception { UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels(); // try to test all installed Look and Feels for (UIManager.LookAndFeelInfo lookAndFeel : installedLookAndFeels) { String name = lookAndFeel.getName(); System.out.println("Testing " + name); // Some Look and Feels work only when test is run in a GUI environment // (GTK+ LAF is an example) try { UIManager.setLookAndFeel(lookAndFeel.getClassName()); checkTitleColor(); System.out.println(" titleColor test ok"); checkTitleFont(); System.out.println(" titleFont test ok"); } catch (UnsupportedLookAndFeelException e) { System.out.println(" Note: LookAndFeel " + name + " is not supported on this configuration"); } } }
private static boolean tryLookAndFeel(String lookAndFeelString) throws Exception { //This test case is not applicable for Motif and gtk LAFs if(lookAndFeelString.contains("motif") || lookAndFeelString.contains("gtk")) { return false; } try { UIManager.setLookAndFeel( lookAndFeelString); } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { return false; } return true; }
private static boolean tryLookAndFeel(String lookAndFeelString) throws Exception { try { UIManager.setLookAndFeel( lookAndFeelString); } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { errorString += e.getMessage() + "\n"; System.err.println("[Exception]: " + e.getMessage()); return false; } return true; }
/** * The entry point of application. * * @param args the command line arguments */ public static void main(String[] args) { Logger logger = LoggerFactory.getLogger(GUILabelingTool.class); System.getProperty("java.library.path"); /* Create and display the form */ java.awt.EventQueue.invokeLater(() -> { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // SplashScreen.startSplash() GUILabelingTool gui = new GUILabelingTool(logger); gui.setVisible(true); // for the first run, some special configuration have to be done gui.firstStartInitialization(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { logger.error("Create and display form"); logger.debug("Create and display form {}", ex); } }); }
private void init(int w, int h) { this.setBounds((Toolkit.getDefaultToolkit().getScreenSize().width - w) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - h) / 2, w, h); this.setTitle("Visual Graphviz v1.04"); this.setFont(buttonFont); this.setLayout(null); /* set close operation */ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /* set window style */ try { /* UIManager.setLookAndFeel(WINDOWS_STYLE); */ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } /* this.setResizable(false); */ container = this.getContentPane(); container.setLayout(null); }
private void createGraphComposite(Composite parent) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } Composite composite = new Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND); ClassLoader loader = CFGView.class.getClassLoader(); URL stylesheetUrl = loader.getResource("/styles/styleSheet.css"); System.setProperty("sun.awt.noerasebackground", "true"); System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer"); GraphManager manager = new GraphManager("VisuFlow Graph", "url('"+stylesheetUrl.toString()+"')"); Thread t = new Thread(manager); t.start(); Frame frame = SWT_AWT.new_Frame(composite); frame.add(manager.getApplet()); frame.pack(); }
private static void setLookAndFeel() { if (SystemUtils.IS_OS_MAC_OSX) { // must be before any AWT interaction System.setProperty("apple.laf.useScreenMenuBar", "true"); // place menubar (if any) in native menu bar System.setProperty("apple.awt.application.name", Constants.PROJECT_NAME); if (Config.instance().to().getBoolean(Config.Entry.SYSTEM_TRAY.key(), Constants.SYSTEM_TRAY)) { logger.debug("Hiding dock icon since system-tray integration is enabled"); System.setProperty("apple.awt.UIElement", "true"); } } try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { logger.error("Ooops, problem setting system L&F", e); } }
@Override public Value call(Context context, FunctionCallDescriptor descriptor) throws ScriptRuntimeException { StringValue value = (StringValue) descriptor.get(0); String themeName = value.value(); String themePath = null; if (themeName.equalsIgnoreCase("metal")) { themePath = UIManager.getCrossPlatformLookAndFeelClassName(); } else if (themeName.equalsIgnoreCase("system")) { themePath = UIManager.getSystemLookAndFeelClassName(); } if (themePath != null) { try { UIManager.setLookAndFeel(themePath); return new BoolValue(true); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException exception) { } } return new BoolValue(false); }
public Maze() { cols = Math.floorDiv(WIDTH, W); rows = cols; EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } createAndShowGUI(); } }); }
public static void main(String[] args) throws AWTException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { // Set OS look and feel UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); Moose moose = Moose.getInstance(); // Check for newer version and show notification popup if anything is found moose.checkForUpdatesAndNotifyIfAnyFound(); try { SimpleHttpServer.start(); } catch (Exception e) { // Can happen if the port is already in use logger.fatal("Could not start web server: " + e.getMessage(), e); System.exit(1); } logger.info("Started Moose"); }