frmtest.java

来自「本程序用JAVA编制」· Java 代码 · 共 48 行

JAVA
48
字号
import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.JFrame;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author unascribed * @version 1.0 */public class frmTest extends JFrame { JTextArea theArea=null;  public frmTest() {    super("菜单练习");    theArea=new JTextArea();    theArea.setEditable(true) ;    this.getContentPane() .add(new JScrollPane(theArea)) ;    JMenuBar mbar=new JMenuBar();    mbar.setOpaque(true) ;    JMenu thefile=new JMenu("file");    JMenuItem newf=new JMenuItem("new",new ImageIcon("./images/javaIcon.gif"));    thefile.add(newf) ;    mbar.add(thefile) ;    setJMenuBar(mbar);    double s=Math.exp(2);    //System.out.println(Math.pow(2.7182818284590455,2));    System.out.println(s);  }  public static void main(String[] args){    JFrame f=new frmTest();    //f.setSize(400,400) ;    f.addWindowListener(new WindowAdapter() {          public void windowClosing(WindowEvent e){          System.exit(0);          }        });        f.setVisible(true) ;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?