Example usage for javax.swing UIManager getLookAndFeel

List of usage examples for javax.swing UIManager getLookAndFeel

Introduction

In this page you can find the example usage for javax.swing UIManager getLookAndFeel.

Prototype

public static LookAndFeel getLookAndFeel() 

Source Link

Document

Returns the current look and feel or null.

Usage

From source file:org.mbs3.juniuploader.gui.pnlSettings.java

private void initGUI() {
    try {/*from   ww w .  j av  a 2s  . 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.multibit.viewsystem.swing.action.ShowPreferencesSubmitAction.java

/**
 * Change preferences.//from   w ww . j  a  v  a2 s. co  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.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java

/** Builds and lays out the UI. */
private void buildGUI() {
    setLayout(new BorderLayout(0, 0));
    JPanel p = new JPanel();
    p.setBorder(null);/*from  ww  w .ja  va 2 s .c o m*/
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(buildQuotaPane());
    p.add(table);
    tabbedPane.add("Files to import", p);
    tabbedPane.add("Options", buildOptionsPane());

    double[][] tablePanelDesign = { { TableLayout.PREFERRED, 10, 5, TableLayout.FILL },
            { TableLayout.PREFERRED, TableLayout.FILL } };
    JPanel tablePanel = new JPanel(new TableLayout(tablePanelDesign));
    tablePanel.add(table.buildControls(), "0, 1, LEFT, CENTER");
    tablePanel.add(tabbedPane, "2, 1, 3, 1");
    int plugin = ImporterAgent.runAsPlugin();
    JSplitPane pane;
    if (plugin == LookupNames.IMAGE_J_IMPORT || plugin == LookupNames.IMAGE_J) {
        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
        JLabel label = UIUtilities.setTextFont("Select where to import the image(s).");
        panel.add(UIUtilities.buildComponentPanel(label));
        panel.add(locationDialog.getContentPane());
        pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel, tablePanel);
    } else {
        pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, chooser, tablePanel);
    }

    JPanel mainPanel = new JPanel();
    double[][] mainPanelDesign = { { TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.FILL } };
    mainPanel.setLayout(new TableLayout(mainPanelDesign));
    mainPanel.setBackground(UIUtilities.BACKGROUND);
    mainPanel.add(pane, "0, 1");

    this.add(mainPanel, BorderLayout.CENTER);

    JPanel controls = new JPanel();
    controls.setLayout(new BoxLayout(controls, BoxLayout.Y_AXIS));

    // Lays out the buttons.
    JPanel bar = new JPanel();
    bar.setLayout(new BoxLayout(bar, BoxLayout.X_AXIS));
    bar.add(buildToolBarLeft());
    bar.add(buildToolBarRight());
    controls.add(new JSeparator());
    controls.add(bar);

    add(controls, BorderLayout.SOUTH);
    if (JDialog.isDefaultLookAndFeelDecorated()) {
        boolean supportsWindowDecorations = UIManager.getLookAndFeel().getSupportsWindowDecorations();
        if (supportsWindowDecorations)
            getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG);
    }
}

From source file:org.pentaho.reporting.libraries.base.util.SystemInformation.java

