Search in sources :

Example 11 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project JMRI by JMRI.

the class GuiLafPreferencesManager method applyLookAndFeel.

/**
     * Apply the existing look and feel.
     */
public void applyLookAndFeel() {
    String lafClassName = null;
    for (LookAndFeelInfo LAF : UIManager.getInstalledLookAndFeels()) {
        if (LAF.getName().equals(this.lookAndFeel)) {
            lafClassName = LAF.getClassName();
        }
    }
    log.debug("Look and feel selection \"{}\" ({})", this.lookAndFeel, lafClassName);
    if (lafClassName != null) {
        if (!lafClassName.equals(UIManager.getLookAndFeel().getClass().getName())) {
            log.debug("Apply look and feel \"{}\" ({})", this.lookAndFeel, lafClassName);
            try {
                UIManager.setLookAndFeel(lafClassName);
            } catch (ClassNotFoundException ex) {
                log.error("Could not find look and feel \"{}\".", this.lookAndFeel);
            } catch (IllegalAccessException | InstantiationException ex) {
                log.error("Could not load look and feel \"{}\".", this.lookAndFeel);
            } catch (UnsupportedLookAndFeelException ex) {
                log.error("Look and feel \"{}\" is not supported on this platform.", this.lookAndFeel);
            }
        } else {
            log.debug("Not updating look and feel {} matching existing look and feel" + lafClassName);
        }
    }
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException)

Example 12 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project jdk8u_jdk by JetBrains.

the class Test7024235 method main.

public static void main(String[] args) throws Exception {
    Test7024235 test = new Test7024235();
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        UIManager.setLookAndFeel(info.getClassName());
        test.test();
        toolkit.realSync();
        Thread.sleep(1000);
        test.test();
    }
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) SunToolkit(sun.awt.SunToolkit)

Example 13 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project mylizzie by aerisnju.

the class Lizzie method main.

/**
 * Launches the game window, and runs the game.
 */
public static void main(String[] args) throws IOException {
    // Cleanup for misc executor
    Runtime.getRuntime().addShutdownHook(new Thread(() -> ThreadPoolUtil.shutdownAndAwaitTermination(Lizzie.miscExecutor)));
    // Use Nimbus look and feel which looks better
    try {
        for (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.
    }
    leelaz = new Leelaz(optionSetting.getLeelazCommandLine());
    leelaz.ponder();
    board = new Board();
    frame = new LizzieFrame();
    analysisDialog = AnalysisFrame.createAnalysisDialog(frame);
    analysisFrame = (AnalysisFrame) analysisDialog.getContentPane();
    optionDialog = new OptionDialog(frame);
    optionDialog.setDialogSetting(optionSetting);
    winrateHistogramDialog = new WinrateHistogramDialog(frame);
    setGuiPosition();
    analysisDialog.setVisible(optionSetting.isAnalysisWindowShow());
    winrateHistogramDialog.setVisible(optionSetting.isWinrateHistogramWindowShow());
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) Leelaz(wagner.stephanie.lizzie.analysis.Leelaz)

Example 14 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project CCDD by nasa.

the class CcddPreferencesDialog method addLafTab.

/**
 ********************************************************************************************
 * Add the look & feel update tab to the tabbed pane
 ********************************************************************************************
 */
private void addLafTab() {
    // Set the initial layout manager characteristics
    GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(ModifiableSpacingInfo.LABEL_VERTICAL_SPACING.getSpacing(), ModifiableSpacingInfo.LABEL_HORIZONTAL_SPACING.getSpacing() / 2, ModifiableSpacingInfo.LABEL_VERTICAL_SPACING.getSpacing(), ModifiableSpacingInfo.LABEL_HORIZONTAL_SPACING.getSpacing() / 2), 0, 0);
    // Create a panel to contain the look & feel components
    JPanel lafPnl = new JPanel(new GridBagLayout());
    lafPnl.setBorder(emptyBorder);
    // Create an inner panel for component justification purposes
    JPanel innerPnl = new JPanel(new GridBagLayout());
    innerPnl.setBorder(emptyBorder);
    innerPnl.add(lafPnl, gbc);
    // Add an invisible component in order to force the look & feel selection panel to the left
    JLabel invisibleLbl = new JLabel("");
    gbc.weightx = 1.0;
    gbc.gridx++;
    innerPnl.add(invisibleLbl, gbc);
    // Use an outer panel so that the components can be forced to the top of the tab area
    JPanel outerPnl = new JPanel(new BorderLayout());
    outerPnl.setBorder(emptyBorder);
    outerPnl.add(innerPnl, BorderLayout.PAGE_START);
    // Add the look & feel selection tab to the tabbed pane
    tabbedPane.addTab(LAF, null, outerPnl, "Change program look & feel");
    // Obtain the list of available look & feels to use in creating the radio buttons
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
    // Check if any look & feels exist
    if (lafInfo.length != 0) {
        gbc.weightx = 0.0;
        gbc.gridx = 0;
        // Create storage for the look & feel descriptions
        String[][] lafDescriptions = new String[lafInfo.length][2];
        // Step through each look & feel
        for (int index = 0; index < lafInfo.length; index++) {
            // Store the look & feel name
            lafDescriptions[index][0] = lafInfo[index].getName();
        }
        // Create a panel containing a grid of radio buttons representing the look & feels from
        // which to choose
        addRadioButtons(ccddMain.getLookAndFeel(), true, lafDescriptions, null, "Select the application's 'look & feel'", lafPnl, gbc);
        // Add a listener for radio button selection change events
        addPropertyChangeListener(new PropertyChangeListener() {

            /**
             ********************************************************************************
             * Handle a radio button selection change event
             ********************************************************************************
             */
            @Override
            public void propertyChange(PropertyChangeEvent pce) {
                // Check if the event indicates a radio button selection change
                if (pce.getPropertyName().equals(RADIO_BUTTON_CHANGE_EVENT)) {
                    // Get the radio button selected
                    String buttonName = pce.getNewValue().toString();
                    // Check if the selected look & feel differs from the one currently in use
                    if (!ccddMain.getLookAndFeel().equals(buttonName)) {
                        // Save the selected look & feel name for storage in the program
                        // preferences backing store
                        ccddMain.setLookAndFeel(buttonName);
                        // Update the visible GUI components to the new look & feel
                        ccddMain.updateGUI(GUIUpdateType.LAF, new CcddDialogHandler[] { CcddPreferencesDialog.this });
                    }
                }
            }
        });
    }
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) PropertyChangeEvent(java.beans.PropertyChangeEvent) Insets(java.awt.Insets) LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) GridBagLayout(java.awt.GridBagLayout) PropertyChangeListener(java.beans.PropertyChangeListener) JLabel(javax.swing.JLabel) BorderLayout(java.awt.BorderLayout)

