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

📄 color.java

📁 按钮颜色java工程项目
💻 JAVA
字号:
package button;import java.awt.*;import java.awt.event.*;import java.applet.*;import javax.swing.*;public class color extends Applet {  boolean isStandalone = false;  JToggleButton c1 = new JToggleButton();  JToggleButton c2 = new JToggleButton();  JToggleButton c3 = new JToggleButton();  JToggleButton c4 = new JToggleButton();  JToggleButton c5 = new JToggleButton();  JToggleButton c6 = new JToggleButton();  /**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 color() {  }  /**Initialize the applet*/  public void init() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  /**Component initialization*/  private void jbInit() throws Exception {    c1.setText("red");    c1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        c1_actionPerformed(e);      }    });    c2.setText("black");    c2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        c2_actionPerformed(e);      }    });    c3.setText("white");    c3.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        c3_actionPerformed(e);      }    });    c4.setText("blue");    c4.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        c4_actionPerformed(e);      }    });    c5.setText("orange");    c5.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        c5_actionPerformed(e);      }    });    c6.setText("yellow");    c6.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        c6_actionPerformed(e);      }    });    this.add(c1, null);    this.add(c2, null);    this.add(c3, null);    this.add(c4, null);    this.add(c5, null);    this.add(c6, null);  }  /**Get Applet information*/  public String getAppletInfo() {    return "Applet Information";  }  /**Get parameter info*/  public String[][] getParameterInfo() {    return null;  }  void c1_actionPerformed(ActionEvent e) { this.setBackground(Color.red );  }  void c2_actionPerformed(ActionEvent e) { this.setBackground(Color.black );  }  void c3_actionPerformed(ActionEvent e) {  this.setBackground(Color.white);  }  void c4_actionPerformed(ActionEvent e) {  this.setBackground(Color.blue );  }  void c5_actionPerformed(ActionEvent e) {   this.setBackground(Color.orange );  }  void c6_actionPerformed(ActionEvent e) {   this.setBackground(Color.yellow );  }}

⌨️ 快捷键说明

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