Example usage for javax.swing UIManager put

List of usage examples for javax.swing UIManager put

Introduction

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

Prototype

public static Object put(Object key, Object value) 

Source Link

Document

Stores an object in the developer defaults.

Usage

From source file:edu.ku.brc.ui.skin.SkinItem.java

/**
 * /*from w w  w . j a v  a  2  s.  c  o  m*/
 */
public void register() {
    if (getFont() != null) {
        UIManager.put(name + '.' + "font", new FontUIResource(font));
    }
    if (bgColor != null) {
        UIManager.put(name + '.' + "bgcolor", new ColorUIResource(bgColor));
    }
    if (fgColor != null) {
        UIManager.put(name + '.' + "fgcolor", new ColorUIResource(fgColor));
    }
    if (getBGImage() != null) {
        UIManager.put(name + '.' + "bgimage", bgImage);
    }
}

From source file:com.qspin.qtaste.ui.ConfigInfoPanel.java

public void init() {

    setLayout(new GridBagLayout());
    GridBagLineAdder adder = new GridBagLineAdder(this);
    adder.setWeight(1.0f, 0.0f);//from   w w  w. j  a  v  a  2 s  . c  om
    adder.setLength(6);

    //1st column - 1st row
    adder.setWeight(0.0, 0.0);
    adder.add(new JLabel("Test suite:"));
    adder.setWeight(1.0, 0.0);
    adder.add(mTestSuiteLabel);
    adder.setWeight(0.0, 0.0);

    //2d column - 1st row
    adder.add(new JLabel("Testbed config:"));
    // set the combobox as read only (not possible to modify the testbed from GUI at this time
    UIManager.put("ComboBox.disabledForeground", Color.BLACK);
    mTestbedList.setEnabled(true);
    adder.add(mTestbedList);

    // add testbed mouse listener, for the "Edit File" action
    TestbedMouseListener testbedMouseListener = new TestbedMouseListener();
    java.awt.Component[] mTestbedListComponents = mTestbedList.getComponents();
    for (int i = 0; i < mTestbedListComponents.length; i++) {
        mTestbedListComponents[i].addMouseListener(testbedMouseListener);
    }

    // go to second row
    adder.addSeparator();

    //1st column - 2d row
    adder.add(new JLabel("Test results directory:"));
    adder.add(mTestResultsLabel);

    //2d column - 2d row
    m_ignoreControlScript.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            TestEngine.setIgnoreControlScript(ignoreControlScript());
            setControlTestbedButtonsEnabled();

            GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
            guiConfiguration.setProperty(StaticConfiguration.IGNORE_CONTROL_SCRIPT_PROPERTY,
                    m_ignoreControlScript.isSelected());
            try {
                guiConfiguration.save();
            } catch (ConfigurationException ex) {
                logger.error("Error while saving GUI configuration: " + ex.getMessage());
            }
        }
    });
    adder.add(m_ignoreControlScript);
    JPanel sutPanel = new JPanel();
    JLabel sutVersion = new JLabel("SUT version: ");
    sutPanel.add(sutVersion);
    m_SUTVersion.setHorizontalAlignment(JTextField.RIGHT);
    m_SUTVersion.setPreferredSize(new Dimension(150, m_SUTVersion.getPreferredSize().height));
    sutPanel.add(m_SUTVersion);
    adder.add(sutPanel);
    m_SUTVersion.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            TestBedConfiguration.setSUTVersion(m_SUTVersion.getText());
        }
    });
    //create a 3d row
    adder.addSeparator();

    //1st column - 3d row
    adder.add(new JLabel("Reporting Format:"));
    adder.add(mTestReportingFormat);

    //2d column - 3d row
    // add a button to manually start the testbed
    m_startTestbed.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            isStartingOrStoppingTestbed = true;
            setControlTestbedButtonsEnabled();
            parent.getTestCasePanel().setStopButtonEnabled(true, true);
            parent.getTestCasePanel().showTestcaseResultsTab();
            TestBedConfiguration.setSUTVersion(getSUTVersion());
            new SUTStartStopThread("start").start();
        }
    });
    m_startTestbed.setEnabled(false);
    adder.add(m_startTestbed);

    // add a button to manually stop the testbed
    m_stopTestbed.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            isStartingOrStoppingTestbed = true;
            setControlTestbedButtonsEnabled();
            parent.getTestCasePanel().showTestcaseResultsTab();
            TestBedConfiguration.setSUTVersion(getSUTVersion());
            new SUTStartStopThread("stop").start();
        }
    });
    m_stopTestbed.setEnabled(false);
    adder.add(m_stopTestbed);

    DefaultComboBoxModel model = (DefaultComboBoxModel) mTestbedList.getModel();
    model.removeAllElements();
    String testbedDir = testbedConfig.getFile().getParent();
    File fTestbedDir = new File(testbedDir);
    FileMask fileMask = new FileMask();
    fileMask.addExtension("xml");
    File[] fTestbedList = FileUtilities.listSortedFiles(fTestbedDir, fileMask);
    for (int i = 0; i < fTestbedList.length; i++) {
        // remove the extension
        String testbedName = fTestbedList[i].getName().substring(0, fTestbedList[i].getName().lastIndexOf('.'));
        model.addElement(testbedName);
    }

    mTestbedList.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (mTestbedList.getSelectedItem() != null) {
                String selectedTestbed = (String) mTestbedList.getSelectedItem();
                String configFile = StaticConfiguration.TESTBED_CONFIG_DIRECTORY + "/" + selectedTestbed + "."
                        + StaticConfiguration.TESTBED_CONFIG_FILE_EXTENSION;
                TestBedConfiguration.setConfigFile(configFile);

                GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
                guiConfiguration.setProperty(StaticConfiguration.LAST_SELECTED_TESTBED_PROPERTY,
                        selectedTestbed);
                try {
                    guiConfiguration.save();
                } catch (ConfigurationException ex) {
                    logger.error("Error while saving GUI configuration: " + ex.getMessage());
                }
            }
            refreshData();
        }
    });

    refreshTestBed();
    refreshData();
    if (GUIConfiguration.getInstance().getBoolean(StaticConfiguration.IGNORE_CONTROL_SCRIPT_PROPERTY, false))
        m_ignoreControlScript.doClick();

    TestBedConfiguration
            .registerConfigurationChangeHandler(new TestBedConfiguration.ConfigurationChangeHandler() {

                public void onConfigurationChange() {
                    testbedConfig = TestBedConfiguration.getInstance();
                    String configFileName = testbedConfig.getFile().getName();
                    mTestbedList.getModel()
                            .setSelectedItem(configFileName.substring(0, configFileName.lastIndexOf('.')));
                }
            });
}

