本文整理汇总了Java中javax.swing.plaf.metal.MetalButtonUI类的典型用法代码示例。如果您正苦于以下问题:Java MetalButtonUI类的具体用法?Java MetalButtonUI怎么用?Java MetalButtonUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetalButtonUI类属于javax.swing.plaf.metal包,在下文中一共展示了MetalButtonUI类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createColorButton
import javax.swing.plaf.metal.MetalButtonUI; //导入依赖的package包/类
private static JButton createColorButton(Color color) {
JButton colorButton = new JButton();
colorButton.setPreferredSize(new Dimension(30, 20));
colorButton.setBorder(BorderFactory.createLineBorder(Color.darkGray));
colorButton.setBackground(color);
colorButton.setForeground(color);
colorButton.setUI(new MetalButtonUI());
//colorButton.setActionCommand("" + i);
colorButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//int i = Integer.parseInt(e.getActionCommand());
Color newColor = JColorChooser.showDialog(Gui.frame, "Choose Color", ((JButton) e.getSource()).getBackground());
if (newColor != null) {
((JButton) e.getSource()).setBackground(newColor);
((JButton) e.getSource()).setForeground(newColor);
}
}
});
return colorButton;
}
示例2: createSmallButton
import javax.swing.plaf.metal.MetalButtonUI; //导入依赖的package包/类
public static JButton createSmallButton(final String text, final Icon icon) {
final JButton b = new JButton(icon);
if (text != null) {
b.setText(text);
b.setFont(WidgetUtils.FONT_SMALL);
}
b.setMargin(new Insets(0, 0, 0, 0));
b.setUI(new MetalButtonUI());
b.setBackground(WidgetUtils.COLOR_WELL_BACKGROUND);
final MatteBorder outerBorder = new MatteBorder(1, 1, 1, 1, WidgetUtils.BG_COLOR_LESS_BRIGHT);
b.setBorder(new CompoundBorder(outerBorder, new EmptyBorder(2, 4, 2, 4)));
b.setFocusPainted(false);
return b;
}
示例3: createSmallPopupButton
import javax.swing.plaf.metal.MetalButtonUI; //导入依赖的package包/类
public static PopupButton createSmallPopupButton(final String text, final String imagePath) {
final PopupButton b =
new PopupButton(text, ImageManager.get().getImageIcon(imagePath, IconUtils.ICON_SIZE_SMALL));
b.setFont(WidgetUtils.FONT_SMALL);
b.setMargin(new Insets(0, 0, 0, 0));
b.setUI(new MetalButtonUI());
b.setBackground(WidgetUtils.COLOR_WELL_BACKGROUND);
final MatteBorder outerBorder = new MatteBorder(1, 1, 1, 1, WidgetUtils.BG_COLOR_LESS_BRIGHT);
b.setBorder(new CompoundBorder(outerBorder, new EmptyBorder(2, 4, 2, 4)));
b.setFocusPainted(false);
return b;
}
示例4: testGetUI
import javax.swing.plaf.metal.MetalButtonUI; //导入依赖的package包/类
public void testGetUI() throws Exception {
UIManager.setLookAndFeel(new MetalLookAndFeel());
JComponent c = new JComponent() {
private static final long serialVersionUID = 1L;
@Override
public String getUIClassID() {
return "ButtonUI";
}
};
ComponentUI ui = UIManager.getUI(c);
assertTrue(ui instanceof MetalButtonUI);
}
示例5: setUI
import javax.swing.plaf.metal.MetalButtonUI; //导入依赖的package包/类
private void setUI() {
// This fixes an issue where the WindowsButtonUI wants to draw a border
// around a button that isn't in a toolbar. This occurs even if you set
// an empty border because it ignores your border and draws its own.
setUI(MetalButtonUI.createUI(this));
}
示例6: InputIndentationValidDotIndent
import javax.swing.plaf.metal.MetalButtonUI; //导入依赖的package包/类
/** Creates a new instance of InputIndentationValidDotIndent */ //indent:4 exp:4
public InputIndentationValidDotIndent() { //indent:4 exp:4
System.lineSeparator(); //indent:8 exp:8
String. //indent:8 exp:8
CASE_INSENSITIVE_ORDER.reversed(); //indent:12 exp:12
String.CASE_INSENSITIVE_ORDER. //indent:8 exp:8
reversed(); //indent:12 exp:12
String. //indent:8 exp:8
CASE_INSENSITIVE_ORDER. //indent:12 exp:12
reversed(); //indent:16 exp:16
String //indent:8 exp:8
.CASE_INSENSITIVE_ORDER //indent:12 exp:12
.reversed(); //indent:16 exp:16
BevelBorder border = new javax.swing.border.BevelBorder(BevelBorder.LOWERED); //indent:8 exp:8
border = new javax.swing.border. //indent:8 exp:8
BevelBorder(BevelBorder.LOWERED); //indent:12 exp:12
border = new javax.swing.border.BevelBorder( //indent:8 exp:8
BevelBorder.LOWERED); //indent:12 exp:12
border = new javax. //indent:8 exp:8
swing. //indent:12 exp:12
border. //indent:16 exp:16
BevelBorder(BevelBorder.LOWERED); //indent:20 exp:20
border = //indent:8 exp:8
new javax. //indent:12 exp:12
swing //indent:16 exp:16
.border //indent:20 exp:20
.BevelBorder(BevelBorder.LOWERED); //indent:24 exp:24
border = //indent:8 exp:8
new javax. //indent:12 exp:12
swing //indent:16 exp:16
.border //indent:20 exp:20
.BevelBorder(BevelBorder. //indent:24 exp:24
LOWERED); //indent:28 exp:28
Class<MetalButtonUI> c = javax.swing. //indent:8 exp:8
plaf.metal.MetalButtonUI.class; //indent:12 exp:12
Class<MetalButtonUI> c1 = javax.swing //indent:8 exp:8
.plaf.metal.MetalButtonUI.class; //indent:12 exp:12
Class<MetalButtonUI> c2 = javax.swing //indent:8 exp:8
.plaf.metal. //indent:12 exp:12
MetalButtonUI.class; //indent:16 exp:16
Class<MetalButtonUI> c3 = javax.swing //indent:8 exp:8
.plaf.metal //indent:12 exp:12
.MetalButtonUI.class; //indent:16 exp:16
Class<MetalButtonUI> c4 = javax. //indent:8 exp:8
swing.plaf.metal. //indent:12 exp:12
MetalButtonUI.class; //indent:16 exp:16
border = //indent:8 exp:8
new javax. //indent:12 exp:12
swing //indent:16 exp:16
.border.BevelBorder(BevelBorder. //indent:20 exp:20
LOWERED); //indent:24 exp:24
}