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; }
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; }
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; }
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); }
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)); }
/** 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 }