Turn off the border paint for JButton in Java
Description
The following code shows how to turn off the border paint for JButton.
Example
/*w w w . j av a 2s .co m*/
import javax.swing.JButton;
import javax.swing.JFrame;
public class Main extends JFrame {
public Main() {
setSize(300, 150);
setDefaultCloseOperation(EXIT_ON_CLOSE);
JButton button = new JButton("java2s.com");
button.setBorderPainted(false);
add(button);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}
The code above generates the following result.
Home »
Java Tutorial »
Swing »
Java Tutorial »
Swing »