public static Map<String, String> getOtherProperties() {
    final LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
    map.put("File.CurrentDirAbs", new File(".").getAbsolutePath());//NON-NLS
    try {/*  w  w  w.  ja v a  2 s.co  m*/
        map.put("File.CurrentDirCanonical", new File(".").getCanonicalPath());//NON-NLS
    } catch (IOException e) {
        // ignore 
    }
    map.put("UIManager.LookAndFeel", UIManager.getLookAndFeel().getClass().getName());//NON-NLS
    map.put("Toolkit", Toolkit.getDefaultToolkit().getClass().getName());//NON-NLS
    if (GraphicsEnvironment.isHeadless() == false) {
        map.put("Toolkit.MenuShortcutKeyMask", //NON-NLS
                String.valueOf(Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));//NON-NLS
        map.put("Toolkit.ScreenResolution", String.valueOf(Toolkit.getDefaultToolkit().getScreenResolution()));//NON-NLS
        map.put("Toolkit.ScreenSize", String.valueOf(Toolkit.getDefaultToolkit().getScreenSize()));//NON-NLS
    }
    map.put("Runtime.availableProcessors", String.valueOf(Runtime.getRuntime().availableProcessors()));//NON-NLS
    map.put("Runtime.maximumMemory", String.valueOf(Runtime.getRuntime().maxMemory()));//NON-NLS

    addDesktopProperty(map, "awt.mouse.numButtons");//NON-NLS
    addDesktopProperty(map, "awt.multiClickInterval");//NON-NLS
    addDesktopProperty(map, "DnD.Autoscroll.cursorHysteresis");//NON-NLS
    addDesktopProperty(map, "DnD.Autoscroll.initialDelay");//NON-NLS
    addDesktopProperty(map, "DnD.Autoscroll.interval");//NON-NLS
    addDesktopProperty(map, "DnD.Cursor.CopyDrop");//NON-NLS
    addDesktopProperty(map, "DnD.Cursor.CopyNoDrop");//NON-NLS
    addDesktopProperty(map, "DnD.Cursor.LinkDrop");//NON-NLS
    addDesktopProperty(map, "DnD.Cursor.LinkNoDrop");//NON-NLS
    addDesktopProperty(map, "DnD.Cursor.MoveDrop");//NON-NLS
    addDesktopProperty(map, "DnD.Cursor.MoveNoDrop");//NON-NLS
    addDesktopProperty(map, "DnD.gestureMotionThreshold");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/CanChangeAccels");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/CursorThemeName");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/CursorThemeSize");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/FileChooserBackend");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/FontName");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/IMPreeditStyle");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/IMStatusStyle");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/KeyThemeName");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/MenuBarAccel");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/MenuImages");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/ShowInputMethodMenu");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/ShowUnicodeMenu");//NON-NLS
    addDesktopProperty(map, "gnome.Gtk/ToolbarStyle");//NON-NLS
    addDesktopProperty(map, "gnome.Net/CursorBlink");//NON-NLS
    addDesktopProperty(map, "gnome.Net/CursorBlinkTime");//NON-NLS
    addDesktopProperty(map, "gnome.Net/DndDragThreshold");//NON-NLS
    addDesktopProperty(map, "gnome.Net/DoubleClickTime");//NON-NLS
    addDesktopProperty(map, "gnome.Net/FallbackIconTheme");//NON-NLS
    addDesktopProperty(map, "gnome.Net/IconThemeName");//NON-NLS
    addDesktopProperty(map, "gnome.Net/ThemeName");//NON-NLS
    addDesktopProperty(map, "gnome.Xft/Antialias");//NON-NLS
    addDesktopProperty(map, "gnome.Xft/DPI");//NON-NLS
    addDesktopProperty(map, "gnome.Xft/Hinting");//NON-NLS
    addDesktopProperty(map, "gnome.Xft/HintStyle");//NON-NLS
    addDesktopProperty(map, "gnome.Xft/RGBA");//NON-NLS
    addDesktopProperty(map, "Shell.shellFolderManager");//NON-NLS
    addDesktopProperty(map, "win.3d.backgroundColor");//NON-NLS
    addDesktopProperty(map, "win.3d.darkShadowColor");//NON-NLS
    addDesktopProperty(map, "win.3d.highlightColor");//NON-NLS
    addDesktopProperty(map, "win.3d.lightColor");//NON-NLS
    addDesktopProperty(map, "win.3d.shadowColor");//NON-NLS
    addDesktopProperty(map, "win.ansiFixed.font");//NON-NLS
    addDesktopProperty(map, "win.button.textColor");//NON-NLS
    addDesktopProperty(map, "win.defaultGUI.font");//NON-NLS
    addDesktopProperty(map, "win.frame.backgroundColor");//NON-NLS
    addDesktopProperty(map, "win.frame.textColor");//NON-NLS
    addDesktopProperty(map, "win.item.highlightColor");//NON-NLS
    addDesktopProperty(map, "win.item.highlightTextColor");//NON-NLS
    addDesktopProperty(map, "win.menu.backgroundColor");//NON-NLS
    addDesktopProperty(map, "win.menubar.backgroundColor");//NON-NLS
    addDesktopProperty(map, "win.menu.font");//NON-NLS
    addDesktopProperty(map, "win.menu.keyboardCuesOn");//NON-NLS
    addDesktopProperty(map, "win.menu.textColor");//NON-NLS
    addDesktopProperty(map, "win.scrollbar.backgroundColor");//NON-NLS
    addDesktopProperty(map, "win.scrollbar.width");//NON-NLS
    addDesktopProperty(map, "win.text.grayedTextColor");//NON-NLS
    addDesktopProperty(map, "win.xpstyle.colorName");//NON-NLS
    addDesktopProperty(map, "win.xpstyle.dllName");//NON-NLS
    addDesktopProperty(map, "win.xpstyle.sizeName");//NON-NLS
    addDesktopProperty(map, "win.xpstyle.themeActive");//NON-NLS
    return map;
}

