本文整理汇总了Java中javax.swing.plaf.metal.OceanTheme类的典型用法代码示例。如果您正苦于以下问题:Java OceanTheme类的具体用法?Java OceanTheme怎么用?Java OceanTheme使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OceanTheme类属于javax.swing.plaf.metal包,在下文中一共展示了OceanTheme类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setLookAndFeel
import javax.swing.plaf.metal.OceanTheme; //导入依赖的package包/类
/**
* 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);
}
示例2: addMetalDefaults
import javax.swing.plaf.metal.OceanTheme; //导入依赖的package包/类
@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());
}
示例3: updateLookAndFeel
import javax.swing.plaf.metal.OceanTheme; //导入依赖的package包/类
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();
}
});
}
示例4: addMetalDefaults
import javax.swing.plaf.metal.OceanTheme; //导入依赖的package包/类
/**
* {@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));
}
}
示例5: buildMenus
import javax.swing.plaf.metal.OceanTheme; //导入依赖的package包/类
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);
}
示例6: cycleAddons
import javax.swing.plaf.metal.OceanTheme; //导入依赖的package包/类
/**
* 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);
}
}