java记事本的编辑功能显示不出来,其他功能也不用了,麻烦帮我看下代码,谢谢
packagebb;publicclassWP{publicstaticvoidmain(Stringargs[]){WindowMenuwin=newWindowMen...
package bb;public class WP { public static void main(String args[]) { WindowMenu win=new WindowMenu("班级通讯录",20,30,400,300); } }package bb;import javax.swing.*;import java.awt.FlowLayout;import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import static javax.swing.JFrame.*;public class WindowMenu extends JFrame{ FlowLayout Menu; JPanel ban; JMenuBar menubar; JTextField text; JMenu menu,menu1,subMenu; JMenuItem item1,item2,item3; public WindowMenu(){} public WindowMenu(String s,int x,int y,int w,int h) { init(s); setLocation(x,y); setSize(w,h); setVisible(true); setDefaultCloseOperation(DISPOSE_ON_CLOSE); } void init(String s){ setTitle(s); ban = new JPanel(); Menu = new FlowLayout(); menubar=new JMenuBar(); subMenu=new JMenu("新建"); menu=new JMenu("文件"); menu1=new JMenu("编辑"); item1=new JMenuItem("打开"); item2=new JMenuItem("保存"); item3=new JMenuItem("退出"); item1.setAccelerator(KeyStroke.getKeyStroke('A')); item2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_MASK)); item3.setAccelerator(KeyStroke.getKeyStroke('X')); menu.add(item1); menu.addSeparator(); menu.add(item2); menu.add(subMenu); menu.add(item3); menu.addSeparator(); subMenu.add(new JMenuItem("信息")); menubar.add(menu); setJMenuBar(menubar); } }我还想在下边的文本区域进行增删改查的按钮,谢谢
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询