Java AbstractButton .setBorderPainted (boolean b)

Syntax

AbstractButton.setBorderPainted(boolean b) has the following syntax.

public void setBorderPainted(boolean b)

Example

In the following code shows how to use AbstractButton.setBorderPainted(boolean b) method.


import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JFrame;
//from  ww  w.  ja v  a 2s.c o m
public class Main {
  public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");
    jb.setBorderPainted(false);
    
    
    
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
  }
}