List of usage examples for javax.swing UIManager getSystemLookAndFeelClassName
public static String getSystemLookAndFeelClassName()
LookAndFeel
class that implements the native system look and feel if there is one, otherwise the name of the default cross platform LookAndFeel
class. From source file:qrcode.JavaQR.java
@Override public void run() { setLayout(new BorderLayout()); JPanel topPanel = new JPanel(); JPanel centerPanel = new JPanel(); JPanel bottomPanel = new JPanel(); topPanel.setLayout(new GridLayout(0, 1)); topPanel.setBorder(BorderFactory.createTitledBorder("Input Data")); JPanel rowTopPanel = new JPanel(); rowTopPanel.setLayout(new GridLayout(0, 2)); JLabel accKey = new JLabel("Access Key"); JTextField accField = new JTextField(5); accField.setEditable(false);/*from w ww . j a v a 2 s . co m*/ accField.setText(Data.accessKey); JLabel regNo = new JLabel("Registration Number"); JTextField regField = new JTextField(5); regField.setEditable(false); regField.setText(Data.registrationNumber); JLabel licNo = new JLabel("License Number"); JFormattedTextField licField = new JFormattedTextField(); licField.setEditable(false); licField.setText(Data.licenseNumber); rowTopPanel.add(accKey); rowTopPanel.add(accField); rowTopPanel.add(regNo); rowTopPanel.add(regField); rowTopPanel.add(licNo); rowTopPanel.add(licField); topPanel.add(rowTopPanel); centerPanel.setLayout(new GridLayout(0, 1)); centerPanel.setBorder(BorderFactory.createTitledBorder("QR Code")); JPanel rowCenPanel = new JPanel(); rowCenPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); JButton genBtn = new JButton("Download QR Code"); JButton homeBtn = new JButton("Back to Start"); String accessKey = accField.getText().toString(); String regKey = regField.getText().toString(); String licKey = licField.getText().toString(); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("accessKey", accessKey); jsonObject.put("registrationNumber", regKey); jsonObject.put("licenseNumber", licKey); } catch (JSONException e1) { e1.printStackTrace(); } QRLogic qrGen = new QRLogic(); BufferedImage image = qrGen.generateQR(jsonObject); centerPanel.add(new JLabel(new ImageIcon(image))); bottomPanel.setLayout(new GridLayout(2, 1)); rowCenPanel.add(homeBtn); rowCenPanel.add(genBtn); bottomPanel.add(rowCenPanel); add(topPanel, BorderLayout.NORTH); add(bottomPanel, BorderLayout.SOUTH); add(centerPanel, BorderLayout.CENTER); Data.mainFrame.setSize(1000, 500); genBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Date date = new Date(); String newDate = new SimpleDateFormat("yyyy-MM-dd h-m-a").format(date); JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); File myFile = new File(Data.registrationNumber + ".png"); fileChooser.setSelectedFile(myFile); fileChooser.showSaveDialog(null); String dlDir = fileChooser.getSelectedFile().getPath(); System.out.println(dlDir); String fileName = fileChooser.getSelectedFile().getName(); String filePath = ""; if (fileName != null) { filePath = dlDir + ".png"; } else { filePath = dlDir + "/" + Data.registrationNumber + ".png"; } String fileType = "png"; myFile = new File(filePath); if (dlDir != null) { try { ImageIO.write(image, fileType, myFile); JOptionPane.showMessageDialog(Data.mainFrame, "QR Code Saved in " + dlDir); } catch (IOException e1) { e1.printStackTrace(); } } } }); homeBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Data.mainFrame.showPanel("inventory"); } }); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (InstantiationException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } catch (UnsupportedLookAndFeelException e1) { e1.printStackTrace(); } }
From source file:regextester.RegexTester.java
public RegexTester() throws Exception { RegexTester.application = this; // First setup our logger this.checkSettingsDirExists(); logger.setLevel(Level.SEVERE); FileHandler fh = new FileHandler(this.settingsDirname + File.separator + "debug.log", 8096, 1, true); logger.addHandler(fh);// ww w . j a v a 2 s .c o m SimpleFormatter formatter = new SimpleFormatter(); fh.setFormatter(formatter); logger.info("Starting RegexTester"); // Load our properties and attach the database, creating it if it doesn't exist this.loadProperties(); // Create our GUI UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); window = new MainWindow(this); window.setLocationRelativeTo(null); window.setTitle("RegexTester"); window.setVisible(true); }
From source file:ryerson.daspub.ui.ApplicationJFrame.java
/** * Set the interface look and feel./*from ww w . j a v a 2 s . c om*/ */ private void setLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException ex) { String stack = ExceptionUtils.getStackTrace(ex); logger.log(Level.SEVERE, "Could not set application look and feel\n\n{0}", stack); System.exit(Main.FAIL); } catch (ClassNotFoundException ex) { String stack = ExceptionUtils.getStackTrace(ex); logger.log(Level.SEVERE, "Could not set application look and feel\n\n{0}", stack); System.exit(Main.FAIL); } catch (InstantiationException ex) { String stack = ExceptionUtils.getStackTrace(ex); logger.log(Level.SEVERE, "Could not set application look and feel\n\n{0}", stack); System.exit(Main.FAIL); } catch (IllegalAccessException ex) { String stack = ExceptionUtils.getStackTrace(ex); logger.log(Level.SEVERE, "Could not set application look and feel\n\n{0}", stack); System.exit(Main.FAIL); } }
From source file:savant.view.swing.Savant.java
/** * Starts an instance of the Savant Browser * * @param args the command line arguments *//*from ww w.j a v a 2 s. co m*/ public static void main(String args[]) { AnalyticsAgent.onStartSession("Savant", BrowserSettings.VERSION); try { boolean loadProject = false; boolean loadPlugin = false; String loadProjectUrl = null; List<String> loadPluginUrls = new ArrayList<String>(); for (int i = 0; i < args.length; i++) { String s = args[i]; if (s.startsWith("--")) { //build loadProject = false; loadPlugin = false; BrowserSettings.BUILD = s.replaceAll("-", ""); if (s.equals("--debug")) { turnExperimentalFeaturesOff = false; } } else if (s.startsWith("-")) { if (s.equals("-project")) { loadProject = true; loadPlugin = false; } else if (s.equals("-plugins")) { loadPlugin = true; loadProject = false; } } else if (loadProject) { loadProjectUrl = s; loadProject = false; } else if (loadPlugin) { loadPluginUrls.add(s); } else { //bad argument, skip } } System.setProperty("java.net.useSystemProxies", "true"); installMissingPlugins(loadPluginUrls); //java.awt.EventQueue.invokeLater(new Runnable() { //@Override //public void run() { System.setProperty("apple.laf.useScreenMenuBar", "true"); com.jidesoft.utils.Lm.verifyLicense("Marc Fiume", "Savant Genome Browser", "1BimsQGmP.vjmoMbfkPdyh0gs3bl3932"); UIManager.put("JideSplitPaneDivider.border", 5); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SAMFileReader.setDefaultValidationStringency(SAMFileReader.ValidationStringency.SILENT); if (MiscUtils.WINDOWS) { LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE_WITHOUT_MENU); } // Load project immediately if argument exists. if (Savant.getInstance().isWebStart() && loadProjectUrl != null) { ProjectController.getInstance().loadProjectFromURL(loadProjectUrl); } } catch (Exception x) { LOG.error("Error in main()", x); } }
From source file:SchoolCheckerUI.SchoolChecker.java
/** * @param args the command line arguments *//* www . jav a 2 s . c om*/ 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(SchoolChecker.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(SchoolChecker.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(SchoolChecker.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(SchoolChecker.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //</editor-fold> try { if (UpdateChecker.checkUpdate()) { UpdateChecker.update(); } } catch (IOException ex) { Logger.getLogger(SchoolChecker.class.getName()).log(Level.SEVERE, null, ex); } /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new SchoolChecker().setVisible(true); } }); } catch (ClassNotFoundException ex) { Logger.getLogger(SchoolChecker.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(SchoolChecker.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(SchoolChecker.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(SchoolChecker.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:test.uk.co.modularaudio.util.audio.controlinterpolation.SwingControlInterpolatorAnalyser.java
public static void main(final String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); final SwingControlInterpolatorAnalyser scia = new SwingControlInterpolatorAnalyser(); SwingUtilities.invokeLater(new Runnable() { @Override// w w w . j a va 2s . c o m public void run() { try { scia.setVisible(true); // scia.applyToWavFile( WAV_FILE_IN,WAV_FILE_OUT ); scia.go(); } catch (final Exception e) { log.error(e); scia.dispose(); } } }); }
From source file:test.uk.co.modularaudio.util.swing.dndtable.layeredpane.LaunchTestLayeredPaneDndTable.java
/** * @param args/*www. java2 s .co m*/ */ public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { // LookAndFeel newLookAndFeel = new SubstanceBusinessLookAndFeel(); // UIManager.setLookAndFeel( newLookAndFeel ); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); final LaunchTestLayeredPaneDndTable launcher = new LaunchTestLayeredPaneDndTable(); log.debug("Off we go"); launcher.setVisible(true); } catch (final Exception e) { log.error(e); } } }); }
From source file:test.uk.co.modularaudio.util.swing.lwtc.TestShowLWTCButton.java
public static void main(final String[] args) throws Exception { if (LWTCCtrlTestingConstants.USE_LAF) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }/*ww w. j av a2s .c o m*/ final TestShowLWTCButton t = new TestShowLWTCButton(); t.go(); }
From source file:test.uk.co.modularaudio.util.swing.lwtc.TestShowLWTCSliderComparison.java
public static void main(final String[] args) throws Exception { if (LWTCCtrlTestingConstants.USE_LAF) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.put("Slider.paintValue", Boolean.FALSE); }/* www. j a v a2 s. c o m*/ final TestShowLWTCSliderComparison vt = new TestShowLWTCSliderComparison(); vt.go(SwingConstants.VERTICAL); final TestShowLWTCSliderComparison ht = new TestShowLWTCSliderComparison(); ht.go(SwingConstants.HORIZONTAL); }
From source file:test.uk.co.modularaudio.util.swing.lwtc.TestShowLWTCToggleButton.java
public static void main(final String[] args) throws Exception { if (LWTCCtrlTestingConstants.USE_LAF) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }/*from w w w.ja v a2 s . c om*/ final TestShowLWTCToggleButton t = new TestShowLWTCToggleButton(); t.go(); }