Java 类javax.swing.plaf.metal.OceanTheme 实例源码
项目:somado
文件:GUI.java
/**
* Statyczna metoda ustawiająca temat(Ocean) LookAndFeel
*/
public static void setLookAndFeel() {
MetalLookAndFeel.setCurrentTheme(new OceanTheme());
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
}
catch(Exception e) {
System.err.println(e);
}
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
项目:swingx
文件:TaskPaneAddon.java
@Override
protected void addMetalDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addMetalDefaults(addon, defaults);
if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme) {
defaults.add(JXTaskPane.uiClassID, "org.jdesktop.swingx.plaf.misc.GlossyTaskPaneUI");
} else {
defaults.add(JXTaskPane.uiClassID, "org.jdesktop.swingx.plaf.metal.MetalTaskPaneUI");
}
//TODO use safe methods
defaults.add("TaskPane.foreground", UIManager.getColor("activeCaptionText"));
defaults.add("TaskPane.background", MetalLookAndFeel.getControl());
defaults.add("TaskPane.specialTitleBackground", MetalLookAndFeel.getPrimaryControl());
defaults.add("TaskPane.titleBackgroundGradientStart", MetalLookAndFeel.getPrimaryControl());
defaults.add("TaskPane.titleBackgroundGradientEnd", MetalLookAndFeel.getPrimaryControlHighlight());
defaults.add("TaskPane.titleForeground", MetalLookAndFeel.getControlTextColor());
defaults.add("TaskPane.specialTitleForeground", MetalLookAndFeel.getControlTextColor());
defaults.add("TaskPane.borderColor", MetalLookAndFeel.getPrimaryControl());
defaults.add("TaskPane.titleOver", new ColorUIResource(MetalLookAndFeel.getControl().darker()));
defaults.add("TaskPane.specialTitleOver", MetalLookAndFeel.getPrimaryControlHighlight());
}
项目:aibench-project
文件:TaskPaneAddon.java
@Override
protected void addMetalDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addMetalDefaults(addon, defaults);
if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme) {
defaults.add(JXTaskPane.uiClassID, "org.jdesktop.swingx.plaf.misc.GlossyTaskPaneUI");
} else {
defaults.add(JXTaskPane.uiClassID, "org.jdesktop.swingx.plaf.metal.MetalTaskPaneUI");
}
//TODO use safe methods
defaults.add("TaskPane.foreground", UIManager.getColor("activeCaptionText"));
defaults.add("TaskPane.background", MetalLookAndFeel.getControl());
defaults.add("TaskPane.specialTitleBackground", MetalLookAndFeel.getPrimaryControl());
defaults.add("TaskPane.titleBackgroundGradientStart", MetalLookAndFeel.getPrimaryControl());
defaults.add("TaskPane.titleBackgroundGradientEnd", MetalLookAndFeel.getPrimaryControlHighlight());
defaults.add("TaskPane.titleForeground", MetalLookAndFeel.getControlTextColor());
defaults.add("TaskPane.specialTitleForeground", MetalLookAndFeel.getControlTextColor());
defaults.add("TaskPane.borderColor", MetalLookAndFeel.getPrimaryControl());
defaults.add("TaskPane.titleOver", new ColorUIResource(MetalLookAndFeel.getControl().darker()));
defaults.add("TaskPane.specialTitleOver", MetalLookAndFeel.getPrimaryControlHighlight());
}
项目:Argent
文件:VisualEditorRoot.java
public void updateLookAndFeel(String canonicalName) {
SwingUtilities.invokeLater(() -> {
try {
if(canonicalName.equalsIgnoreCase(MetalLookAndFeel.class.getCanonicalName()))
MetalLookAndFeel.setCurrentTheme(new OceanTheme());
UIManager.setLookAndFeel(canonicalName);
SwingUtilities.updateComponentTreeUI(frame);
} catch (ClassNotFoundException | InstantiationException | UnsupportedLookAndFeelException | IllegalAccessException e) {
e.printStackTrace();
}
});
}
项目:swingx
文件:UIColorHighlighterAddon.java
/**
* {@inheritDoc}
*/
@Override
protected void addMetalDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addMetalDefaults(addon, defaults);
if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme) {
defaults.add("UIColorHighlighter.stripingBackground", new ColorUIResource(230, 238, 246));
} else {
defaults.add("UIColorHighlighter.stripingBackground", new ColorUIResource(235, 235, 255));
}
}
项目:aibench-project
文件:UIColorHighlighterAddon.java
/**
* {@inheritDoc}
*/
@Override
protected void addMetalDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addMetalDefaults(addon, defaults);
if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme) {
defaults.add("UIColorHighlighter.stripingBackground", new ColorUIResource(230, 238, 246));
} else {
defaults.add("UIColorHighlighter.stripingBackground", new ColorUIResource(235, 235, 255));
}
}
项目:OpenJSharp
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:jdk8u-jdk
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:openjdk-jdk10
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:openjdk9
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:jdk8u_jdk
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:lookaside_java-1.8.0-openjdk
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:swingx
文件:TestUtilities.java
/**
* Go through all existing LookAndFeelAddons. This leads all registered
* {@link org.jdesktop.swingx.plaf.ComponentAddon} to initialize/uninitialize
* themselves.
*/
public static void cycleAddons(JComponent component) throws Exception {
LookAndFeelAddons.setAddon(MacOSXLookAndFeelAddons.class.getName());
component.updateUI();
MetalTheme oldTheme = MetalLookAndFeel.getCurrentTheme();
try {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
LookAndFeelAddons.setAddon(MetalLookAndFeelAddons.class.getName());
component.updateUI();
MetalLookAndFeel.setCurrentTheme(new OceanTheme());
LookAndFeelAddons.setAddon(MetalLookAndFeelAddons.class.getName());
component.updateUI();
} finally {
MetalLookAndFeel.setCurrentTheme(oldTheme);
}
LookAndFeelAddons.setAddon(MotifLookAndFeelAddons.class.getName());
component.updateUI();
LookAndFeelAddons.setAddon(WindowsLookAndFeelAddons.class.getName());
component.updateUI();
String property = UIManager.getString("win.xpstyle.name");
try {
UIManager.put("win.xpstyle.name",
WindowsLookAndFeelAddons.HOMESTEAD_VISUAL_STYLE);
LookAndFeelAddons.setAddon(WindowsClassicLookAndFeelAddons.class
.getName());
component.updateUI();
UIManager.put("win.xpstyle.name",
WindowsLookAndFeelAddons.SILVER_VISUAL_STYLE);
LookAndFeelAddons.setAddon(WindowsClassicLookAndFeelAddons.class
.getName());
component.updateUI();
UIManager.put("win.xpstyle.name", null);
LookAndFeelAddons.setAddon(WindowsClassicLookAndFeelAddons.class
.getName());
component.updateUI();
} finally {
UIManager.put("win.xpstyle.name", property);
}
}
项目:infobip-open-jdk-8
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:jdk8u-dev-jdk
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:jdk7-jdk
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:openjdk-source-code-learn
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:OLD-OpenJDK8
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:openjdk-jdk7u-jdk
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}
项目:openjdk-icedtea7
文件:MetalworksFrame.java
protected void buildMenus() {
menuBar = new JMenuBar();
menuBar.setOpaque(true);
JMenu file = buildFileMenu();
JMenu edit = buildEditMenu();
JMenu views = buildViewsMenu();
JMenu speed = buildSpeedMenu();
JMenu help = buildHelpMenu();
// load a theme from a text file
MetalTheme myTheme = null;
try {
InputStream istream = getClass().getResourceAsStream(
"/resources/MyTheme.theme");
myTheme = new PropertiesMetalTheme(istream);
} catch (NullPointerException e) {
System.out.println(e);
}
// build an array of themes
MetalTheme[] themes = { new OceanTheme(),
new DefaultMetalTheme(),
new GreenMetalTheme(),
new AquaMetalTheme(),
new KhakiMetalTheme(),
new DemoMetalTheme(),
new ContrastMetalTheme(),
new BigContrastMetalTheme(),
myTheme };
// put the themes in a menu
JMenu themeMenu = new MetalThemeMenu("Theme", themes);
menuBar.add(file);
menuBar.add(edit);
menuBar.add(views);
menuBar.add(themeMenu);
menuBar.add(speed);
menuBar.add(help);
setJMenuBar(menuBar);
}