|
A customized JFrame window with three components:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SampleWin6
{
public static void main(String [] args)
{
MyFrame frame = new MyFrame("Alan Window");
frame.setSize(400, 300);
frame.setLocation(100, 75);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
class MyFrame extends JFrame
{
JButton btnSubmit;
JButton btnClear;
JTextField text;
public MyFrame(String s)
{
super(s);
setLayout(new FlowLayout());
btnSubmit = new JButton("Submit");
btnClear = new JButton("Clear");
text = new JTextField("100 Main Street");
add(btnSubmit);
add(btnClear);
add(text);
}
}
|