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

📄 colorchange.java

📁 java灵感设计
💻 JAVA
字号:
package colorchange;import java.awt.*;import java.awt.event.*;import java.applet.*;import javax.swing.*;import com.borland.jbcl.layout.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> * @author unascribed * @version 1.0 */public class colorchange extends Applet {  boolean isStandalone = false;  Button button1 = new Button();  Button button2 = new Button();  Button button3 = new Button();  JButton jButton1 = new JButton();  JButton jButton2 = new JButton();  JButton jButton3 = new JButton();  XYLayout xYLayout1 = new XYLayout();  //Get a parameter value  public String getParameter(String key, String def) {    return isStandalone ? System.getProperty(key, def) :      (getParameter(key) != null ? getParameter(key) : def);  }  //Construct the applet  public colorchange() {  }  //Initialize the applet  public void init() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  //Component initialization  private void jbInit() throws Exception {    button1.setLabel("red");    button1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        button1_actionPerformed(e);      }    });    button2.setLabel("orange");    button2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        button2_actionPerformed(e);      }    });    button3.setLabel("yellow");    button3.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        button3_actionPerformed(e);      }    });    jButton1.setText("green");    jButton1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton1_actionPerformed(e);      }    });    jButton2.setText("blue");    jButton2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton2_actionPerformed(e);      }    });    jButton3.setText("white");    jButton3.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton3_actionPerformed(e);      }    });    this.setLayout(xYLayout1);    this.add(button1,    new XYConstraints(23, 5, 66, -1));    this.add(jButton1, new XYConstraints(24, 42, -1, -1));    this.add(button3, new XYConstraints(189, 7, -1, -1));    this.add(jButton3, new XYConstraints(190, 39, -1, -1));    this.add(button2, new XYConstraints(103, 7, -1, -1));    this.add(jButton2,  new XYConstraints(103, 40, 71, -1));  }  //Get Applet information  public String getAppletInfo() {    return "Applet Information";  }  //Get parameter info  public String[][] getParameterInfo() {    return null;  }  void button1_actionPerformed(ActionEvent e) {this.setBackground(Color.red );  }  void button2_actionPerformed(ActionEvent e) {this.setBackground(Color.orange );  }  void button3_actionPerformed(ActionEvent e) {this.setBackground(Color.yellow );  }  void jButton1_actionPerformed(ActionEvent e) {this.setBackground(Color.green );  }  void jButton2_actionPerformed(ActionEvent e) {this.setBackground(Color.blue );  }  void jButton3_actionPerformed(ActionEvent e) {this.setBackground(Color.white );  }}

⌨️ 快捷键说明

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