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

📄 usingswingframe.java~3~

📁 《JBUILDER精髓》各章的源代码可以直接调入编程开发环境里运行无须更改
💻 JAVA~3~
字号:
package usingswing;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.jbcl.layout.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class usingSwingFrame extends JFrame {  JPanel contentPane;  BorderLayout borderLayout1 = new BorderLayout();  JTabbedPane jTabbedPane1 = new JTabbedPane();  JPanel jPanel1 = new JPanel();  JPanel jPanel2 = new JPanel();  JPanel jPanel3 = new JPanel();  JPanel jPanel4 = new JPanel();  XYLayout xYLayout1 = new XYLayout();  BorderLayout borderLayout2 = new BorderLayout();  BorderLayout borderLayout3 = new BorderLayout();  XYLayout xYLayout2 = new XYLayout();  JLabel jLabel1 = new JLabel();  JButton jButton1 = new JButton();  JButton jButton2 = new JButton();  JToggleButton jToggleButton1 = new JToggleButton();  JToggleButton jToggleButton2 = new JToggleButton();  //Construct the frame  public usingSwingFrame() {    enableEvents(AWTEvent.WINDOW_EVENT_MASK);    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  //Component initialization  private void jbInit() throws Exception  {    contentPane = (JPanel) this.getContentPane();    contentPane.setLayout(borderLayout1);    this.setSize(new Dimension(400, 300));    this.setTitle("使用sWing组建Java的应用系统");    jPanel1.setLayout(xYLayout1);    jPanel2.setLayout(borderLayout2);    jPanel3.setLayout(borderLayout3);    jPanel4.setLayout(xYLayout2);    jLabel1.setForeground(Color.black);    jLabel1.setText("");    jButton1.setPreferredSize(new Dimension(99, 25));    jButton1.setText("显示文字");    jButton2.setPreferredSize(new Dimension(99, 25));    jButton2.setText("隐藏文字");    jToggleButton1.setText("文字颜色设置");    jToggleButton2.setText("文字大小开关");    contentPane.add(jTabbedPane1, BorderLayout.CENTER);    jTabbedPane1.add(jPanel1,   "按钮和开关演示");    jPanel1.add(jLabel1, new XYConstraints(0, 0, -1, -1));    jPanel1.add(jButton1,    new XYConstraints(67, 46, -1, -1));    jPanel1.add(jButton2,       new XYConstraints(192, 46, -1, -1));    jPanel1.add(jToggleButton1,    new XYConstraints(67, 100, -1, -1));    jPanel1.add(jToggleButton2, new XYConstraints(192, 99, -1, -1));    jTabbedPane1.add(jPanel2,   "单选和多选按钮演示");    jTabbedPane1.add(jPanel3,   "开关演示");    jTabbedPane1.add(jPanel4,   "列表框演示");  }  //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);    }  }}

⌨️ 快捷键说明

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