gui programming in java notes code example
Example: java gui
import javax.swing.*;
class gui{
public static void main(String args[]){
JFrame frame = new JFrame("My First GUI");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300,300);
JButton button = new JButton("Click me");
frame.getContentPane().add(button); // Adds Button to content pane of frame
frame.setVisible(true);
}
}