From source file:com.silverpeas.openoffice.windows.webdav.WebdavManager.java

/**
 * Get the ressource from the webdav server.
 *
 * @param uri the uri to the ressource.//  w  w w.ja v  a2 s. c  om
 * @param lockToken the current lock token.
 * @return the path to the saved file on the filesystem.
 * @throws IOException
 */
public String getFile(URI uri, String lockToken) throws IOException {
    GetMethod method = executeGetFile(uri);
    String fileName = uri.getPath();
    fileName = fileName.substring(fileName.lastIndexOf('/') + 1);
    fileName = URLDecoder.decode(fileName, "UTF-8");
    UIManager.put("ProgressMonitor.progressText", MessageUtil.getMessage("download.file.title"));
    ProgressMonitorInputStream is = new ProgressMonitorInputStream(null,
            MessageUtil.getMessage("downloading.remote.file") + ' ' + fileName,
            new BufferedInputStream(method.getResponseBodyAsStream()));
    fileName = fileName.replace(' ', '_');
    ProgressMonitor monitor = is.getProgressMonitor();
    monitor.setMaximum(new Long(method.getResponseContentLength()).intValue());
    monitor.setMillisToDecideToPopup(0);
    monitor.setMillisToPopup(0);
    File tempDir = new File(System.getProperty("java.io.tmpdir"), "silver-" + System.currentTimeMillis());
    tempDir.mkdirs();
    File tmpFile = new File(tempDir, fileName);
    FileOutputStream fos = new FileOutputStream(tmpFile);
    byte[] data = new byte[64];
    int c = 0;
    try {
        while ((c = is.read(data)) > -1) {
            fos.write(data, 0, c);
        }
    } catch (InterruptedIOException ioinex) {
        logger.log(Level.INFO, "{0} {1}",
                new Object[] { MessageUtil.getMessage("info.user.cancel"), ioinex.getMessage() });
        unlockFile(uri, lockToken);
        System.exit(0);
    } finally {
        fos.close();
    }
    return tmpFile.getAbsolutePath();
}

From source file:model.settings.ReadSettings.java

