2 buttons ... it's a start

This commit is contained in:
nzBryce101
2024-03-08 14:59:20 +13:00
parent 806ecbea82
commit 9f2bcb1228

View File

@@ -1,21 +1,20 @@
import java.awt.*;
import java.awt.event.*; //import java.awt.*;
//import java.awt.event.*;
import javax.swing.*; import javax.swing.*;
public class Frame1 extends JFrame { class gui {
JPanel pane = new JPanel();
Frame1() {
super("My Simple Frame");
setBounds(100, 100, 300, 100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container con = this.getContentPane();
con.add(pane);
// customiseations to be put here
setVisibile(true);
}
public static void main(String args[]) { public static void main(String args[]) {
new Frame1(); JFrame frame = new JFrame("My First GUI");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(600, 300);
JButton button1 = new JButton("Button 1");
button1.setBounds(150, 150, 100, 70);
JButton button2 = new JButton("Button 2");
button2.setBounds(300, 150, 100, 70);
frame.add(button1);
frame.add(button2);
frame.setLayout(null);
frame.setVisible(true);
} }
} }