javax.swing.plaf.metal.MetalButtonUI Java Examples

The following examples show how to use javax.swing.plaf.metal.MetalButtonUI. 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 File: EditPreferences.java    From iBioSim with 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
Source File: BorderlessImageButton.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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
Source File: BorderlessImageToggleButton.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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
Source File: BorderlessImageButton.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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
Source File: BorderlessImageToggleButton.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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
Source File: BorderlessImageButton.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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
Source File: BorderlessImageToggleButton.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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
Source File: BorderlessImageButton.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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
Source File: BorderlessImageToggleButton.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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));
}