From source file:org.pmedv.core.gui.ApplicationWindowAdvisorImpl.java

@Override
public void preWindowCreate() {

    log.info("initializing.");

    String laf = (String) Preferences.values.get("org.pmedv.blackboard.BoardDesignerPerspective.lookAndFeel");

    try {//from ww  w .  j  a  v  a 2 s  .c  om
        if (laf.equals("Nimbus")) {
            UIManager.setLookAndFeel(new NimbusLookAndFeel());
        } else if (laf.equals("SkyBlue")) {
            Plastic3DLookAndFeel.setPlasticTheme(new SkyBluer());
            UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
            com.jgoodies.looks.Options.setPopupDropShadowEnabled(true);
        } else {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
    } catch (Exception e2) {
        log.info("failed to set look and feel.");
    }

    final Color blackboardLightBlue = new Color(225, 234, 242);
    final Color blackBoardDarkBlue = new Color(182, 191, 205);
    final Color blackboardLightGrey = new Color(220, 220, 222);

    UIManager.put("TaskPane.titleBackgroundGradientStart", Color.WHITE);
    UIManager.put("TaskPane.titleBackgroundGradientEnd", blackboardLightBlue);
    UIManager.put("TaksPane.specialTitleBackground", blackboardLightBlue);
    UIManager.put("TaskPane.titleBackground", blackboardLightBlue);
    UIManager.put("TaskPane.borderColor", blackboardLightBlue);
    UIManager.put("TaskPane.background", blackboardLightGrey);
    UIManager.put("TaskPaneContainer.backgroundPainter", new MattePainter(blackBoardDarkBlue));

    log.info("setting look and feel to: " + UIManager.getLookAndFeel());

    // construct app icon

    Image iconImage = resources.getIcon("icon.application").getImage();

    MediaTracker mt = new MediaTracker(win);
    mt.addImage(iconImage, 0);

    try {
        mt.waitForAll();
    } catch (InterruptedException e) {
        // Silently ignore
    }

    InputStream is = getClass().getClassLoader().getResourceAsStream("application.properties");
    Properties properties = new Properties();
    try {
        properties.load(is);
    } catch (IOException e1) {
        properties.setProperty("version", "not set");
    }

    win.setTitle(windowConfig.getConfig().getTitle() + " Version " + properties.get("version"));
    win.setIconImage(iconImage);
    win.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    win.addWindowListener(win);

    ToolTipManager.sharedInstance().setInitialDelay(100);
    ToolTipManager.sharedInstance().setDismissDelay(1000);

}

From source file:org.rimudb.editor.swing.OkCancelPanel.java

/** 
 * Register the UI Delegate /*  w  w  w . jav  a 2  s  .c om*/
 */
protected ComponentUI registerUIDelegate() {
    ComponentUI compUI = null;

    Object obj = UIManager.get(uiClassID);
    if (obj == null) {
        // The default delegate class name
        Class basicDelegateClassName = org.rimudb.editor.swing.plaf.basic.BasicOkCancelPanelUI.class;
        String lafName = UIManager.getLookAndFeel().getID();

        // Look for a delegate for this LAF
        String packageName = basicDelegateClassName.getPackage().getName();
        int pos = packageName.indexOf("basic");
        String delegatePackageName = packageName.substring(0, pos);

        String lafDelegateClassName = delegatePackageName + lafName.toLowerCase() + "." + lafName
                + "OkCancelPanelUI";

        try {
            // Try the specific delegate
            compUI = (ComponentUI) (Class.forName(lafDelegateClassName)).newInstance();
        } catch (Exception e1) {
            try {
                // Default to the default delegate
                compUI = (ComponentUI) basicDelegateClassName.newInstance();
            } catch (Exception e2) {
                log.error("in OkCancelPanel.registerUIDelegate", e2);
            }
        }
    } else {
        compUI = (ComponentUI) obj;
    }
    return compUI;
}

From source file:org.stanwood.nwn2.gui.MainWindow.java

public static void main(String[] args) {
    LogSetupHelper.initLogingInternalConfigFile("info.log4j.properties");

    changeLookAndFeel(/*from   w ww.j ava 2s .  c  o m*/
            NWN2GuiSettings.getInstance().getLookAndFeel(UIManager.getLookAndFeel().getClass().getName()));

    MainWindow mainWindow = new MainWindow();
    mainWindow.setVisible(true);
}

From source file:org.tinymediamanager.ui.components.JNativeFileChooser.java

@Override
public void updateUI() {
    if (SystemUtils.IS_OS_WINDOWS) {
        // on windows set the native laf
        LookAndFeel old = UIManager.getLookAndFeel();
        try {/* w w  w .j a  v  a2s  . co m*/
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Throwable ex) {
            old = null;
        }

        super.updateUI();

        if (old != null) {
            try {
                UIManager.setLookAndFeel(old);
            } catch (Exception ignored) {
            } // shouldn't get here
        }
    } else {
        // on linux/mac as is
        super.updateUI();
    }
}

From source file:org.yccheok.jstock.gui.JStock.java

public void createLookAndFeelMenuItems() {
    LookAndFeel currentlaf = UIManager.getLookAndFeel();

    UIManager.LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();

    for (int i = 0; i < lafInfo.length; i++) {
        JMenuItem mi = (JRadioButtonMenuItem) jMenu4.add(new JRadioButtonMenuItem(lafInfo[i].getName()));
        buttonGroup1.add(mi);//from   w ww.j av  a  2 s  . c om
        mi.addActionListener(new ChangeLookAndFeelAction(this, lafInfo[i].getClassName()));

        if (currentlaf != null) {
            if (lafInfo[i].getClassName().equals(currentlaf.getClass().getName())) {
                ((JRadioButtonMenuItem) mi).setSelected(true);
            }
        }
    }

    // Always on Top
    jMenu4.addSeparator();
    this.alwaysOnTopMenuItem = jMenu4.add(new JCheckBoxMenuItem(GUIBundle.getString("MainFrame_AlwaysOnTop")));

    this.alwaysOnTopMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            AbstractButton aButton = (AbstractButton) e.getSource();
            boolean selected = aButton.getModel().isSelected();

            JStock.this._setAlwaysOnTop(selected);
        }
    });
}

From source file:org.yccheok.jstock.gui.MainFrame.java

public void createLookAndFeelMenuItem() {
    LookAndFeel currentlaf = UIManager.getLookAndFeel();

    UIManager.LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();

    for (int i = 0; i < lafInfo.length; i++) {
        JMenuItem mi = (JRadioButtonMenuItem) jMenu4.add(new JRadioButtonMenuItem(lafInfo[i].getName()));
        buttonGroup1.add(mi);/*www. j a  v a  2  s  .  c o m*/
        mi.addActionListener(new ChangeLookAndFeelAction(this, lafInfo[i].getClassName()));

        if (currentlaf != null) {
            if (lafInfo[i].getClassName().equals(currentlaf.getClass().getName())) {
                ((JRadioButtonMenuItem) mi).setSelected(true);
            }
        }
    }
}