List of usage examples for javax.swing UIManager setLookAndFeel
@SuppressWarnings("deprecation") public static void setLookAndFeel(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
From source file:com.unicorn.co226.ui.patient.AddStudentForm.java
/** * Creates new form AddStudentForm//from w ww. ja v a 2 s .c o m */ public AddStudentForm(java.awt.Frame parent, boolean modal) { super(parent, modal); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { Logger.getLogger(WaitingList.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(WaitingList.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(WaitingList.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(WaitingList.class.getName()).log(Level.SEVERE, null, ex); } this.parent = parent; dateFormat = new SimpleDateFormat("yyyy-MM-dd"); initComponents(); setLocationRelativeTo(parent); medicalPhotos = new File[] {}; maskFormatterMap = new HashMap<>(); try { maskFormatterMap.put("ENG", new MaskFormatter("E-##-###")); MaskFormatter maskFormatter = new MaskFormatter("A-##-###"); maskFormatter.setValidCharacters("A"); maskFormatterMap.put("ART", maskFormatter); maskFormatterMap.put("SCI", new MaskFormatter("S-##-###")); maskFormatterMap.put("MED", new MaskFormatter("M-##-###")); maskFormatterMap.put("AHS", new MaskFormatter("AHS-##-###")); maskFormatterMap.put("MGT", new MaskFormatter("MGT-##-###")); maskFormatterMap.put("VET", new MaskFormatter("V-##-###")); maskFormatterMap.put("AGR", new MaskFormatter("AG-##-###")); maskFormatterMap.put("DEN", new MaskFormatter("D-##-###")); } catch (ParseException ex) { Logger.getLogger(AddStudentForm.class.getName()).log(Level.SEVERE, null, ex); } //dobDatePicker.setDate(new Date(90, 1, 1)); dobDatePicker.setFormats(dateFormat, new SimpleDateFormat("yyyy"), new SimpleDateFormat("yyyy/MM/dd")); fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setFileFilter(new FileNameExtensionFilter("Images", "jpg", "png")); try { String nextId = IdGen.getNextId("Patient", "id", "P"); idTextField.setText(nextId); } catch (ClassNotFoundException ex) { Logger.getLogger(AddStudentForm.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(AddStudentForm.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.josescalia.tumblr.app.MainFrame.java
public void doShow() { try {/*from www .j av a 2 s. co m*/ UIManager.setLookAndFeel(appLookAndFeel); //date and time currentDate = "Date : " + new SimpleDateFormat("dd-MMM-yyyy").format(new Date()); createTimer(); timer.start(); } catch (Exception ex) { logger.info(ex); } initComponents(); executeMenu("tumblrImageViewer"); //loadMainForm(); //this.setVisible(true); }
From source file:serial.ChartFromSerial.java
/** * Creates new form JavaArduinoInterfacingAttempt *///from ww w . ja v a 2 s .c om public ChartFromSerial() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println(e); } initComponents(); //set autoscroll autoScroll_chkBx.setSelected(true); autoScrollEnabled = true; //create the graph defaultSeries = new XYSeries(graphName); defaultDataset = new XYSeriesCollection(defaultSeries); defaultChart = ChartFactory.createXYLineChart(graphName, xAxisLabel, yAxisLabel, defaultDataset); graph = new ChartPanel(defaultChart); chartPanel.add(graph, BorderLayout.CENTER); graph.setVisible(true); //create the text log text = new JTextArea(); text.setEditable(false); textScrollPane = new JScrollPane(text); textScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); textPanel.add(textScrollPane, BorderLayout.CENTER); textScrollPane.setVisible(true); //Populate the combo box portNames = SerialPort.getCommPorts(); while (portNames.length == 0) { if (JOptionPane.showConfirmDialog(rootPane, "No connected devices found.\nWould you like to refresh?", "Could not connect to any devices.", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE) == JOptionPane.NO_OPTION) { buttonsOff(); return; } else { portNames = SerialPort.getCommPorts(); } } portList_jCombo.removeAllItems(); for (SerialPort portName : portNames) { portList_jCombo.addItem(portName.getSystemPortName()); } }
From source file:namedatabasescraper.NameDatabaseScraper.java
public NameDatabaseScraper() throws Exception { NameDatabaseScraper.application = this; // First setup our logger this.checkSettingsDirExists(); logger.setLevel(Level.INFO);//from w ww. j ava2s.c om FileHandler fh = new FileHandler(this.settingsDirname + File.separator + "debug.log", 8096, 1, false); logger.addHandler(fh); SimpleFormatter formatter = new SimpleFormatter(); fh.setFormatter(formatter); logger.info("Starting NameDatabaseScraper"); // Load our properties and attach the database, creating it if it doesn't exist this.loadProperties(); this.attachDatabase(); // Create our GUI UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); window = new MainWindow(this); window.setLocationRelativeTo(null); window.setTitle("NameDatabaseScraper"); window.setVisible(true); }
From source file:de.atomfrede.tools.evalutation.ui.AppWindow.java
static void setLookAndFeel() { try {/* ww w .ja va 2 s. co m*/ // Set System L&F UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException e) { // handle exception } catch (ClassNotFoundException e) { // handle exception } catch (InstantiationException e) { // handle exception } catch (IllegalAccessException e) { // handle exception } }
From source file:OAT.ui.util.UiUtil.java
public static void useCrossPlatformLookAndFeel(Component object) { String laf;/*from w w w . ja v a2 s . c om*/ boolean useNative = false; if (useNative) { laf = UIManager.getSystemLookAndFeelClassName(); } else { laf = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(laf); SwingUtilities.updateComponentTreeUI(object); } catch (Exception e) { System.err.println("Couldn't use the " + laf + "look and feel: " + e); } }
From source file:de.fhg.igd.swingrcp.SwingRCPUtilities.java
/** * Setup Look and Feel to match SWT looks *//* w w w . j av a 2 s .c o m*/ public static void setupLookAndFeel() { if (!lafInitialized) { String laf; if (Platform.WS_GTK.equals(Platform.getWS())) { /* * Work-around for Eclipse Bug 341799 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=341799 * * A LookAndFeel other than the GTK look and feel has to be used * when using GTK as window managing system in SWT, as access to * GTK of ATW/Swing and SWT is not synchronized. */ laf = "javax.swing.plaf.metal.MetalLookAndFeel"; } else { laf = SwingRCPPlugin.getCustomLookAndFeel(); if (laf == null) { laf = UIManager.getSystemLookAndFeelClassName(); } } try { UIManager.setLookAndFeel(laf); log.info("Set look and feel to " + laf); } catch (Exception e) { log.error("Error setting look and feel: " + laf, e); } lafInitialized = true; } }
From source file:SynthApplication.java
private static void initLookAndFeel() { // String lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; SynthLookAndFeel lookAndFeel = new SynthLookAndFeel(); try {// w w w. j ava 2 s . c o m lookAndFeel.load(SynthApplication.class.getResourceAsStream(synthFile), SynthApplication.class); UIManager.setLookAndFeel(lookAndFeel); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } }
From source file:org.jahia.loganalyzer.internal.JahiaLogAnalyzerImpl.java
public static void initUI() { try {//from ww w . jav a 2s .c o m for (UIManager.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. try { UIManager.setLookAndFeel(new PlasticXPLookAndFeel()); } catch (Throwable t) { log.error("Error setting look and feel", t); } } }
From source file:net.mybox.mybox.ClientGUI.java
/** Creates new form ClientAWT */ public ClientGUI(String configFile) { // try to make the swing components look better try {/*www .jav a 2s .c om*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } this.setTitle("Mybox Preferences"); initComponents(); jTabbedPrefs.setSelectedIndex(1); // show the messages first client = new Client(); client.Config(configFile); client.clientGui = this; placeTrayIconAWT(); if (!debugMode) client.start(); this.setVisible(debugMode); }