Professional Documents
Culture Documents
import java.util.Scanner;
System.out.println(reverse);
2) write a java program to create text area inside a frame using AWT package
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Frame;
import java.awt.TextArea;
// Create a component to add to the frame; in this case a text area with sample text
Component textArea = new TextArea("Sample text...");
// Add the components to the frame; by default, the frame has a border layout
frame.add(textArea, BorderLayout.NORTH);
3)write a java program to create button and frame using AWT package
import java.awt.*;
/* We have extended the Frame class here,* thus our class "SimpleExample" would behave
* like a Frame*/
SimpleExample(){
b.setBounds(50,50,50,50);
add(b);
setSize(500,300);
setLayout(new FlowLayout());
setVisible(true);
4) write a java program to create checkbox inside a frame using AWT package
import java.awt.*;
public class CheckBoxExample extends Frame
{
CheckBoxExample()
{
setLayout(new FlowLayout());
Label lblSPORTS = new Label("SPORTS");
Checkbox chkCRICKET = new Checkbox("CRICKET");
Checkbox chkBADMITON = new Checkbox("BADMITON",true);
Checkbox chkCYCLING = new Checkbox("CYCLING");
add(lblSPORTS);
add(chkCRICKET);
add(chkBADMITON);
add(chkCYCLING);
}
}
public class CheckboxJavaExample
{
public static void main(String args[])
{
CheckBoxExample frame = new CheckBoxExample();
frame.setTitle("Checkbox in Java Example");
frame.setSize(350,100);
frame.setResizable(false);
frame.setVisible(true);}
}