List of usage examples for javax.swing UIManager getInstalledLookAndFeels
public static LookAndFeelInfo[] getInstalledLookAndFeels()
From source file:ua.com.fielden.platform.example.swing.schedule.ScheduleChartPanelExample.java
public static void main(final String[] args) { SwingUtilitiesEx.invokeLater(new Runnable() { @Override//from w w w.j a va 2 s.co m public void run() { for (final LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(laf.getName())) { try { UIManager.setLookAndFeel(laf.getClassName()); } catch (final Exception e) { e.printStackTrace(); } } } com.jidesoft.utils.Lm.verifyLicense("Fielden Management Services", "Rollingstock Management System", "xBMpKdqs3vWTvP9gxUR4jfXKGNz9uq52"); LookAndFeelFactory.installJideExtension(); final JFrame frame = new JFrame("Scedule chart demo"); final JLabel label = new JLabel("None"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new MigLayout("fill, insets 0", "[grow, fill]", "[grow, fill][]")); frame.add(createScheduleChartPanel(label), "wrap"); frame.add(label); frame.setPreferredSize(new Dimension(640, 480)); frame.pack(); frame.setVisible(true); } }); }
From source file:info.varden.anatychia.Main.java
/** * @param args the command line arguments */// w w w .j a v a 2 s. c o m public static void main(String[] args) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look and feel. } // SaveData sd = new SaveData(new File("C:\\Users\\Marius\\AppData\\Roaming\\.minecraft\\saves\\Craft Bandicoot World 1.0"), "Craft Bandicoot World 1.0", "Craft Bandicoot World 1.0"); // materialList(sd); AnatychiaMain mn = new AnatychiaMain(); mn.setLocationRelativeTo(null); mn.setVisible(true); //SplashScreen.main(args); /*final DoubleTag it = new DoubleTag("Test", 1.4D); final CompoundTag ct1 = new CompoundTag("someStore", new HashMap<String, Tag>() {{ put("Test", it); }}); CompoundTag root = new CompoundTag("", new HashMap<String, Tag>() {{ put("someStore", ct1); }}); MaterialData d = new MaterialData(MaterialType.BLOCK, "minecraft:air", 0, new NBTCriteria[] { new NBTCriteria("/someStore/Test", DoubleTag.class, "2", MatchMode.EQUALS_OR_SMALLER), new NBTCriteria("/someStore/Test", DoubleTag.class, "1.5", MatchMode.EQUALS_OR_GREATER) }); System.out.println(d.fulfillsRequirements(root));*/ }
From source file:ua.com.fielden.platform.example.swing.booking.BookingChartPanelExample.java
public static void main(final String[] args) { SwingUtilitiesEx.invokeLater(new Runnable() { @Override/* w w w .java2 s . c o m*/ public void run() { for (final LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(laf.getName())) { try { UIManager.setLookAndFeel(laf.getClassName()); } catch (final Exception e) { e.printStackTrace(); } } } com.jidesoft.utils.Lm.verifyLicense("Fielden Management Services", "Rollingstock Management System", "xBMpKdqs3vWTvP9gxUR4jfXKGNz9uq52"); LookAndFeelFactory.installJideExtension(); final JFrame frame = new JFrame("Booking chart demo"); final JLabel label = new JLabel("None"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new MigLayout("fill, insets 0", "[grow, fill]", "[grow, fill][]")); frame.add(createBookingChartPanel(label), "wrap"); frame.add(label); frame.setPreferredSize(new Dimension(640, 480)); frame.pack(); frame.setVisible(true); } }); }
From source file:org.jfree.graphics2d.demo.SwingUIToSVGDemo.java
public static void main(String[] args) { try {/* w w w . ja v a 2 s .c o m*/ for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // just take the default look and feel } SwingUIToSVGDemo app = new SwingUIToSVGDemo("SwingUIToSVGDemo.java"); app.pack(); app.setVisible(true); }
From source file:ListProperties.java
public static void main(String args[]) { final JFrame frame = new JFrame("List Properties"); final CustomTableModel model = new CustomTableModel(); model.uiDefaultsUpdate(UIManager.getDefaults()); TableSorter sorter = new TableSorter(model); JTable table = new JTable(sorter); TableHeaderSorter.install(sorter, table); table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); UIManager.LookAndFeelInfo looks[] = UIManager.getInstalledLookAndFeels(); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { final String lafClassName = actionEvent.getActionCommand(); Runnable runnable = new Runnable() { public void run() { try { UIManager.setLookAndFeel(lafClassName); SwingUtilities.updateComponentTreeUI(frame); // Added model.uiDefaultsUpdate(UIManager.getDefaults()); } catch (Exception exception) { JOptionPane.showMessageDialog(frame, "Can't change look and feel", "Invalid PLAF", JOptionPane.ERROR_MESSAGE); }/*from w w w. java 2s. co m*/ } }; SwingUtilities.invokeLater(runnable); } }; JToolBar toolbar = new JToolBar(); for (int i = 0, n = looks.length; i < n; i++) { JButton button = new JButton(looks[i].getName()); button.setActionCommand(looks[i].getClassName()); button.addActionListener(actionListener); toolbar.add(button); } Container content = frame.getContentPane(); content.add(toolbar, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(table); content.add(scrollPane, BorderLayout.CENTER); frame.setSize(400, 400); frame.setVisible(true); }
From source file:at.co.malli.relpm.RelPM.java
/** * @param args the command line arguments *//* www . j ava 2 s . co m*/ public static void main(String[] args) { //<editor-fold defaultstate="collapsed" desc=" Create config & log directory "> String userHome = System.getProperty("user.home"); File relPm = new File(userHome + "/.RelPM"); if (!relPm.exists()) { boolean worked = relPm.mkdir(); if (!worked) { ExceptionDisplayer.showErrorMessage(new Exception("Could not create directory " + relPm.getAbsolutePath() + " to store user-settings and logs")); System.exit(-1); } } File userConfig = new File(relPm.getAbsolutePath() + "/RelPM-userconfig.xml"); //should be created... if (!userConfig.exists()) { try { URL resource = RelPM.class.getResource("/at/co/malli/relpm/RelPM-defaults.xml"); FileUtils.copyURLToFile(resource, userConfig); } catch (IOException ex) { ExceptionDisplayer.showErrorMessage(new Exception("Could not copy default config. Reason:\n" + ex.getClass().getName() + ": " + ex.getMessage())); System.exit(-1); } } if (!userConfig.canWrite() || !userConfig.canRead()) { ExceptionDisplayer.showErrorMessage(new Exception( "Can not read or write " + userConfig.getAbsolutePath() + "to store user-settings")); System.exit(-1); } if (System.getProperty("os.name").toLowerCase().contains("win")) { Path relPmPath = Paths.get(relPm.toURI()); try { Files.setAttribute(relPmPath, "dos:hidden", true); } catch (IOException ex) { ExceptionDisplayer.showErrorMessage(new Exception("Could not set " + relPm.getAbsolutePath() + " hidden. " + "Reason:\n" + ex.getClass().getName() + ": " + ex.getMessage())); System.exit(-1); } } //</editor-fold> logger.trace("Environment setup sucessfull"); //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code "> try { String wantedLookAndFeel = SettingsProvider.getInstance().getString("gui.lookAndFeel"); UIManager.LookAndFeelInfo[] installed = UIManager.getInstalledLookAndFeels(); boolean found = false; for (UIManager.LookAndFeelInfo info : installed) { if (info.getClassName().equals(wantedLookAndFeel)) found = true; } if (found) UIManager.setLookAndFeel(wantedLookAndFeel); else UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { logger.error(ex.getMessage()); ExceptionDisplayer.showErrorMessage(ex); } catch (InstantiationException ex) { logger.error(ex.getMessage()); ExceptionDisplayer.showErrorMessage(ex); } catch (IllegalAccessException ex) { logger.error(ex.getMessage()); ExceptionDisplayer.showErrorMessage(ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { logger.error(ex.getMessage()); ExceptionDisplayer.showErrorMessage(ex); } //</editor-fold> //<editor-fold defaultstate="collapsed" desc=" Add GUI start to awt EventQue "> java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainGUI().setVisible(true); } }); //</editor-fold> }
From source file:Main.java
public static void updateUILookAndFeel(Component c) { try {/*from w w w . j av a2s . com*/ String plafName = UIManager.getInstalledLookAndFeels()[1].getClassName(); UIManager.setLookAndFeel(plafName); SwingUtilities.updateComponentTreeUI(c); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void setNimbusLookAndFeel() { try {//from w ww . ja v a 2 s .co m for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { } }
From source file:Main.java
public static void applyLookAndFeel(String lookAndFeel) { try {//from w ww.j a va 2 s .c o m for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (lookAndFeel.equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { throw new RuntimeException(e); } }
From source file:Main.java
public static void lookLinux(Component comp) { UIManager.LookAndFeelInfo[] looks = UIManager.getInstalledLookAndFeels(); for (UIManager.LookAndFeelInfo look : looks) { if (look.getClassName().matches("(?i).*linux.*")) { try { UIManager.setLookAndFeel(look.getClassName()); SwingUtilities.updateComponentTreeUI(comp); return; } catch (Exception e) { e.printStackTrace();/* w w w. j a v a2 s. c o m*/ } } } }