下面列出了javax.swing.plaf.metal.MetalLookAndFeel#setCurrentTheme ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public static void main(String[] args) {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
JFrame frame = new JFrame();
frame.setContentPane(new TestPanel());
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public static void main(String[] args) {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
JFrame frame = new JFrame();
frame.setContentPane(new TestPanel());
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
String numStr = e.getActionCommand();
MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
MetalLookAndFeel.setCurrentTheme(selectedTheme);
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception ex) {
System.out.println("Failed loading Metal");
System.out.println(ex);
}
}
public static void main(String[] args) {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
JFrame frame = new JFrame();
frame.setContentPane(new TestPanel());
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
@Nonnull
@Override
public UIDefaults getDefaultsImpl(UIDefaults superDefaults) {
try {
final UIDefaults metalDefaults = new MetalLookAndFeel().getDefaults();
final UIDefaults defaults = base.getDefaults();
if (SystemInfo.isLinux && !Registry.is("darcula.use.native.fonts.on.linux")) {
Font font = findFont("DejaVu Sans");
if (font != null) {
for (Object key : defaults.keySet()) {
if (key instanceof String && ((String)key).endsWith(".font")) {
defaults.put(key, new FontUIResource(font.deriveFont(13f)));
}
}
}
}
LafManagerImplUtil.initInputMapDefaults(defaults);
defaults.put(SupportTextBoxWithExpandActionExtender.class, SupportTextBoxWithExpandActionExtender.INSTANCE);
defaults.put(SupportTextBoxWithExtensionsExtender.class, SupportTextBoxWithExtensionsExtender.INSTANCE);
initIdeaDefaults(defaults);
patchStyledEditorKit(defaults);
patchComboBox(metalDefaults, defaults);
defaults.remove("Spinner.arrowButtonBorder");
defaults.put("Spinner.arrowButtonSize", JBUI.size(16, 5).asUIResource());
MetalLookAndFeel.setCurrentTheme(createMetalTheme());
defaults.put("EditorPane.font", defaults.getFont("TextField.font"));
return defaults;
}
catch (Exception e) {
log(e);
}
return super.getDefaultsImpl(superDefaults);
}
public void actionPerformed(ActionEvent e) {
String numStr = e.getActionCommand();
MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
MetalLookAndFeel.setCurrentTheme(selectedTheme);
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception ex) {
System.out.println("Failed loading Metal");
System.out.println(ex);
}
}
public static void main(String[] args) {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
JFrame frame = new JFrame();
frame.setContentPane(new TestPanel());
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
String numStr = e.getActionCommand();
MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
MetalLookAndFeel.setCurrentTheme(selectedTheme);
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception ex) {
System.out.println("Failed loading Metal");
System.out.println(ex);
}
}
public static void main(String[] args) {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
JFrame frame = new JFrame();
frame.setContentPane(new TestPanel());
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
String numStr = e.getActionCommand();
MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
MetalLookAndFeel.setCurrentTheme(selectedTheme);
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception ex) {
System.out.println("Failed loading Metal");
System.out.println(ex);
}
}
private boolean installTheme(LookAndFeel lf) {
boolean themeInstalled = false;
//Load the theme
if (themeURL != null) {
themeInstalled = true;
NbTheme nbTheme = new NbTheme(themeURL, lf);
MetalLookAndFeel.setCurrentTheme(nbTheme);
}
return themeInstalled;
}
public void actionPerformed(ActionEvent e) {
String numStr = e.getActionCommand();
MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
MetalLookAndFeel.setCurrentTheme(selectedTheme);
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception ex) {
System.out.println("Failed loading Metal");
System.out.println(ex);
}
}
public static void main(String[] args) {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
JFrame frame = new JFrame();
frame.setContentPane(new TestPanel());
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
MetalLookAndFeel.setCurrentTheme(theme);
swingset.updateLookAndFeel();
}
public void actionPerformed(ActionEvent e) {
MetalLookAndFeel.setCurrentTheme(theme);
swingset.updateLookAndFeel();
}
public void init() {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
TestPanel panel = new TestPanel();
setContentPane(panel);
}
public void init() {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
TestPanel panel = new TestPanel();
setContentPane(panel);
}
public void init() {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
TestPanel panel = new TestPanel();
setContentPane(panel);
}
public void init() {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
TestPanel panel = new TestPanel();
setContentPane(panel);
}
public void init() {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
TestPanel panel = new TestPanel();
setContentPane(panel);
}