日期:2014-05-20 浏览次数:20909 次
private ActionListener al = new ActionListener(){ public void actionPerformed(ActionEvent e){ switch (((JMenuItem)e.getSource()).getText()){ case "teenager" ://一篇文章 txt.setEditable(false); txt.setFont(new Font( "标楷体 ",Font.BOLD,16)); txt.append(getTeenager()); txt.setLineWrap(true); add(new JScrollPane(txt)); break; case "panda"://图片 break; case "area"://计算 break; case "About"://弹出对话框 break; default: System.out.println("Wrong in switch"); break; } } };