Java Code Examples for javax.swing.plaf.metal.MetalButtonUI

The following examples show how to use javax.swing.plaf.metal.MetalButtonUI. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: iBioSim   Source File: EditPreferences.java    License: Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
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));
}
 
Example 3
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));
}
 
Example 4
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));
}
 
Example 5
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));
}
 
Example 6
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));
}
 
Example 7
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));
}
 
Example 8
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));
}
 
Example 9
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));
}