importjavax.swing.*;importjava.awt.*;importjava.awt.event.ActionEvent;importjava.awt.event.KeyEvent;publicclassNewFrameextendsJFrame{JMenuBarjmb;JMenujm1,jm2,jm3,jm4,jm5,...
import javax.swing.*;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.KeyEvent;public class NewFrame extends JFrame {
JMenuBar jmb;JMenu jm1,jm2,jm3,jm4,jm5,jm6,jm7,jm8,jm9,jm10;
JMenuItem item1,item2,item3,item4,item5,item6,item7;
JMenu xinjian;JMenuItem fiel,project;
JTextArea jta;JToolBar jtb;JButton jb1,jb2,jb3,jb4,jb5,jb6;
public static void main(String[] args) {// TODO Auto-generated method stubNewFrame tt=new NewFrame();}public NewFrame(){
jtb=new JToolBar();jb1=new JButton(new ImageIcon("images/5.jpg"));
jb1.setToolTipText("新建");jb2=new JButton(new ImageIcon("images/6.jpg"));
jb3=new JButton(new ImageIcon("images/7.jpg"));jb4=new JButton(new ImageIcon("images/8.jpg"));
jb5=new JButton(new ImageIcon("images/9.jpg"));jb6=new JButton(new ImageIcon("images/10.jpg"));jta=new JTextArea();jmb=new JMenuBar();jm1=new JMenu("门诊管理(M)");
jm1.setMnemonic('M');//设置助记符jm2=new JMenu("住院管理(Z)");jm3=new JMenu("药房管理(Q)");
jm4=new JMenu("药库管理(Y)");jm5=new JMenu("院长查询(D)");jm6=new JMenu("电子处方(E)");
jm7=new JMenu("物资管理(M)");jm8=new JMenu("系统设置(S)");jm9=new JMenu("帮助(H)");
jm10=new JMenu("退出系统(L)");//item1=new JMenuItem();xinjian=new JMenu("新建");fiel=new JMenuItem("文件");project=new JMenuItem("工程");item2=new JMenuItem("打开",new ImageIcon("images/3.jpg"));item3=new JMenuItem("保存(S)");item3.setMnemonic('S');
item3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,ActionEvent.CTRL_MASK));item4=new JMenuItem("另存为");item5=new JMenuItem("页面设置");item6=new JMenuItem("打印");item7=new JMenuItem("退出");jtb.add(jb1);jtb.add(jb2);jtb.add(jb3);jtb.add(jb4);jtb.add(jb5);jtb.add(jb6);xinjian.add(fiel);xinjian.add(project);jm1.add(xinjian);jm1.add(item2);jm1.add(item3);jm1.add(item4);
jm1.addSeparator();jm1.add(item5);jm1.add(item6);jm1.add(item7);
jmb.add(jm1);jmb.add(jm2);jmb.add(jm3);jmb.add(jm4);jmb.add(jm5);jmb.add(jm6);jmb.add(jm7);jmb.add(jm8);jmb.add(jm9);jmb.add(jm10);this.setJMenuBar(jmb);this.add(jtb,BorderLayout.NORTH);
JScrollPane jsp=new JScrollPane(jta);jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);this.add(jsp);this.setIconImage(new ImageIcon("images/11.jpg").getImage());this.setSize(900,600);
this.setLocation(300,300);this.setTitle();this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);this.setVisible(true);
}
}
展开