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

📄 frame1.java~49~

📁 很好得jbuilder100例源代码
💻 JAVA~49~
字号:
package joptionpane;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.jbcl.layout.*;public class Frame1 extends JFrame {  JPanel contentPane;  VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();  JButton jButton1 = new JButton();  JButton jButton2 = new JButton();  JButton jButton3 = new JButton();  JButton jButton4 = new JButton();  JButton jButton5 = new JButton();  /**Construct the frame*/  public Frame1() {    enableEvents(AWTEvent.WINDOW_EVENT_MASK);    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  /**Component initialization*/  private void jbInit() throws Exception  {    //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));    contentPane = (JPanel) this.getContentPane();    jButton1.setText("警告");    jButton1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton1_actionPerformed(e);      }    });    contentPane.setLayout(verticalFlowLayout1);    this.setResizable(false);    this.setSize(new Dimension(212, 235));    this.setTitle("JOptionPane演示程序");    jButton2.setText("提示");    jButton2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton2_actionPerformed(e);      }    });    jButton3.setText("错误");    jButton3.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton3_actionPerformed(e);      }    });    jButton4.setText("提问");    jButton4.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton4_actionPerformed(e);      }    });    jButton5.setText("无类型");    contentPane.add(jButton1, null);    contentPane.add(jButton2, null);    contentPane.add(jButton3, null);    contentPane.add(jButton4, null);    contentPane.add(jButton5, null);  }  /**Overridden so we can exit when window is closed*/  protected void processWindowEvent(WindowEvent e) {    super.processWindowEvent(e);    if (e.getID() == WindowEvent.WINDOW_CLOSING) {      System.exit(0);    }  }  void jButton1_actionPerformed(ActionEvent e) {    JOptionPane.showMessageDialog(this,"这是一条警告信息!",                                  "警告信息",                                  JOptionPane.WARNING_MESSAGE);  }  void jButton2_actionPerformed(ActionEvent e) {    JOptionPane.showConfirmDialog(this,"这是一条提示信息!","提示信息",JOptionPane.OK_CANCEL_OPTION,JOptionPane.INFORMATION_MESSAGE);  }  void jButton3_actionPerformed(ActionEvent e) {    JOptionPane.showConfirmDialog(this,"这是一条错误信息!","错误信息",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.ERROR_MESSAGE);  }  void jButton4_actionPerformed(ActionEvent e) {    JOptionPane.showConfirmDialog(this,new JTextField("答案"),"请输入问题的答案",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE);  }}

⌨️ 快捷键说明

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