/**
 * checks whether program information on current workspace exist.
 * @return if workspace is now set.//from   ww w  . j  a  v a  2s  .c om
 */
public static String install() {
    boolean installed = false;
    String wsLocation = "";
    /*
     * does program root directory exist?
     */
    if (new File(PROGRAM_LOCATION).exists()) {

        //try to read 
        try {
            wsLocation = readFromFile(PROGRAM_SETTINGS_LOCATION);

            installed = new File(wsLocation).exists();
            if (!installed) {
                wsLocation = "";
            }

        } catch (FileNotFoundException e) {
            System.out.println("file not found " + e);
            showErrorMessage();
        } catch (IOException e) {
            System.out.println("io" + e);
            showErrorMessage();
        }
    }

    //if settings not found.
    if (!installed) {

        new File(PROGRAM_LOCATION).mkdir();
        try {

            //create new file chooser
            JFileChooser jc = new JFileChooser();

            //sets the text and language of all the components in JFileChooser
            UIManager.put("FileChooser.openDialogTitleText", "Open");
            UIManager.put("FileChooser.lookInLabelText", "LookIn");
            UIManager.put("FileChooser.openButtonText", "Open");
            UIManager.put("FileChooser.cancelButtonText", "Cancel");
            UIManager.put("FileChooser.fileNameLabelText", "FileName");
            UIManager.put("FileChooser.filesOfTypeLabelText", "TypeFiles");
            UIManager.put("FileChooser.openButtonToolTipText", "OpenSelectedFile");
            UIManager.put("FileChooser.cancelButtonToolTipText", "Cancel");
            UIManager.put("FileChooser.fileNameHeaderText", "FileName");
            UIManager.put("FileChooser.upFolderToolTipText", "UpOneLevel");
            UIManager.put("FileChooser.homeFolderToolTipText", "Desktop");
            UIManager.put("FileChooser.newFolderToolTipText", "CreateNewFolder");
            UIManager.put("FileChooser.listViewButtonToolTipText", "List");
            UIManager.put("FileChooser.newFolderButtonText", "CreateNewFolder");
            UIManager.put("FileChooser.renameFileButtonText", "RenameFile");
            UIManager.put("FileChooser.deleteFileButtonText", "DeleteFile");
            UIManager.put("FileChooser.filterLabelText", "TypeFiles");
            UIManager.put("FileChooser.detailsViewButtonToolTipText", "Details");
            UIManager.put("FileChooser.fileSizeHeaderText", "Size");
            UIManager.put("FileChooser.fileDateHeaderText", "DateModified");
            SwingUtilities.updateComponentTreeUI(jc);

            jc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            jc.setMultiSelectionEnabled(false);

            final String informationMsg = "Please select the workspace folder. \n"
                    + "By default, the new files are saved in there. \n\n"
                    + "Is changed simply by using the Save-As option.\n"
                    + "If no folder is specified, the default worspace folder \n"
                    + "is the home directory of the current user.";
            final int response = JOptionPane.showConfirmDialog(jc, informationMsg, "Select workspace folder",
                    JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE);

            final String defaultSaveLocation = System.getProperty("user.home")
                    + System.getProperty("file.separator");
            File f;
            if (response != JOptionPane.NO_OPTION) {

                //fetch selected file
                f = jc.getSelectedFile();
                jc.showDialog(null, "select");
            } else {
                f = new File(defaultSaveLocation);
            }

            printInformation();

            if (f == null) {
                f = new File(defaultSaveLocation);
            }
            //if file selected
            if (f != null) {

                //if the file exists
                if (f.exists()) {
                    writeToFile(PROGRAM_SETTINGS_LOCATION, ID_PROGRAM_LOCATION + "\n" + f.getAbsolutePath());
                } else {

                    //open message dialog
                    JOptionPane.showConfirmDialog(null, "Folder does " + "not exist",
                            "Error creating workspace", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
                            null);
                }

                //recall install
                return install();
            }

        } catch (IOException e) {
            System.out.println(e);
            JOptionPane.showConfirmDialog(null, "An exception occured." + " Try again later.",
                    "Error creating workspace", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null);
        }
    }

    if (System.getProperty("os.name").equals("Mac OS X")) {

        installOSX();
    } else if (System.getProperty("os.name").equals("Linux")) {
        installLinux();
    } else if (System.getProperty("os.name").equals("Windows")) {
        installWindows();
    }

    return wsLocation;

}