Example 15 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project freeplane by freeplane.

the class MModeController method createShowPreferencesAction.

public static ShowPreferencesAction createShowPreferencesAction(OptionPanelBuilder optionPanelBuilder) {
    final LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
    final Vector<String> lafNames = new Vector<String>(lafInfo.length + 1);
    final Vector<String> translatedLafNames = new Vector<String>(lafInfo.length + 1);
    lafNames.add("default");
    translatedLafNames.add(TextUtils.getOptionalText("OptionPanel.default"));
    for (int i = 0; i < lafInfo.length; i++) {
        final LookAndFeelInfo info = lafInfo[i];
        final String className = info.getClassName();
        lafNames.add(className);
        translatedLafNames.add(info.getName());
    }
    addCurrentLookAndFeelIfNecessary(lafNames, translatedLafNames);
    optionPanelBuilder.addEditableComboProperty("Appearance/look_and_feel/lookandfeel", LOOKANDFEEL_PROPERTY, lafNames, translatedLafNames, IndexedTree.AS_CHILD);
    return new ShowPreferencesAction(optionPanelBuilder.getRoot());
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) ShowPreferencesAction(org.freeplane.core.resources.components.ShowPreferencesAction) Vector(java.util.Vector)

Aggregations

LookAndFeelInfo (javax.swing.UIManager.LookAndFeelInfo)41 IOException (java.io.IOException)7 JPanel (javax.swing.JPanel)6 UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)6 Dimension (java.awt.Dimension)5 JFrame (javax.swing.JFrame)5 JLabel (javax.swing.JLabel)4 BorderLayout (java.awt.BorderLayout)3 File (java.io.File)3 JFileChooser (javax.swing.JFileChooser)3 Color (java.awt.Color)2 FlowLayout (java.awt.FlowLayout)2 GridLayout (java.awt.GridLayout)2 JButton (javax.swing.JButton)2 JTextField (javax.swing.JTextField)2 PropertiesPreferences (com.igormaznitsa.mindmap.swing.panel.utils.PropertiesPreferences)1 MessagesService (com.igormaznitsa.sciareto.notifications.MessagesService)1 PrinterPlugin (com.igormaznitsa.sciareto.plugins.services.PrinterPlugin)1 MainFrame (com.igormaznitsa.sciareto.ui.MainFrame)1 SplashScreen (com.igormaznitsa.sciareto.ui.UiUtils.SplashScreen)1