List of usage examples for javax.swing UIManager getInstalledLookAndFeels
public static LookAndFeelInfo[] getInstalledLookAndFeels()
From source file:org.languagetool.gui.Main.java
private JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu(getLabel("guiMenuFile")); fileMenu.setMnemonic(getMnemonic("guiMenuFile")); JMenu editMenu = new JMenu(getLabel("guiMenuEdit")); editMenu.setMnemonic(getMnemonic("guiMenuEdit")); JMenu grammarMenu = new JMenu(getLabel("guiMenuGrammar")); grammarMenu.setMnemonic(getMnemonic("guiMenuGrammar")); JMenu helpMenu = new JMenu(getLabel("guiMenuHelp")); helpMenu.setMnemonic(getMnemonic("guiMenuHelp")); fileMenu.add(openAction);//from ww w . j av a 2 s .co m fileMenu.add(saveAction); fileMenu.add(saveAsAction); recentFilesMenu = new JMenu(getLabel("guiMenuRecentFiles")); recentFilesMenu.setMnemonic(getMnemonic("guiMenuRecentFiles")); fileMenu.add(recentFilesMenu); updateRecentFilesMenu(); fileMenu.addSeparator(); fileMenu.add(new HideAction()); fileMenu.addSeparator(); fileMenu.add(new QuitAction()); grammarMenu.add(checkAction); JCheckBoxMenuItem item = new JCheckBoxMenuItem(autoCheckAction); grammarMenu.add(item); JCheckBoxMenuItem showResult = new JCheckBoxMenuItem(showResultAction); grammarMenu.add(showResult); grammarMenu.add(new CheckClipboardAction()); grammarMenu.add(new TagTextAction()); grammarMenu.add(new AddRulesAction()); grammarMenu.add(new OptionsAction()); grammarMenu.add(new SelectFontAction()); JMenu lafMenu = new JMenu(messages.getString("guiLookAndFeelMenu")); UIManager.LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels(); ButtonGroup buttonGroup = new ButtonGroup(); for (UIManager.LookAndFeelInfo laf : lafInfo) { if (!"Nimbus".equals(laf.getName())) { continue; } addLookAndFeelMenuItem(lafMenu, laf, buttonGroup); } for (UIManager.LookAndFeelInfo laf : lafInfo) { if ("Nimbus".equals(laf.getName())) { continue; } addLookAndFeelMenuItem(lafMenu, laf, buttonGroup); } grammarMenu.add(lafMenu); helpMenu.add(new AboutAction()); undoRedo.undoAction.putValue(Action.NAME, getLabel("guiMenuUndo")); undoRedo.undoAction.putValue(Action.MNEMONIC_KEY, getMnemonic("guiMenuUndo")); undoRedo.redoAction.putValue(Action.NAME, getLabel("guiMenuRedo")); undoRedo.redoAction.putValue(Action.MNEMONIC_KEY, getMnemonic("guiMenuRedo")); editMenu.add(undoRedo.undoAction); editMenu.add(undoRedo.redoAction); editMenu.addSeparator(); Action cutAction = new DefaultEditorKit.CutAction(); cutAction.putValue(Action.SMALL_ICON, getImageIcon("sc_cut.png")); cutAction.putValue(Action.LARGE_ICON_KEY, getImageIcon("lc_cut.png")); cutAction.putValue(Action.NAME, getLabel("guiMenuCut")); cutAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_T); editMenu.add(cutAction); Action copyAction = new DefaultEditorKit.CopyAction(); copyAction.putValue(Action.SMALL_ICON, getImageIcon("sc_copy.png")); copyAction.putValue(Action.LARGE_ICON_KEY, getImageIcon("lc_copy.png")); copyAction.putValue(Action.NAME, getLabel("guiMenuCopy")); copyAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_C); editMenu.add(copyAction); Action pasteAction = new DefaultEditorKit.PasteAction(); pasteAction.putValue(Action.SMALL_ICON, getImageIcon("sc_paste.png")); pasteAction.putValue(Action.LARGE_ICON_KEY, getImageIcon("lc_paste.png")); pasteAction.putValue(Action.NAME, getLabel("guiMenuPaste")); pasteAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_P); editMenu.add(pasteAction); editMenu.addSeparator(); editMenu.add(new SelectAllAction()); menuBar.add(fileMenu); menuBar.add(editMenu); menuBar.add(grammarMenu); menuBar.add(helpMenu); return menuBar; }
From source file:org.languagetool.gui.Main.java
private void setLookAndFeel() { String lookAndFeelName = null; String className = null;/*from w w w . j av a 2 s. c om*/ try { Configuration config = new Configuration(new File(System.getProperty("user.home")), LanguageToolSupport.CONFIG_FILE, null); if (config.getLookAndFeelName() != null) { lookAndFeelName = config.getLookAndFeelName(); } } catch (IOException ex) { // ignore } if (lookAndFeelName == null) { lookAndFeelName = "Nimbus"; // to use the system's look and feel: //lookAndFeelName = UIManager.getSystemLookAndFeelClassName(); } for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (lookAndFeelName.equals(info.getName())) { className = info.getClassName(); break; } } if (className != null) { try { UIManager.setLookAndFeel(className); } catch (Exception ignored) { // Well, what can we do... } } }
From source file:org.mbs3.juniuploader.gui.pnlSettings.java
private void initGUI() { try {/*from w w w. ja v a 2 s .c o m*/ GridBagLayout thisLayout = new GridBagLayout(); thisLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; thisLayout.rowHeights = new int[] { 11, 20, 18, 22, 22, 23, 23, 20, 18, 23, 22, 24, 6, 26, 4, 30, 8 }; thisLayout.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.1, 0.1, 0.1, 0.0, 0.1, 0.0 }; thisLayout.columnWidths = new int[] { 10, 106, 90, 20, 20, 7, 100, 20, 7 }; this.setLayout(thisLayout); this.setPreferredSize(new java.awt.Dimension(659, 349)); { { grpMain = new ButtonGroup(); } { grpGUI = new ButtonGroup(); } { grpObjects = new ButtonGroup(); } { grpHTTP = new ButtonGroup(); } { } { } lblGUI = new JLabel(); this.add(lblGUI, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblGUI.setText("Graphical Interface"); } { lblMain = new JLabel(); this.add(lblMain, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblMain.setText("Main Program"); } { lblObj = new JLabel(); this.add(lblObj, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblObj.setText("Object Messages"); } { lblLObj = new JLabel(); this.add(lblLObj, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblLObj.setText("HTTP Messages"); } { lblFatal = new JLabel(); this.add(lblFatal, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblFatal.setText("Fatal Messages"); } { lblError = new JLabel(); this.add(lblError, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblError.setText("Errors"); } { lblWarn = new JLabel(); this.add(lblWarn, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblWarn.setText("Warnings"); } { lblInfo = new JLabel(); this.add(lblInfo, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblInfo.setText("Info Messages"); } { lblDebug = new JLabel(); this.add(lblDebug, new GridBagConstraints(6, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblDebug.setText("Debug Messages"); } { lblTrace = new JLabel(); this.add(lblTrace, new GridBagConstraints(7, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblTrace.setText("Trace Execution"); } { btnMainFatal = new JRadioButton(); this.add(btnMainFatal, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } grpMain.add(btnMainFatal); btnMainFatal.setActionCommand("fatal"); btnMainFatal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); { btnMainError = new JRadioButton(); this.add(btnMainError, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpMain.add(btnMainError); btnMainError.setActionCommand("error"); btnMainError.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnMainWarn = new JRadioButton(); this.add(btnMainWarn, new GridBagConstraints(4, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpMain.add(btnMainWarn); btnMainWarn.setActionCommand("warn"); btnMainWarn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnMainInfo = new JRadioButton(); this.add(btnMainInfo, new GridBagConstraints(5, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpMain.add(btnMainInfo); btnMainInfo.setActionCommand("info"); btnMainInfo.setSelected(true); btnMainInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnMainDebug = new JRadioButton(); this.add(btnMainDebug, new GridBagConstraints(6, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpMain.add(btnMainDebug); btnMainDebug.setActionCommand("debug"); btnMainDebug.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnMainTrace = new JRadioButton(); this.add(btnMainTrace, new GridBagConstraints(7, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpMain.add(btnMainTrace); btnMainTrace.setActionCommand("trace"); btnMainTrace.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnGUIFatal = new JRadioButton(); this.add(btnGUIFatal, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpGUI.add(btnGUIFatal); btnGUIFatal.setActionCommand("fatal"); btnGUIFatal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnGUIError = new JRadioButton(); this.add(btnGUIError, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpGUI.add(btnGUIError); btnGUIError.setActionCommand("error"); btnGUIError.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnGUIWarn = new JRadioButton(); this.add(btnGUIWarn, new GridBagConstraints(4, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpGUI.add(btnGUIWarn); btnGUIWarn.setActionCommand("warn"); btnGUIWarn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnGUIInfo = new JRadioButton(); this.add(btnGUIInfo, new GridBagConstraints(5, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpGUI.add(btnGUIInfo); btnGUIInfo.setActionCommand("info"); btnGUIInfo.setSelected(true); btnGUIInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnGUIDebug = new JRadioButton(); this.add(btnGUIDebug, new GridBagConstraints(6, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpGUI.add(btnGUIDebug); btnGUIDebug.setActionCommand("debug"); btnGUIDebug.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnGUITrace = new JRadioButton(); this.add(btnGUITrace, new GridBagConstraints(7, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpGUI.add(btnGUITrace); btnGUITrace.setActionCommand("trace"); btnGUITrace.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnObjFatal = new JRadioButton(); this.add(btnObjFatal, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpObjects.add(btnObjFatal); btnObjFatal.setActionCommand("fatal"); btnObjFatal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnObjError = new JRadioButton(); this.add(btnObjError, new GridBagConstraints(3, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpObjects.add(btnObjError); btnObjError.setActionCommand("error"); btnObjError.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnObjWarn = new JRadioButton(); this.add(btnObjWarn, new GridBagConstraints(4, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpObjects.add(btnObjWarn); btnObjWarn.setActionCommand("warn"); btnObjWarn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnObjInfo = new JRadioButton(); this.add(btnObjInfo, new GridBagConstraints(5, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpObjects.add(btnObjInfo); btnObjInfo.setActionCommand("info"); btnObjInfo.setSelected(true); btnObjInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnObjDebug = new JRadioButton(); this.add(btnObjDebug, new GridBagConstraints(6, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpObjects.add(btnObjDebug); btnObjDebug.setActionCommand("debug"); btnObjDebug.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnObjTrace = new JRadioButton(); this.add(btnObjTrace, new GridBagConstraints(7, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpObjects.add(btnObjTrace); btnObjTrace.setActionCommand("trace"); btnObjTrace.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnHTTPFatal = new JRadioButton(); this.add(btnHTTPFatal, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpHTTP.add(btnHTTPFatal); btnHTTPFatal.setActionCommand("fatal"); btnHTTPFatal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnHTTPError = new JRadioButton(); this.add(btnHTTPError, new GridBagConstraints(3, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpHTTP.add(btnHTTPError); btnHTTPError.setActionCommand("error"); btnHTTPError.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnHTTPWarn = new JRadioButton(); this.add(btnHTTPWarn, new GridBagConstraints(4, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpHTTP.add(btnHTTPWarn); btnHTTPWarn.setActionCommand("warn"); btnHTTPWarn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnHTTPInfo = new JRadioButton(); this.add(btnHTTPInfo, new GridBagConstraints(5, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpHTTP.add(btnHTTPInfo); btnHTTPInfo.setActionCommand("info"); btnHTTPInfo.setSelected(true); btnHTTPInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnHTTPDebug = new JRadioButton(); this.add(btnHTTPDebug, new GridBagConstraints(6, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpHTTP.add(btnHTTPDebug); btnHTTPDebug.setActionCommand("debug"); btnHTTPDebug.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { btnHTTPTrace = new JRadioButton(); this.add(btnHTTPTrace, new GridBagConstraints(7, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grpHTTP.add(btnHTTPTrace); btnHTTPTrace.setActionCommand("trace"); btnHTTPTrace.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { logLevelBtnAction(evt); } }); } { lblLogLevel = new JLabel(); this.add(lblLogLevel, new GridBagConstraints(1, 1, 7, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); lblLogLevel.setText("Set the level of logging for different parts of this application:"); } { lblDeLF = new JLabel(); this.add(lblDeLF, new GridBagConstraints(1, 8, 6, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); lblDeLF.setText("Set the look and feel for the GUI of this application:"); } { LookAndFeelInfo[] lfs = UIManager.getInstalledLookAndFeels(); LookAndFeel lf = UIManager.getLookAndFeel(); DefaultComboBoxModel cmbLFModel = new DefaultComboBoxModel(); for (int i = 0; i < lfs.length; i++) { String n = lfs[i].getName(); cmbLFModel.addElement(n); if (lf.getName().equals(lfs[i].getName())) cmbLFModel.setSelectedItem(n); } cmbLF = new JComboBox(); this.add(cmbLF, new GridBagConstraints(1, 9, 6, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbLF.setModel(cmbLFModel); cmbLF.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) { cmbLFItemStateChanged(evt); } }); } { tfUserAgent = new JTextField(Util.getUserAgent()); this.add(tfUserAgent, new GridBagConstraints(1, 11, 6, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); tfUserAgent.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent evt) { tfUserAgentKeyReleased(evt); } }); } { lblUserAgent = new JLabel(); this.add(lblUserAgent, new GridBagConstraints(1, 10, 6, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); lblUserAgent.setText("User Agent"); } { btnExport = new JToggleButton(); this.add(btnExport, new GridBagConstraints(1, 15, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); btnExport.setText("Export All Settings and Data to File"); btnExport.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnExportActionPerformed(evt); } }); } { txtWarn = new JTextPane(); this.add(txtWarn, new GridBagConstraints(4, 15, 4, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtWarn.setText( "Note: This includes rules, form variables, sites, and ANYTHING else this program can remember from run to run."); txtWarn.setEditable(false); txtWarn.setBackground(new java.awt.Color(255, 255, 255)); txtWarn.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(0, 0, 0))); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.mbs3.juniuploader.gui.pnlSettings.java
private void cmbLFItemStateChanged(ItemEvent evt) { int sel = cmbLF.getSelectedIndex(); if (sel != -1) { // we have selected a new item LookAndFeelInfo[] lfs = UIManager.getInstalledLookAndFeels(); try {/* w w w . ja v a 2s .com*/ String lfClass = lfs[sel].getClassName(); UIManager.setLookAndFeel(lfClass); System.setProperty(Prefs.class.getName() + ".lookandfeelclassname", lfClass); SwingUtilities.updateComponentTreeUI(this.getParent()); } catch (Exception ex) { log.error("Error setting a new Look and Feel", ex); } } }
From source file:org.multibit.viewsystem.swing.action.ShowPreferencesSubmitAction.java
/** * Change preferences.// w w w . j a va2 s. c o m */ @Override public void actionPerformed(ActionEvent event) { // boolean feeValidationError = false; boolean wantToFireDataStructureChanged = false; try { if (mainFrame != null) { mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } // String updateStatusText = ""; if (dataProvider != null) { controller.getModel().setUserPreference(CoreModel.PREVIOUS_UNDO_CHANGES_TEXT, dataProvider.getPreviousUndoChangesText()); // String previousSendFee = dataProvider.getPreviousSendFee(); // String newSendFee = dataProvider.getNewSendFee(); // controller.getModel().setUserPreference(BitcoinModel.PREVIOUS_SEND_FEE, previousSendFee); // // // Check fee is set. // if (newSendFee == null || "".equals(newSendFee)) { // // Fee must be set validation error. // controller.getModel().setUserPreference(BitcoinModel.SEND_FEE, previousSendFee); // feeValidationError = true; // updateStatusText = controller.getLocaliser().getString("showPreferencesPanel.aFeeMustBeSet"); // } // // if (!feeValidationError) { // if (newSendFee.startsWith(ShowPreferencesPanel.UNPARSEABLE_FEE)) { // String newSendFeeTrimmed = newSendFee.substring(ShowPreferencesPanel.UNPARSEABLE_FEE.length() + 1); // // Recycle the old fee and set status message. // controller.getModel().setUserPreference(BitcoinModel.SEND_FEE, previousSendFee); // feeValidationError = true; // updateStatusText = controller.getLocaliser().getString("showPreferencesPanel.couldNotUnderstandFee", // new Object[] { newSendFeeTrimmed }); // } // } // // if (!feeValidationError) { // try { // // Check fee is a number. // BigInteger feeAsBigInteger = Utils.toNanoCoins(newSendFee); // // // Check fee is at least the minimum fee. // if (feeAsBigInteger.compareTo(BitcoinModel.SEND_MINIMUM_FEE) < 0) { // feeValidationError = true; // updateStatusText = controller.getLocaliser().getString( // "showPreferencesPanel.feeCannotBeSmallerThanMinimumFee"); // } else { // if (feeAsBigInteger.compareTo(BitcoinModel.SEND_MAXIMUM_FEE) >= 0) { // feeValidationError = true; // updateStatusText = controller.getLocaliser().getString( // "showPreferencesPanel.feeCannotBeGreaterThanMaximumFee"); // } else { // // Fee is ok. // controller.getModel().setUserPreference(BitcoinModel.SEND_FEE, newSendFee); // } // } // } catch (NumberFormatException nfe) { // // Recycle the old fee and set status message. // controller.getModel().setUserPreference(BitcoinModel.SEND_FEE, previousSendFee); // feeValidationError = true; // updateStatusText = controller.getLocaliser().getString("showPreferencesPanel.couldNotUnderstandFee", // new Object[] { newSendFee }); // } catch (ArithmeticException ae) { // // Recycle the old fee and set status message. // controller.getModel().setUserPreference(BitcoinModel.SEND_FEE, previousSendFee); // feeValidationError = true; // updateStatusText = controller.getLocaliser().getString("showPreferencesPanel.couldNotUnderstandFee", // new Object[] { newSendFee }); // } // } } // Disable language selection, uncomment to enable /* String previousLanguageCode = dataProvider.getPreviousUserLanguageCode(); String newLanguageCode = dataProvider.getNewUserLanguageCode(); controller.getModel().setUserPreference(CoreModel.PREVIOUS_USER_LANGUAGE_CODE, previousLanguageCode); if (previousLanguageCode != null && !previousLanguageCode.equals(newLanguageCode)) { // New language to set on model. controller.getModel().setUserPreference(CoreModel.USER_LANGUAGE_CODE, newLanguageCode); wantToFireDataStructureChanged = true; } */ // Open URI - use dialog. String openUriDialog = dataProvider.getOpenUriDialog(); if (openUriDialog != null) { controller.getModel().setUserPreference(BitcoinModel.OPEN_URI_SHOW_DIALOG, openUriDialog); } // Open URI - use URI. String openUriUseUri = dataProvider.getOpenUriUseUri(); if (openUriUseUri != null) { controller.getModel().setUserPreference(BitcoinModel.OPEN_URI_USE_URI, openUriUseUri); } // Messaging servers boolean messagingServersHasChanged = false; String[] previousMessagingServerURLs = dataProvider.getPreviousMessagingServerURLs(); String[] newMessagingServerURLs = dataProvider.getNewMessagingServerURLs(); // newMessagingServerURLs might be NULL, and thus clear out the user preference. // So let's be explicit and say if no urls are set, we use the default. if (newMessagingServerURLs == null) { newMessagingServerURLs = CoreModel.DEFAULT_MESSAGING_SERVER_URLS; // not URL encoded but is okay as no strange characters. } if (!Arrays.equals(previousMessagingServerURLs, newMessagingServerURLs)) { messagingServersHasChanged = true; String s = StringUtils.join(newMessagingServerURLs, "|"); controller.getModel().setUserPreference(CoreModel.MESSAGING_SERVERS, s); } // Font data. boolean fontHasChanged = false; String previousFontName = dataProvider.getPreviousFontName(); String newFontName = dataProvider.getNewFontName(); controller.getModel().setUserPreference(CoreModel.PREVIOUS_FONT_NAME, previousFontName); if (newFontName != null) { controller.getModel().setUserPreference(CoreModel.FONT_NAME, newFontName); if (!newFontName.equals(previousFontName)) { fontHasChanged = true; } } String previousFontStyle = dataProvider.getPreviousFontStyle(); String newFontStyle = dataProvider.getNewFontStyle(); controller.getModel().setUserPreference(CoreModel.PREVIOUS_FONT_STYLE, previousFontStyle); if (newFontStyle != null) { controller.getModel().setUserPreference(CoreModel.FONT_STYLE, newFontStyle); if (!newFontStyle.equals(previousFontStyle)) { fontHasChanged = true; } } String previousFontSize = dataProvider.getPreviousFontSize(); String newFontSize = dataProvider.getNewFontSize(); controller.getModel().setUserPreference(CoreModel.PREVIOUS_FONT_SIZE, previousFontSize); if (newFontSize != null) { controller.getModel().setUserPreference(CoreModel.FONT_SIZE, newFontSize); if (!newFontSize.equals(previousFontSize)) { fontHasChanged = true; } } // Look and feel. boolean lookAndFeelHasChanged = false; String previousLookAndFeel = dataProvider.getPreviousLookAndFeel(); String newLookAndFeel = dataProvider.getNewLookAndFeel(); controller.getModel().setUserPreference(CoreModel.LOOK_AND_FEEL, previousLookAndFeel); if (newLookAndFeel != null && (!newLookAndFeel.equals(previousLookAndFeel) && !newLookAndFeel.equals(UIManager.getLookAndFeel().getName()))) { controller.getModel().setUserPreference(CoreModel.LOOK_AND_FEEL, newLookAndFeel); lookAndFeelHasChanged = true; } /* // Currency ticker. boolean showTicker = dataProvider.getNewShowTicker(); boolean showBitcoinConvertedToFiat = dataProvider.getNewShowBitcoinConvertedToFiat(); boolean showCurrency = dataProvider.getNewShowCurrency(); boolean showRate = dataProvider.getNewShowRate(); boolean showBid = dataProvider.getNewShowBid(); boolean showAsk = dataProvider.getNewShowAsk(); boolean showExchange = dataProvider.getNewShowExchange(); boolean restartTickerTimer = false; if (dataProvider.getPreviousShowCurrency() != showCurrency) { wantToFireDataStructureChanged = true; restartTickerTimer = true; } else if (dataProvider.getPreviousShowBitcoinConvertedToFiat() != showBitcoinConvertedToFiat) { wantToFireDataStructureChanged = true; if (showBitcoinConvertedToFiat) { restartTickerTimer = true; } } else if (dataProvider.getPreviousShowTicker() != showTicker || showTicker != dataProvider.isTickerVisible()) { wantToFireDataStructureChanged = true; if (showTicker) { restartTickerTimer = true; } } else if (dataProvider.getPreviousShowRate() != showRate) { wantToFireDataStructureChanged = true; restartTickerTimer = true; } else if (dataProvider.getPreviousShowBid() != showBid) { wantToFireDataStructureChanged = true; restartTickerTimer = true; } else if (dataProvider.getPreviousShowAsk() != showAsk) { wantToFireDataStructureChanged = true; restartTickerTimer = true; } else if (dataProvider.getPreviousShowExchange() != showExchange) { wantToFireDataStructureChanged = true; restartTickerTimer = true; } controller.getModel().setUserPreference(ExchangeModel.TICKER_SHOW, Boolean.valueOf(showTicker).toString()); controller.getModel().setUserPreference(ExchangeModel.SHOW_BITCOIN_CONVERTED_TO_FIAT, Boolean.valueOf(showBitcoinConvertedToFiat).toString()); String columnsToShow = ""; if (showCurrency) columnsToShow = columnsToShow + " " + TickerTableModel.TICKER_COLUMN_CURRENCY; if (showRate) columnsToShow = columnsToShow + " " + TickerTableModel.TICKER_COLUMN_LAST_PRICE; if (showBid) columnsToShow = columnsToShow + " " + TickerTableModel.TICKER_COLUMN_BID; if (showAsk) columnsToShow = columnsToShow + " " + TickerTableModel.TICKER_COLUMN_ASK; if (showExchange) columnsToShow = columnsToShow + " " + TickerTableModel.TICKER_COLUMN_EXCHANGE; if ("".equals(columnsToShow)) { // A user could just switch all the columns off in the settings // so // put a 'none' in the list of columns // this is to stop the default columns appearing. columnsToShow = TickerTableModel.TICKER_COLUMN_NONE; } controller.getModel().setUserPreference(ExchangeModel.TICKER_COLUMNS_TO_SHOW, columnsToShow); String previousExchange1 = dataProvider.getPreviousExchange1(); String newExchange1 = dataProvider.getNewExchange1(); if (newExchange1 != null && !newExchange1.equals(previousExchange1)) { controller.getModel().setUserPreference(ExchangeModel.TICKER_FIRST_ROW_EXCHANGE, newExchange1); ExchangeData newExchangeData = new ExchangeData(); newExchangeData.setShortExchangeName(newExchange1); this.exchangeController.getModel().getShortExchangeNameToExchangeMap().put(newExchange1, newExchangeData); wantToFireDataStructureChanged = true; restartTickerTimer = true; } String previousCurrency1 = dataProvider.getPreviousCurrency1(); String newCurrency1 = dataProvider.getNewCurrency1(); if (newCurrency1 != null && !newCurrency1.equals(previousCurrency1)) { controller.getModel().setUserPreference(ExchangeModel.TICKER_FIRST_ROW_CURRENCY, newCurrency1); String newCurrencyCode = newCurrency1; if (ExchangeData.BITCOIN_CHARTS_EXCHANGE_NAME.equals(newExchange1)) { // Use only the last three characters - the currency code. if (newCurrency1.length() >= 3) { newCurrencyCode = newCurrency1.substring(newCurrency1.length() - 3); } } try { CurrencyConverter.INSTANCE.setCurrencyUnit(CurrencyUnit.of(newCurrencyCode)); } catch ( org.joda.money.IllegalCurrencyException e) { e.printStackTrace(); } wantToFireDataStructureChanged = true; restartTickerTimer = true; } String previousShowSecondRow = Boolean.valueOf(dataProvider.getPreviousShowSecondRow()).toString(); String newShowSecondRow = Boolean.valueOf(dataProvider.getNewShowSecondRow()).toString(); if (newShowSecondRow != null && !newShowSecondRow.equals(previousShowSecondRow)) { // New show second row is set on model. controller.getModel().setUserPreference(ExchangeModel.TICKER_SHOW_SECOND_ROW, newShowSecondRow); wantToFireDataStructureChanged = true; restartTickerTimer = true; } String previousExchange2 = dataProvider.getPreviousExchange2(); String newExchange2 = dataProvider.getNewExchange2(); if (newExchange2 != null && !newExchange2.equals(previousExchange2)) { controller.getModel().setUserPreference(ExchangeModel.TICKER_SECOND_ROW_EXCHANGE, newExchange2); ExchangeData newExchangeData = new ExchangeData(); newExchangeData.setShortExchangeName(newExchange2); this.exchangeController.getModel().getShortExchangeNameToExchangeMap().put(newExchange2, newExchangeData); wantToFireDataStructureChanged = true; restartTickerTimer = true; } String previousCurrency2 = dataProvider.getPreviousCurrency2(); String newCurrency2 = dataProvider.getNewCurrency2(); if (newCurrency2 != null && !newCurrency2.equals(previousCurrency2)) { controller.getModel().setUserPreference(ExchangeModel.TICKER_SECOND_ROW_CURRENCY, newCurrency2); wantToFireDataStructureChanged = true; restartTickerTimer = true; } String previousOerApicode = dataProvider.getPreviousOpenExchangeRatesApiCode(); String newOerApiCode = dataProvider.getNewOpenExchangeRatesApiCode(); if (newOerApiCode != null && !newOerApiCode.equals(previousOerApicode)) { wantToFireDataStructureChanged = true; restartTickerTimer = true; controller.getModel().setUserPreference(ExchangeModel.OPEN_EXCHANGE_RATES_API_CODE, newOerApiCode); } */ // Can undo. controller.getModel().setUserPreference(CoreModel.CAN_UNDO_PREFERENCES_CHANGES, "true"); /* if (restartTickerTimer) { // Reinitialise the currency converter. CurrencyConverter.INSTANCE.initialise(controller); // Cancel any existing timer. if (mainFrame.getTickerTimer1() != null) { mainFrame.getTickerTimer1().cancel(); } if (mainFrame.getTickerTimer2() != null) { mainFrame.getTickerTimer2().cancel(); } // Start ticker timer. Timer tickerTimer1 = new Timer(); mainFrame.setTickerTimer1(tickerTimer1); TickerTimerTask tickerTimerTask1 = new TickerTimerTask(this.exchangeController, mainFrame, true); tickerTimerTask1.createExchangeObjects(controller.getModel().getUserPreference(ExchangeModel.TICKER_FIRST_ROW_EXCHANGE)); mainFrame.setTickerTimerTask1(tickerTimerTask1); tickerTimer1.schedule(tickerTimerTask1, 0, TickerTimerTask.DEFAULT_REPEAT_RATE); boolean showSecondRow = Boolean.TRUE.toString().equals( controller.getModel().getUserPreference(ExchangeModel.TICKER_SHOW_SECOND_ROW)); if (showSecondRow) { Timer tickerTimer2 = new Timer(); mainFrame.setTickerTimer2(tickerTimer2); TickerTimerTask tickerTimerTask2 = new TickerTimerTask(this.exchangeController, mainFrame, false); tickerTimerTask2.createExchangeObjects(controller.getModel().getUserPreference( ExchangeModel.TICKER_SECOND_ROW_EXCHANGE)); mainFrame.setTickerTimerTask2(tickerTimerTask2); tickerTimer2.schedule(tickerTimerTask2, TickerTimerTask.TASK_SEPARATION, TickerTimerTask.DEFAULT_REPEAT_RATE); } } */ if (messagingServersHasChanged) { // TODO: Maybe something here so messaging servers are updated and go live immediately? // Currently servers are set here in class SendRequest: /* public void setMessage(CoinSparkMessagePart [] MessageParts,String [] DeliveryServers) */ } if (fontHasChanged) { wantToFireDataStructureChanged = true; } if (lookAndFeelHasChanged) { try { if (CoreModel.SYSTEM_LOOK_AND_FEEL.equals(newLookAndFeel)) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } else { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (newLookAndFeel.equalsIgnoreCase(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } } Font newFont = dataProvider.getSelectedFont(); if (newFont != null) { UIManager.put("ToolTip.font", newFont); } if (wantToFireDataStructureChanged || lookAndFeelHasChanged) { ColorAndFontConstants.init(); FontSizer.INSTANCE.initialise(controller); HelpContentsPanel.clearBrowser(); // Switch off blinks. this.bitcoinController.getModel().setBlinkEnabled(false); try { controller.fireDataStructureChanged(); SwingUtilities.updateComponentTreeUI(mainFrame); } finally { // Switch blinks back on. this.bitcoinController.getModel().setBlinkEnabled(true); } } } finally { if (mainFrame != null) { mainFrame.setCursor(Cursor.getDefaultCursor()); } } }
From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java
private JPanel createAppearancePanel(int stentWidth) { MultiBitTitledPanel appearancePanel = new MultiBitTitledPanel( controller.getLocaliser().getString("showPreferencesPanel.appearanceTitle"), ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 0;/* w w w . ja va2 s. c o m*/ constraints.gridy = 3; constraints.weightx = 0.1; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.LINE_START; JPanel indent = MultiBitTitledPanel.getIndentPanel(1); appearancePanel.add(indent, constraints); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 1; constraints.gridy = 4; constraints.weightx = 0.3; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; JPanel stent = MultiBitTitledPanel.createStent(stentWidth); appearancePanel.add(stent, constraints); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 2; constraints.gridy = 3; constraints.weightx = 0.05; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.CENTER; appearancePanel.add( MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS), constraints); MultiBitLabel fontNameLabel = new MultiBitLabel( controller.getLocaliser().getString("fontChooser.fontName")); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 4; constraints.weightx = 0.3; constraints.weighty = 1; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_END; appearancePanel.add(fontNameLabel, constraints); fontNameTextLabel = new MultiBitLabel(""); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 3; constraints.gridy = 4; constraints.weightx = 0.3; constraints.weighty = 1; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; appearancePanel.add(fontNameTextLabel, constraints); MultiBitLabel fontStyleLabel = new MultiBitLabel( controller.getLocaliser().getString("fontChooser.fontStyle")); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 5; constraints.weightx = 0.3; constraints.weighty = 1; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_END; appearancePanel.add(fontStyleLabel, constraints); fontStyleTextLabel = new MultiBitLabel(""); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 3; constraints.gridy = 5; constraints.weightx = 0.3; constraints.weighty = 1; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; appearancePanel.add(fontStyleTextLabel, constraints); MultiBitLabel fontSizeLabel = new MultiBitLabel( controller.getLocaliser().getString("fontChooser.fontSize")); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 6; constraints.weightx = 0.3; constraints.weighty = 1; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_END; appearancePanel.add(fontSizeLabel, constraints); fontSizeTextLabel = new MultiBitLabel(""); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 3; constraints.gridy = 6; constraints.weightx = 0.3; constraints.weighty = 1; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; appearancePanel.add(fontSizeTextLabel, constraints); ChooseFontAction chooseFontAction = new ChooseFontAction(controller, this, null); MultiBitButton fontChooserButton = new MultiBitButton(chooseFontAction, controller); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 3; constraints.gridy = 7; constraints.weightx = 1; constraints.weighty = 1; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; appearancePanel.add(fontChooserButton, constraints); constraints.fill = GridBagConstraints.VERTICAL; constraints.gridx = 4; constraints.gridy = 8; constraints.weightx = 0.2; constraints.weighty = 0.3; constraints.gridwidth = 3; constraints.anchor = GridBagConstraints.LINE_START; appearancePanel.add(MultiBitTitledPanel.createStent(1, 30), constraints); MultiBitLabel lookAndFeelLabel = new MultiBitLabel( controller.getLocaliser().getString("showPreferencesPanel.lookAndFeel")); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 9; constraints.weightx = 0.3; constraints.weighty = 1; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_END; appearancePanel.add(lookAndFeelLabel, constraints); originalLookAndFeel = controller.getModel().getUserPreference(CoreModel.LOOK_AND_FEEL); LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels(); lookAndFeelComboBox = new JComboBox(); lookAndFeelComboBox.addItem(localisedSystemLookAndFeelName); if (lookAndFeels != null) { for (LookAndFeelInfo info : lookAndFeels) { lookAndFeelComboBox.addItem(info.getName()); if (info.getName().equalsIgnoreCase(originalLookAndFeel)) { lookAndFeelComboBox.setSelectedItem(info.getName()); } } } if (originalLookAndFeel == null || originalLookAndFeel.equals("") || CoreModel.SYSTEM_LOOK_AND_FEEL.equalsIgnoreCase(originalLookAndFeel)) { lookAndFeelComboBox.setSelectedItem(localisedSystemLookAndFeelName); } lookAndFeelComboBox.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont()); lookAndFeelComboBox.setOpaque(false); FontMetrics fontMetrics = getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont()); int textWidth = Math.max(fontMetrics.stringWidth("CDE/Motif"), fontMetrics.stringWidth("Windows classic")); Dimension preferredSize = new Dimension(textWidth + TICKER_COMBO_WIDTH_DELTA, fontMetrics.getHeight() + EXCHANGE_COMBO_HEIGHT_DELTA); lookAndFeelComboBox.setPreferredSize(preferredSize); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 3; constraints.gridy = 9; constraints.weightx = 0.8; constraints.weighty = 0.6; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; appearancePanel.add(lookAndFeelComboBox, constraints); JPanel fill1 = new JPanel(); fill1.setOpaque(false); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 4; constraints.gridy = 10; constraints.weightx = 20; constraints.weighty = 1; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_END; appearancePanel.add(fill1, constraints); return appearancePanel; }
From source file:org.notebook.gui.widget.LookAndFeelSelector.java
/** * Sets the list of skins.//from ww w. j a v a 2 s . co m * * @return the map< string, string> */ private Map<String, String> setListOfSkins() { Map<String, String> result = new HashMap<String, String>(); /* * toned down skins */ result.put("BusinessBlackSteel", "org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel"); result.put("Creme", "org.jvnet.substance.skin.SubstanceCremeLookAndFeel"); result.put("Business", "org.jvnet.substance.skin.SubstanceBusinessLookAndFeel"); result.put("BusinessBlueSteel", "org.jvnet.substance.skin.SubstanceBusinessBlueSteelLookAndFeel"); result.put("CremeCoffee", "org.jvnet.substance.skin.SubstanceCremeCoffeeLookAndFeel"); result.put("Sahara", "org.jvnet.substance.skin.SubstanceSaharaLookAndFeel"); result.put("Moderate", "org.jvnet.substance.skin.SubstanceModerateLookAndFeel"); result.put("OfficeSilver2007", "org.jvnet.substance.skin.SubstanceOfficeSilver2007LookAndFeel"); result.put("Nebula", "org.jvnet.substance.skin.SubstanceNebulaLookAndFeel"); result.put("NebulaBrickWall", "org.jvnet.substance.skin.SubstanceNebulaBrickWallLookAndFeel"); result.put("Autumn", "org.jvnet.substance.skin.SubstanceAutumnLookAndFeel"); result.put("MistSilver", "org.jvnet.substance.skin.SubstanceMistSilverLookAndFeel"); result.put("MistAqua", "org.jvnet.substance.skin.SubstanceMistAquaLookAndFeel"); /* * dark skins */ result.put("RavenGraphite", "org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel"); result.put("RavenGraphiteGlass", "org.jvnet.substance.skin.SubstanceRavenGraphiteGlassLookAndFeel"); result.put("Raven", "org.jvnet.substance.skin.SubstanceRavenLookAndFeel"); result.put("Magma", "org.jvnet.substance.skin.SubstanceMagmaLookAndFeel"); result.put("ChallengerDeep", "org.jvnet.substance.skin.SubstanceChallengerDeepLookAndFeel"); result.put("EmeraldDusk", "org.jvnet.substance.skin.SubstanceEmeraldDuskLookAndFeel"); /* * satured skins */ result.put("OfficeBlue2007", "org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel"); /* * custom skins result.put("aTunes Blue", "com.wateray.ipassbook.ui.substance.SubstanceATunesBlueLookAndFeel"); result.put("aTunes Dark", "com.wateray.ipassbook.ui.substance.SubstanceATunesDarkLookAndFeel"); result.put("aTunes Gray", "com.wateray.ipassbook.ui.substance.SubstanceATunesGrayLookAndFeel"); */ for (LookAndFeelInfo lf : UIManager.getInstalledLookAndFeels()) { result.put(lf.getName(), lf.getClassName()); } return result; }
From source file:org.notebook.gui.widget.LookAndFeelSelector.java
/** * *///w w w.j ava 2 s . c o m public static boolean isDefaultLookAndFeel(String theme) { boolean defaultLF = false; for (LookAndFeelInfo lf : UIManager.getInstalledLookAndFeels()) { // not default lookAndFeel if (theme.equals(lf.getName())) { defaultLF = true; } } return defaultLF; }
From source file:org.parosproxy.paros.Andiparos.java
/** * Initialization without dependence on any data model nor view creation. * /* w w w . j av a 2 s.c o m*/ * @param args */ private void init(String[] args) { try { cmdLine = new CommandLine(args); } catch (Exception e) { System.out.println(CommandLine.getHelpGeneral()); System.exit(1); } Locale.setDefault(Locale.ENGLISH); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } // Andiparos: Use Nimbus if it is enforced and installed if (Constant.useNimbus) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (UnsupportedLookAndFeelException e) { // handle exception } catch (ClassNotFoundException e) { // handle exception } catch (InstantiationException e) { // handle exception } catch (IllegalAccessException e) { // handle exception } } }
From source file:org.rvsnoop.ui.RvSnoopApplication.java
private void configureLookAndFeel() { try {//ww w. ja v a2 s .c o m if (AppHelper.getPlatform() == PlatformType.OS_X) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } else { 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. } }