2 buttons ... it's a start
This commit is contained in:
31
Frame1.java
31
Frame1.java
@@ -1,21 +1,20 @@
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
//import java.awt.*;
|
||||
//import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Frame1 extends JFrame {
|
||||
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);
|
||||
}
|
||||
|
||||
class gui {
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user