⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 firstappframe.java~6~

📁 JBuilder9 精髓 source code1.rar
💻 JAVA~6~
字号:
package firstapp;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * <p>Title: firstapp</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class firstappFrame extends JFrame {
  JPanel contentPane;
  JMenuBar jMenuBar1 = new JMenuBar();
  JMenu jMenuFile = new JMenu();
  JMenuItem jMenuFileExit = new JMenuItem();
  JMenu jMenuHelp = new JMenu();
  JMenuItem jMenuHelpAbout = new JMenuItem();
  JToolBar jToolBar = new JToolBar();
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JButton jButton3 = new JButton();
  ImageIcon image1;
  ImageIcon image2;
  ImageIcon image3;
  JLabel statusBar = new JLabel();
  BorderLayout borderLayout1 = new BorderLayout();
  JMenu jMenu1 = new JMenu();
  JMenuItem jMenuItem1 = new JMenuItem();
  JPanel jPanel1 = new JPanel();
  BorderLayout borderLayout2 = new BorderLayout();
  JSplitPane jSplitPane1 = new JSplitPane();
  JButton jButton4 = new JButton();
  JTextArea jTextAreaNew1 = new JTextArea();

  //Construct the frame
  public firstappFrame() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
  //Component initialization
  private void jbInit() throws Exception  {
    image1 = new ImageIcon(firstapp.firstappFrame.class.getResource("openFile.png"));
    image2 = new ImageIcon(firstapp.firstappFrame.class.getResource("closeFile.png"));
    image3 = new ImageIcon(firstapp.firstappFrame.class.getResource("help.png"));
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);
    this.setSize(new Dimension(400, 300));
    this.setTitle("我的第一个Java应用系统");
    statusBar.setText(" ");
    jMenuFile.setText("File");
    jMenuFileExit.setText("Exit");
    jMenuFileExit.addActionListener(new firstappFrame_jMenuFileExit_ActionAdapter(this));
    jMenuHelp.setText("Help");
    jMenuHelpAbout.setText("About");
    jMenuHelpAbout.addActionListener(new firstappFrame_jMenuHelpAbout_ActionAdapter(this));
    jButton1.setIcon(image1);
    jButton1.setToolTipText("Open File");
    jButton2.setIcon(image2);
    jButton2.setToolTipText("Close File");
    jButton3.setIcon(image3);
    jButton3.setToolTipText("Help");
    jMenu1.setText("new");
    jMenuItem1.setIcon(new ImageIcon(new java.net.URL("file:///F:/jbuilder9/1/firstapp/20.gif")));
    jMenuItem1.setText("click Me");
    jMenuItem1.addActionListener(new firstappFrame_jMenuItem1_actionAdapter(this));
    jPanel1.setLayout(borderLayout2);
    jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
    jButton4.setText("Click Me");
    jButton4.addActionListener(new firstappFrame_jButton4_actionAdapter(this));
    jTextAreaNew1.setText(" ");
    jToolBar.add(jButton1);
    jToolBar.add(jButton2);
    jToolBar.add(jButton3);
    jMenuFile.add(jMenuFileExit);
    jMenuHelp.add(jMenuHelpAbout);
    jMenuBar1.add(jMenuFile);
    jMenuBar1.add(jMenu1);
    jMenuBar1.add(jMenuHelp);
    this.setJMenuBar(jMenuBar1);
    contentPane.add(jToolBar, BorderLayout.NORTH);
    contentPane.add(statusBar, BorderLayout.SOUTH);
    contentPane.add(jPanel1, BorderLayout.CENTER);
    jPanel1.add(jSplitPane1, BorderLayout.CENTER);
    jSplitPane1.add(jButton4, JSplitPane.TOP);
    jSplitPane1.add(jTextAreaNew1, JSplitPane.BOTTOM);
    jMenu1.add(jMenuItem1);
  }
  //File | Exit action performed
  public void jMenuFileExit_actionPerformed(ActionEvent e) {
    System.exit(0);
  }
  //Help | About action performed
  public void jMenuHelpAbout_actionPerformed(ActionEvent e) {
    firstappFrame_AboutBox dlg = new firstappFrame_AboutBox(this);
    Dimension dlgSize = dlg.getPreferredSize();
    Dimension frmSize = getSize();
    Point loc = getLocation();
    dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
    dlg.setModal(true);
    dlg.pack();
    dlg.show();
  }
  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      jMenuFileExit_actionPerformed(null);
    }
  }

  void jButton4_actionPerformed(ActionEvent e) {
   jTextAreaNew1.append(" You Click Me!\n");
  }
}

class firstappFrame_jMenuFileExit_ActionAdapter implements ActionListener {
  firstappFrame adaptee;

  firstappFrame_jMenuFileExit_ActionAdapter(firstappFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jMenuFileExit_actionPerformed(e);
  }
}

class firstappFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
  firstappFrame adaptee;

  firstappFrame_jMenuHelpAbout_ActionAdapter(firstappFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jMenuHelpAbout_actionPerformed(e);
  }
}

class firstappFrame_jButton4_actionAdapter implements java.awt.event.ActionListener {
  firstappFrame adaptee;

  firstappFrame_jButton4_actionAdapter(firstappFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton4_actionPerformed(e);
  }
}

class firstappFrame_jMenuItem1_actionAdapter implements java.awt.event.ActionListener {
  firstappFrame adaptee;

  firstappFrame_jMenuItem1_actionAdapter(firstappFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton4_actionPerformed(e);
  }
}

⌨️ 快捷键说明

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