Search in sources :

Example 6 with LookAndFeel

use of javax.swing.LookAndFeel in project jdk8u_jdk by JetBrains.

the class XToolkit method initUIDefaults.

static void initUIDefaults() {
    try {
        // Load Defaults from MotifLookAndFeel
        // This dummy load is necessary to get SystemColor initialized. !!!!!!
        Color c = SystemColor.text;
        LookAndFeel lnf = new XAWTLookAndFeel();
        uidefaults = lnf.getDefaults();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : LookAndFeel(javax.swing.LookAndFeel) InvalidDnDOperationException(java.awt.dnd.InvalidDnDOperationException)

Example 7 with LookAndFeel

use of javax.swing.LookAndFeel in project pcgen by PCGen.

the class LookAndFeelManager method setSkinLAF.

private static void setSkinLAF() {
    try {
        //path += File.separator + selectedTheme;
        LookAndFeel laf = createSkinLAF(selectedTheme);
        UIManager.setLookAndFeel(laf);
        ConfigurationSettings.setSystemProperty("lookAndFeel", "Skinned");
        ConfigurationSettings.setSystemProperty("selectedThemePack", selectedTheme);
        currentTheme = selectedTheme;
        currentLAF = "Skinned";
    } catch (Exception ex) {
        if ("Skinned".equals(currentLAF)) {
            try {
                //fall back to old theme
                //path += File.separator + currentTheme;
                LookAndFeel laf = createSkinLAF(currentTheme);
                UIManager.setLookAndFeel(laf);
            } catch (Exception ex1) {
                setLookAndFeel("Java");
            }
        } else {
            setLookAndFeel(currentLAF);
        }
    }
}
Also used : LookAndFeel(javax.swing.LookAndFeel) SkinLookAndFeel(com.l2fprod.gui.plaf.skin.SkinLookAndFeel)

Example 8 with LookAndFeel

use of javax.swing.LookAndFeel in project adempiere by adempiere.

the class PLAFEditor method setLFSelection.

//  dynInit
/**
	 *  Set Picks From Environment
	 */
private void setLFSelection() {
    m_setting = true;
    //  Search for PLAF
    ValueNamePair plaf = null;
    LookAndFeel lookFeel = UIManager.getLookAndFeel();
    String look = lookFeel.getClass().getName();
    for (int i = 0; i < AdempierePLAF.getPLAFs().length; i++) {
        ValueNamePair vp = AdempierePLAF.getPLAFs()[i];
        if (vp.getValue().equals(look)) {
            plaf = vp;
            break;
        }
    }
    if (plaf != null)
        lfField.setSelectedItem(plaf);
    //  Search for Theme
    MetalTheme metalTheme = null;
    ValueNamePair theme = null;
    boolean metal = UIManager.getLookAndFeel() instanceof MetalLookAndFeel;
    themeField.setModel(new DefaultComboBoxModel(AdempierePLAF.getThemes()));
    if (metal) {
        theme = null;
        AppContext context = AppContext.getAppContext();
        metalTheme = (MetalTheme) context.get("currentMetalTheme");
        if (metalTheme != null) {
            String lookTheme = metalTheme.getName();
            for (int i = 0; i < AdempierePLAF.getThemes().length; i++) {
                ValueNamePair vp = AdempierePLAF.getThemes()[i];
                if (vp.getName().equals(lookTheme)) {
                    theme = vp;
                    break;
                }
            }
        }
        if (theme != null)
            themeField.setSelectedItem(theme);
    }
    m_setting = false;
    log.info(lookFeel + " - " + metalTheme);
}
Also used : MetalTheme(javax.swing.plaf.metal.MetalTheme) AppContext(sun.awt.AppContext) ValueNamePair(org.compiere.util.ValueNamePair) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) LookAndFeel(javax.swing.LookAndFeel) CompiereLookAndFeel(org.compiere.plaf.CompiereLookAndFeel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel)

Example 9 with LookAndFeel

use of javax.swing.LookAndFeel in project adempiere by adempiere.

the class PreviewPanel method lookAndFeelSelectionChanged.

/**
	 * Handle look and feel selection changed
	 * @param e
	 */
protected void lookAndFeelSelectionChanged(ListSelectionEvent e) {
    if (m_setting)
        return;
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    ValueNamePair laf = (ValueNamePair) lookList.getSelectedValue();
    LookAndFeel currentLaf = UIManager.getLookAndFeel();
    MetalTheme currentTheme = MetalLookAndFeel.getCurrentTheme();
    AdempierePLAF.setPLAF(laf, null, false);
    previewPanel.refresh(currentLaf, currentTheme);
    SwingUtilities.updateComponentTreeUI(previewPanel);
    updatePreviewComponents();
    setLFSelection();
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    this.repaint();
}
Also used : MetalTheme(javax.swing.plaf.metal.MetalTheme) ValueNamePair(org.compiere.util.ValueNamePair) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) LookAndFeel(javax.swing.LookAndFeel)

Example 10 with LookAndFeel

use of javax.swing.LookAndFeel in project adempiere by adempiere.

the class PreviewPanel method themeSelectionChanged.

/**
	 * Handle theme selection changed
	 * @param e
	 */
protected void themeSelectionChanged(ListSelectionEvent e) {
    if (m_setting)
        return;
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    ValueNamePair laf = (ValueNamePair) lookList.getSelectedValue();
    ValueNamePair theme = (ValueNamePair) themeList.getSelectedValue();
    LookAndFeel currentLaf = UIManager.getLookAndFeel();
    MetalTheme currentTheme = MetalLookAndFeel.getCurrentTheme();
    AdempierePLAF.setPLAF(laf, theme, false);
    previewPanel.refresh(currentLaf, currentTheme);
    SwingUtilities.updateComponentTreeUI(previewPanel);
    updatePreviewComponents();
    setLFSelection();
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    this.repaint();
}
Also used : MetalTheme(javax.swing.plaf.metal.MetalTheme) ValueNamePair(org.compiere.util.ValueNamePair) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) LookAndFeel(javax.swing.LookAndFeel)

Aggregations

LookAndFeel (javax.swing.LookAndFeel)15 MetalLookAndFeel (javax.swing.plaf.metal.MetalLookAndFeel)9 NimbusLookAndFeel (javax.swing.plaf.nimbus.NimbusLookAndFeel)5 SubstanceLookAndFeel (org.pushingpixels.substance.api.SubstanceLookAndFeel)5 Preferences (java.util.prefs.Preferences)4 MetalTheme (javax.swing.plaf.metal.MetalTheme)4 ValueNamePair (org.compiere.util.ValueNamePair)4 UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)3 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)2 JMenu (javax.swing.JMenu)2 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)2 AppContext (sun.awt.AppContext)2 PlasticLookAndFeel (com.jgoodies.looks.plastic.PlasticLookAndFeel)1 ExperienceBlue (com.jgoodies.looks.plastic.theme.ExperienceBlue)1 SkinLookAndFeel (com.l2fprod.gui.plaf.skin.SkinLookAndFeel)1 Color (java.awt.Color)1 InvalidDnDOperationException (java.awt.dnd.InvalidDnDOperationException)1 ArrayList (java.util.ArrayList)1 Icon (javax.swing.Icon)1 JTree (javax.swing.JTree)1