package sam;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.beans.PropertyChangeListener;
class MyFrame extends JFrame
{
int width = 400;
int height = 300;
JPanel p = new JPanel();
JToolBar tb = new JToolBar();
JButton btnNew = new JButton(new ImageIcon("NEW.JPG"));
JButton btnOpen = new JButton(new ImageIcon("OPEN.JPG"));
JButton btnSave = new JButton(new ImageIcon("SAVE.JPG"));
JButton btnCopy = new JButton(new ImageIcon("COPY.JPG"));
JButton btnPaste = new JButton(new ImageIcon("PASTE.JPG"));
public MyFrame()
{
this.setTitle("小程序");
this.setSize(width,height);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(3);
tb.add(btnNew);
tb.add(btnOpen);
tb.add(btnSave);
tb.addSeparator(new Dimension(5,1));
tb.add(btnCopy);
tb.add(btnPaste);
p.setLayout(new BorderLayout());
p.add(tb,"North");
this.getContentPane().add(p);
}
}
public class MyDemo
{
public static void main(String args[])
{
new MyFrame().show();
}
}