aboutsummaryrefslogtreecommitdiff
path: root/apcs/Gui.java
blob: b6fb5a17b179a287b626a22d1ccdaf295d168a4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*Name:	
 *Date:
 *Period:
 *Teacher:
 *Description:
 */
package apcs;
import java.awt.Graphics;
import java.awt.geom.RoundRectangle2D;

import javax.swing.JButton;  
import javax.swing.JFrame;  
public class Gui {
    public Gui()
    {  
        /* JFrame is a top level container (window)
         * where we would be adding our button
         */
        JFrame frame=new JFrame();  
                          
        // Creating Button          
        JButton b=new TButton("Click Me..");
        /* This method specifies the location and size
         * of button. In method setBounds(x, y, width, height)
         * x,y) are cordinates from the top left 
         * corner and remaining two arguments are the width
         * and height of the button.
         */
        b.setBounds(50,50,200, 50);  
             
        //Adding button onto the frame
        frame.add(b);  
        
        
                  
        // Setting Frame size. This is the window size
        frame.setSize(600,500);  
        
        frame.setLayout(null);  
        frame.setVisible(true);  
                  
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
        
    }  
}