From source file:kr.ac.kaist.swrc.jhannanum.demo.GUIDemo.java

/**
 * Sets the GUI up and launch the demo.//from w w  w  . j  a v a 2  s .  c o m
 */
public void run() {
    ///////////////////////////////////////////////////////////////////
    // Basic setting for the mainFrame                                    
    ///////////////////////////////////////////////////////////////////
    mainFrame = new JFrame();

    Toolkit kit = mainFrame.getToolkit();
    Dimension windowSize = kit.getScreenSize();

    mainFrame.setBounds(windowSize.width / 20, windowSize.height / 20, windowSize.width * 18 / 20,
            windowSize.height * 18 / 20);
    mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    mainFrame.setTitle("HanNanum Korean Morphological Analyzer - A Plug-in Component based System (GUI Demo)");

    Font font = new Font("MonoSpaced", Font.PLAIN, 12);
    UIManager.put("TextArea.font", font);

    ///////////////////////////////////////////////////////////////////
    // Layout setting for the mainFrame                  
    ///////////////////////////////////////////////////////////////////
    mainFrame.setLayout(new BorderLayout());
    mainFrame.getContentPane().add(createPaneCenter(), BorderLayout.CENTER);
    mainFrame.getContentPane().add(createPaneNorth(), BorderLayout.NORTH);

    ///////////////////////////////////////////////////////////////////
    // Menu Setting                                 
    ///////////////////////////////////////////////////////////////////      
    menuBar = new JMenuBar();
    menuFile = new JMenu("File");
    menuItemFileOpen = new JMenuItem("Open", KeyEvent.VK_O);
    menuHelp = new JMenu("Help");
    menuItemHelp = new JMenuItem("Help", KeyEvent.VK_H);

    menuItemFileOpen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.ALT_MASK));
    menuItemHelp.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK));

    menuBar.add(menuFile);
    menuBar.add(menuHelp);
    menuFile.add(menuItemFileOpen);
    menuHelp.add(menuItemHelp);
    mainFrame.setJMenuBar(menuBar);

    ///////////////////////////////////////////////////////////////////
    // Event Handler Setting                                 
    ///////////////////////////////////////////////////////////////////
    menuItemFileOpen.addActionListener(new SharedActionHandler());
    menuItemHelp.addActionListener(new SharedActionHandler());
    buttonActivate.addActionListener(new SharedActionHandler());
    buttonAnalysis.addActionListener(new SharedActionHandler());
    buttonReset.addActionListener(new SharedActionHandler());
    radioMultiThread.addActionListener(new SharedActionHandler());
    radioSingleThread.addActionListener(new SharedActionHandler());

    listPluginMajor2.addMouseListener(new PluginListMouseListener(listPluginMajor2, listModelMajor2));
    listPluginMajor3.addMouseListener(new PluginListMouseListener(listPluginMajor3, listModelMajor3));
    listPluginSupplement1
            .addMouseListener(new PluginListMouseListener(listPluginSupplement1, listModelSupplement1));
    listPluginSupplement2
            .addMouseListener(new PluginListMouseListener(listPluginSupplement2, listModelSupplement2));
    listPluginSupplement3
            .addMouseListener(new PluginListMouseListener(listPluginSupplement3, listModelSupplement3));

    listPluginMajor2.setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE2, PluginInfo.MAJOR));
    listPluginMajor3.setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE3, PluginInfo.MAJOR));
    listPluginSupplement1
            .setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE1, PluginInfo.SUPPLEMENT));
    listPluginSupplement2
            .setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE2, PluginInfo.SUPPLEMENT));
    listPluginSupplement3
            .setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE3, PluginInfo.SUPPLEMENT));

    listPluginSupplement1.setDropMode(DropMode.ON_OR_INSERT);
    listPluginSupplement2.setDropMode(DropMode.ON_OR_INSERT);
    listPluginSupplement3.setDropMode(DropMode.ON_OR_INSERT);
    listPluginMajor2.setDropMode(DropMode.ON_OR_INSERT);
    listPluginMajor3.setDropMode(DropMode.ON_OR_INSERT);

    listPluginMajor2.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginMajor3.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginSupplement1.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginSupplement2.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginSupplement3.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    listPluginMajor2.setDragEnabled(true);
    listPluginMajor3.setDragEnabled(true);
    listPluginSupplement1.setDragEnabled(true);
    listPluginSupplement2.setDragEnabled(true);
    listPluginSupplement3.setDragEnabled(true);

    tree.setDragEnabled(true);
    tempPlugin = new PluginInfo("", 0, 0);

    workflow = new Workflow();

    // Show the main frame on the screen
    mainFrame.setVisible(true);

    for (int i = 0; i < tree.getRowCount(); i++) {
        tree.expandRow(i);
    }

    splitPaneTop.setDividerLocation(0.3);
    splitPaneBottom.setDividerLocation(0.5);
}

