mainframe.java

来自「java网络高级编程的配套源码,java网络高级编程为清华出版社出版.」· Java 代码 · 共 94 行

JAVA
94
字号
/*源代码清单10-6*/

package bean;

import java.awt.*;
import borland.jbcl.control.DecoratedFrame;
import java.awt.event.*;

public class MainFrame extends DecoratedFrame 
{
  FlowLayout flowLayout1 = new FlowLayout();
  Button button1 = new Button();
  Button button2 = new Button();
  Button button3 = new Button();
  Button button4 = new Button();

  public MainFrame() 
{
    try  {
      jbInit();
    }
    catch (Exception e) 
{
      e.printStackTrace();
    }
  }

  public static void main(String[] args)
{
    MainFrame frame=new MainFrame();
    frame.setLocation(250,250);
    frame.setSize(250,130);
    frame.show();
}

  private void jbInit() throws Exception 
{
    this.setTitle("JavaBean示例");
    this.setSize(new Dimension(267, 118));
    button1.setLabel("红   色");
    button1.addActionListener(new java.awt.event.ActionListener() 
{
      public void actionPerformed(ActionEvent e) 
{
        button1_actionPerformed(e);
      }
    });
    button2.setLabel("黄   色");
    button2.addActionListener(new java.awt.event.ActionListener() 
{
      public void actionPerformed(ActionEvent e) 
{
        button2_actionPerformed(e);
      }
    });
    button3.setLabel("绿   色");
    button3.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        button3_actionPerformed(e);
      }
    });
    button4.setLabel("兰   色");
    button4.addActionListener(new java.awt.event.ActionListener() 
{
      public void actionPerformed(ActionEvent e) 
{
        button4_actionPerformed(e);
      }
    });
    this.setLayout(flowLayout1);
    this.add(button1, null);
    this.add(button2, null);
    this.add(button3, null);
    this.add(button4, null);
  }

  void button1_actionPerformed(ActionEvent e) 
{
  }

  void button2_actionPerformed(ActionEvent e) 
{
  }

  void button3_actionPerformed(ActionEvent e) 
{
  }

  void button4_actionPerformed(ActionEvent e) 
{
  }
}

⌨️ 快捷键说明

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