Hi,
Please refer following example of java to know about the use of JButton class:
Code:
import javax.swing.JButton;
import javax.swing.UIManager;
public class JButtonDM
{
public static void main(String argds[]) throws Exception {
JFrame frame02 = new JFrame("UIDefaults Example");
frame02.setDefaultCloseOperation(3);
Container c1 = frame02.getContentPane();
UIManager.put("Button.background", Color.red);
UIManager.put("Button.foreground", Color.white);
Font f1 = new Font("Serif", Font.ITALIC, 24);
UIManager.put("Button.font", f1);
JButton north = new JButton("North");
JButton west = new JButton("West");
JButton center = new JButton("Center");
c1.add(north, BorderLayout.NORTH);
c1.add(west, BorderLayout.WEST);
c1.add(center, BorderLayout.CENTER);
frame02.pack();
frame02.show();
}
}
Bookmarks