From source file:com.mirth.connect.client.ui.Mirth.java

public static void initUIManager() {
    try {//w ww.  j  a va  2  s .com
        PlasticLookAndFeel.setPlasticTheme(new MirthTheme());
        PlasticXPLookAndFeel look = new PlasticXPLookAndFeel();
        UIManager.setLookAndFeel(look);
        UIManager.put("win.xpstyle.name", "metallic");
        LookAndFeelAddons.setAddon(WindowsLookAndFeelAddons.class);

        /*
         * MIRTH-1225 and MIRTH-2019: Create alternate key bindings if CTRL is not the same as
         * the menu shortcut key (i.e. COMMAND on OSX)
         */
        if (InputEvent.CTRL_MASK != Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) {
            createAlternateKeyBindings();
        }

        if (SystemUtils.IS_OS_MAC) {
            OSXAdapter.setAboutHandler(Mirth.class, Mirth.class.getDeclaredMethod("aboutMac", (Class[]) null));
            OSXAdapter.setQuitHandler(Mirth.class, Mirth.class.getDeclaredMethod("quitMac", (Class[]) null));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    // keep the tooltips from disappearing
    ToolTipManager.sharedInstance().setDismissDelay(3600000);

    // TabbedPane defaults
    // UIManager.put("TabbedPane.selected", new Color(0xffffff));
    // UIManager.put("TabbedPane.background",new Color(225,225,225));
    // UIManager.put("TabbedPane.tabAreaBackground",new Color(225,225,225));
    UIManager.put("TabbedPane.highlight", new Color(225, 225, 225));
    UIManager.put("TabbedPane.selectHighlight", new Color(0xc3c3c3));
    UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(0, 0, 0, 0));

    // TaskPane defaults
    UIManager.put("TaskPane.titleBackgroundGradientStart", new Color(0xffffff));
    UIManager.put("TaskPane.titleBackgroundGradientEnd", new Color(0xffffff));

    // Set fonts
    UIManager.put("TextPane.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ToggleButton.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("Panel.font", UIConstants.DIALOG_FONT);
    UIManager.put("PopupMenu.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("OptionPane.font", UIConstants.DIALOG_FONT);
    UIManager.put("Label.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("Tree.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ScrollPane.font", UIConstants.DIALOG_FONT);
    UIManager.put("TextField.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("Viewport.font", UIConstants.DIALOG_FONT);
    UIManager.put("MenuBar.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("FormattedTextField.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("DesktopIcon.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("TableHeader.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ToolTip.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("PasswordField.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("TaskPane.font", UIConstants.TEXTFIELD_BOLD_FONT);
    UIManager.put("Table.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("TabbedPane.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ProgressBar.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("CheckBoxMenuItem.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ColorChooser.font", UIConstants.DIALOG_FONT);
    UIManager.put("Button.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("TextArea.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("Spinner.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("RadioButton.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("TitledBorder.font", UIConstants.TEXTFIELD_BOLD_FONT);
    UIManager.put("EditorPane.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("RadioButtonMenuItem.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ToolBar.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("MenuItem.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("CheckBox.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("JXTitledPanel.title.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("Menu.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ComboBox.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("JXLoginPanel.banner.font", UIConstants.BANNER_FONT);
    UIManager.put("List.font", UIConstants.TEXTFIELD_PLAIN_FONT);

    InputMap im = (InputMap) UIManager.get("Button.focusInputMap");
    im.put(KeyStroke.getKeyStroke("pressed ENTER"), "pressed");
    im.put(KeyStroke.getKeyStroke("released ENTER"), "released");

    try {
        UIManager.put("wizard.sidebar.image",
                ImageIO.read(com.mirth.connect.client.ui.Frame.class.getResource("images/wizardsidebar.png")));
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:edu.ku.brc.ui.skin.SkinItem.java

/**
 * //ww  w .  j  a va 2  s . com
 */
public void unregister() {
    String[] propNames = { "font", "bgcolor", "fgcolor", "bgimage" };
    for (String pn : propNames) {
        UIManager.put(name + '.' + pn, null);
    }
}

From source file:net.pms.newgui.LooksFrame.java

public static void initializeLookAndFeel() {
    synchronized (lookAndFeelInitializedLock) {
        if (lookAndFeelInitialized) {
            return;
        }/*  w  ww .  ja va  2 s  . c o m*/

        if (Platform.isWindows()) {
            try {
                UIManager.setLookAndFeel(WINDOWS_LNF);
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                    | UnsupportedLookAndFeelException e) {
                LOGGER.error("Error while setting Windows look and feel: ", e);
            }
        } else if (System.getProperty("nativelook") == null && !Platform.isMac()) {
            try {
                UIManager.setLookAndFeel(PLASTICXP_LNF);
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                    | UnsupportedLookAndFeelException e) {
                LOGGER.error("Error while setting Plastic XP look and feel: ", e);
            }
        } else {
            try {
                String systemClassName = UIManager.getSystemLookAndFeelClassName();
                // Workaround for Gnome
                try {
                    String gtkLAF = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
                    Class.forName(gtkLAF);

                    if (systemClassName.equals("javax.swing.plaf.metal.MetalLookAndFeel")) {
                        systemClassName = gtkLAF;
                    }
                } catch (ClassNotFoundException ce) {
                    LOGGER.error("Error loading GTK look and feel: ", ce);
                }

                LOGGER.trace("Choosing Java look and feel: " + systemClassName);
                UIManager.setLookAndFeel(systemClassName);
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                    | UnsupportedLookAndFeelException e1) {
                try {
                    UIManager.setLookAndFeel(PLASTICXP_LNF);
                } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                        | UnsupportedLookAndFeelException e) {
                    LOGGER.error("Error while setting Plastic XP look and feel: ", e);
                }
                LOGGER.error("Error while setting native look and feel: ", e1);
            }
        }

        if (isParticularLaFSet(UIManager.getLookAndFeel(), PLASTICXP_LNF)) {
            PlasticLookAndFeel.setPlasticTheme(PlasticLookAndFeel.createMyDefaultTheme());
            PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE);
            PlasticLookAndFeel.setHighContrastFocusColorsEnabled(false);
        } else if (isParticularLaFSet(UIManager.getLookAndFeel(), METAL_LNF)) {
            MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
        }

        // Work around caching in MetalRadioButtonUI
        JRadioButton radio = new JRadioButton();
        radio.getUI().uninstallUI(radio);
        JCheckBox checkBox = new JCheckBox();
        checkBox.getUI().uninstallUI(checkBox);

        // Workaround for JDK-8179014: JFileChooser with Windows look and feel crashes on win 10
        // https://bugs.openjdk.java.net/browse/JDK-8179014
        if (isParticularLaFSet(UIManager.getLookAndFeel(), WINDOWS_LNF)) {
            UIManager.put("FileChooser.useSystemExtensionHiding", false);
        }

        lookAndFeelInitialized = true;
    }
}

From source file:components.TableSelectionDemo.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//  w  ww . j  a  v a2 s.  co m
 */
private static void createAndShowGUI() {
    //Disable boldface controls.
    UIManager.put("swing.boldMetal", Boolean.FALSE);

    //Create and set up the window.
    JFrame frame = new JFrame("TableSelectionDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    TableSelectionDemo newContentPane = new TableSelectionDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:ffx.Main.java

/**
 * Start the Force Field X graphical user interface.
 *
 * @param commandLineFile//from   ww  w  .  ja v a2 s. c o m
 * @param argList
 */
private static void startGraphicalUserInterface(File commandLineFile, List<String> argList) {
    logger.info(String.format(" Process ID %d on %s.", procID, hostName));
    logger.info(String.format(" Starting up the graphical user interface."));

    /**
     * Some Mac OS X specific features that help FFX look native. These need
     * to be set before the MainPanel is created.
     */
    if (SystemUtils.IS_OS_MAC_OSX) {
        OSXAdapter.setOSXProperties();
    }

    /**
     * Set some Swing Constants.
     */

    UIManager.put("swing.boldMetal", Boolean.FALSE);
    setDefaultLookAndFeelDecorated(false);

    /**
     * Initialize the Main frame and Force Field X MainPanel.
     */
    Main m = new Main(commandLineFile, argList);
}