0% found this document useful (0 votes)
11 views2 pages

java10

Java experiment

Uploaded by

sharadongare25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

java10

Java experiment

Uploaded by

sharadongare25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical no 10

Write code and understand the Java AWT

package Swing_pkg;

import javax.swing.JButton;
import javax.swing.JFrame;

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


b.setBounds(130, 100, 100, 40); // x axis, y axis, width, height

f.add(b); // adding button in JFrame

f.setSize(400, 500); // 400 width and 500 height


f.setLayout(null); // using no layout managers
f.setVisible(true); // making the frame visible
}
}

Output:-
Write code and understand the Java AWT

package pvpit;

import java.awt.*;
class First2{
First2(){

Frame f=new Frame();

Button b=new Button("click me");


b.setBounds(30,50,80,30);

f.add(b);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);

}
public static void main(String args[]){

First2 f=new First2();

}
}

Output:-

You might also like