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 } } }
private void setNativeLAF() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { // empty } }
public MacOSController() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } }
private void setDefaultLnF() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } }
/** 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); } }
public static String getDefaultLookAndFeelClassName() { switch (UiMode.getCurrentUiMode()) { case SWING: String className = UIManager.getSystemLookAndFeelClassName(); // if the default look and feel is the cross-platform one, we might // need to correct this choice. E.g. - KDE, where GTK look and feel // would be much more appropriate if (className.equals(UIManager.getCrossPlatformLookAndFeelClassName())) { // if the current platform is Linux and the desktop manager is // KDE, then we should try to use the GTK look and feel try { if (System.getProperty("os.name").contains("Linux") && (System.getenv("KDE_FULL_SESSION") != null)) { // check whether the GTK look and feel class is // available -- we'll get CNFE if it is not and it will // not be set Class.forName(LookAndFeelType.GTK.getClassName()); className = LookAndFeelType.GTK.getClassName(); } } catch (ClassNotFoundException e) { ErrorManager.notifyDebug( ResourceUtils.getString(UiUtils.class, RESOURCE_FAILED_TO_FORCE_GTK), e); } } return className; default: return null; } }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } network = false; one = new Player(); two = new Player(); /* path di installazione del gioco */ String gamePath = new File("").getAbsolutePath(); /* caricamento delle impostazioni e assegnazione delle variabili */ File gameCfg = new File(gamePath + "/cfg.txt"); loadCfg(gameCfg); /* caricamento della lista di mosse in un array */ moves = new int[42]; marker = 0; File saveCfg = new File(gamePath + "/save.txt"); /* * in rete non viene considerata l'ultima partita giocata; altrimenti * viene caricata - se precedentemente non era stata conclusa */ if (saveCfg.exists() && !network) loadMoveList(saveCfg); else for (int i = 0; i < moves.length; i++) moves[i] = -1; /* inizializzazione grafica e costruzione della griglia di gioco */ new CFApp(); }
public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); final JFrame f = new JFrame(); f.setLayout(new BorderLayout()); try { System.out.println(UserManager.instance().login("Scott", "test")); // FinanceManager.instance().getAccountManager().retrieve(); FinanceManager.instance().getJournalManager().createJournal("General Journal"); FinanceManager.instance().getAccountManager().importAccts("TestAccts.xml"); FinanceManager.instance().turnOffInitializationPhase(); JournalEntry je = new JournalEntry("Test", null); Account cash = FinanceManager.instance().getAccountManager().getAccount("Cash"); Account a_r = FinanceManager.instance().getAccountManager().getAccount("Accounts Receivable"); je.addLineItem( new JournalEntryLineItem( cash, new AcctAmount(22, TransactionType.DEBIT), "test", cash.getAllCategories().toArray(new AcctActionCategory[0])[0])); je.addLineItem( new JournalEntryLineItem(a_r, new AcctAmount(22, TransactionType.CREDIT), "test", null)); JournalEntryPanel jep = new JournalEntryPanel(je); f.add(jep); } catch (Exception e) { e.printStackTrace(); UserManager.instance().logout(); } f.pack(); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
/** @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(ScrollingSwingTerminalTest.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ScrollingSwingTerminalTest.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ScrollingSwingTerminalTest.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ScrollingSwingTerminalTest.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } /* Create and display the form */ java.awt.EventQueue.invokeLater( new Runnable() { public void run() { new ScrollingSwingTerminalTest().setVisible(true); } }); }
/** * Set the look and feel of Java Swing user interface components to match that of the platform * (Windows, Mac, Linux, etc) on which it is currently running. */ public static final void setPlatformLookAndFeel() { try { String laf = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(laf); } catch (Exception e) { } }
/** Konstruktor */ public HelpWindow(String url) { super("dŽáma – nápověda"); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println("Error setting native LAF: " + e); } this.setIconImage(new ImageIcon(getClass().getResource("/resources/icon_help.png")).getImage()); String ourl = ""; if (url.equals("jar")) { ourl = getClass().getResource("/resources/help/index.html").toString(); } else { ourl = url; } try { htmlPane = new JEditorPane(ourl); htmlPane.setEditable(false); htmlPane.addHyperlinkListener(this); this.add(new JScrollPane(htmlPane)); } catch (IOException ioe) { JOptionPane.showMessageDialog( this, "Soubor s nápovědou neexistuje", "D'oh!", JOptionPane.ERROR_MESSAGE); } this.setPreferredSize(new Dimension(600, 600)); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); this.repaint(); }
/** @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 */ //////////////////////////////////// /////// Give the Gui window ///////// /////// look and feel ///////// //////////////////////////////////// try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println("Look and feel not set."); } // </editor-fold> // </editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater( new Runnable() { public void run() { new CustomerNavigation().setVisible(true); } }); }
/** * 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); }
public SelectWidgetVariableInterface( String activityPath, String xmlPath, String codingType, JRadioButton[] modifierRadioButton, JRadioButton[] isListenerRadioButton) throws Exception { this.activityPath = activityPath; this.xmlPath = xmlPath; this.codingType = codingType; this.modifierRadioButton = modifierRadioButton; this.isListenerRadioButton = isListenerRadioButton; setLayout(null); setVisible(true); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(700, 600); CommonMethod.setLayoutCenter(this); // 固定窗体大小 setResizable(false); // 设置Swing界面UI跟随系统变化 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); setTitle("选择XML控件"); common = new CommonMethod(getContentPane()); init(); }
/** * @return default LookAndFeelInfo for the running OS. For Win32 and Linux the method returns * Alloy LAF or IDEA LAF if first not found, for Mac OS X it returns Aqua RubyMine uses Native * L&F for linux as well */ private UIManager.LookAndFeelInfo getDefaultLaf() { final String systemLafClassName = UIManager.getSystemLookAndFeelClassName(); if (SystemInfo.isMac) { UIManager.LookAndFeelInfo laf = findLaf(systemLafClassName); LOG.assertTrue(laf != null); return laf; } if (PlatformUtils.isRubyMine() || PlatformUtils.isPyCharm()) { final String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop")); if ("gnome".equals(desktop)) { UIManager.LookAndFeelInfo laf = findLaf(systemLafClassName); if (laf != null) { return laf; } LOG.info("Could not find system look and feel: " + laf); } } // Default final String defaultLafName = StartupUtil.getDefaultLAF(); if (defaultLafName != null) { UIManager.LookAndFeelInfo defaultLaf = findLaf(defaultLafName); if (defaultLaf != null) { return defaultLaf; } } UIManager.LookAndFeelInfo ideaLaf = findLaf( isIntelliJLafEnabled() ? IntelliJLaf.class.getName() : IdeaLookAndFeelInfo.CLASS_NAME); if (ideaLaf != null) { return ideaLaf; } throw new IllegalStateException("No default look&feel found"); }
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); } }
private static void createAndShowGUI(String firstColumnName, List<String> statNames) { try { String lookAndFeel = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(lookAndFeel); JFrame.setDefaultLookAndFeelDecorated(true); } catch (SOAPFaultException sfe) { printSoapFaultException(sfe); } catch (Exception e) { e.printStackTrace(); } JFrame frame = new JFrame("VITop"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String[] columnNamesArray = new String[statNames.size() + 1]; columnNamesArray[0] = firstColumnName; for (int i = 0; i < statNames.size(); i++) { columnNamesArray[i + 1] = statNames.get(i); } statsTable = new StatsTable(columnNamesArray); statsTable.setOpaque(true); frame.setContentPane(statsTable); frame.pack(); frame.setVisible(true); }
/** 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 void main(String[] args) throws Exception { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } UIManager.put("PopupMenuUI", "DropShadow.CustomPopupMenuUI"); JFrame frame = new JFrame(DropShadowDemo.class.getSimpleName()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar mb = new JMenuBar(); frame.setJMenuBar(mb); JMenu menu = new JMenu("File"); mb.add(menu); menu.add(new JMenuItem("Open")); menu.add(new JMenuItem("Save")); menu.add(new JMenuItem("Close")); menu.add(new JMenuItem("Exit")); menu = new JMenu("Edit"); mb.add(menu); menu.add(new JMenuItem("Cut")); menu.add(new JMenuItem("Copy")); menu.add(new JMenuItem("Paste")); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add("North", new JButton("Button")); frame.getContentPane().add("Center", new JLabel("a label")); frame.getContentPane().add("South", new JCheckBox("checkbox")); frame.pack(); frame.setSize(200, 150); frame.setLocationRelativeTo(null); frame.show(); }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } new TabbedDialog(); }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception localException) { } LauncherFrame launcherFrame = new LauncherFrame(); launcherFrame.setVisible(true); launcherFrame.customParameters.put("stand-alone", "true"); if (args.length >= 3) { String ip = args[2]; String port = "25565"; if (ip.contains(":")) { String[] parts = ip.split(":"); ip = parts[0]; port = parts[1]; } launcherFrame.customParameters.put("server", ip); launcherFrame.customParameters.put("port", port); } if (args.length >= 1) { launcherFrame.loginForm.userName.setText(args[0]); if (args.length >= 2) launcherFrame.loginForm.doLogin(); } }
/** * Use the look which is usually used on the current operating system. * * <p>For example, on a Windows machine, use a Windows look and feel. If you are using a * non-default look and feel, then you should set it first thing. For more info, see the <a * href='http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/plaf.html#available'>Swing * Tutorial</a> * * <p>Warning: on Windows, the native look & feel displays accelerator keys only when ALT key is * held down. Otherwise, they are not displayed! */ private static void useNativeLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable ex) { fLogger.severe("Cannot set the look and feel."); } }
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(); } }); }
/** Creates new form ChooseArticleGUI */ public ChooseArticleGUI(Controller controller, AddReceiptGUI parent) { this.controller = controller; this.parent = parent; this.articles = controller.getAllArticles(); initComponents(); try { // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { Logger.getLogger(KundGUI.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(KundGUI.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(KundGUI.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(KundGUI.class.getName()).log(Level.SEVERE, null, ex); } // Centrerar fönstret Toolkit tk = Toolkit.getDefaultToolkit(); Dimension screenSize = tk.getScreenSize(); int screenHeight = screenSize.height; int screenWidth = screenSize.width; setLocation(screenWidth / 4 + this.getWidth() / 2, screenHeight / 4); clearList(); populateList(); this.setVisible(true); }
{ // Systemlook try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } }
/** @param args */ public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JFrame frame = new JFrame("ZooInspector"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ZooInspectorPanel zooInspectorPanel = new ZooInspectorPanel(new ZooInspectorManagerImpl()); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { super.windowClosed(e); zooInspectorPanel.disconnect(true); } }); frame.setContentPane(zooInspectorPanel); frame.setSize(1024, 768); frame.setVisible(true); } catch (Exception e) { LoggerFactory.getLogger().error("Error occurred loading ZooInspector", e); JOptionPane.showMessageDialog( null, "ZooInspector failed to start: " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }
/** 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(); } } }
/** Creates the server GUI and sets it visible for the user. */ public static void createServerGui(final DedicatedServer serverIn) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception var3) {; } MinecraftServerGui minecraftservergui = new MinecraftServerGui(serverIn); JFrame jframe = new JFrame("Minecraft server"); jframe.add(minecraftservergui); jframe.pack(); jframe.setLocationRelativeTo((Component) null); jframe.setVisible(true); jframe.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent p_windowClosing_1_) { serverIn.initiateShutdown(); while (!serverIn.isServerStopped()) { try { Thread.sleep(100L); } catch (InterruptedException interruptedexception) { interruptedexception.printStackTrace(); } } System.exit(0); } }); minecraftservergui.latch.countDown(); }
/** * 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); } }
static { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println("Error setting look and feel"); } }