Practical no 10
Write code and understand the Java AWT
package Swing_pkg;
import [Link];
import [Link];
public class FirstSwingExample {
public static void main(String[] args) {
JFrame f = new JFrame(); // creating instance of JFrame
JButton b = new JButton("click"); // creating instance of JButton
[Link](130, 100, 100, 40); // x axis, y axis, width, height
[Link](b); // adding button in JFrame
[Link](400, 500); // 400 width and 500 height
[Link](null); // using no layout managers
[Link](true); // making the frame visible
}
}
Output:-
Write code and understand the Java AWT
package pvpit;
import [Link].*;
class First2{
First2(){
Frame f=new Frame();
Button b=new Button("click me");
[Link](30,50,80,30);
[Link](b);
[Link](300,300);
[Link](null);
[Link](true);
}
public static void main(String args[]){
First2 f=new First2();
}
}
Output:-