?? gongju.java
字號(hào):
/*
* gongju.java
*
* Created on 2007年6月23日, 下午6:15
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package huaban;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JToolBar;
public class gongju extends JToolBar implements ActionListener {
JButton[] button = new JButton[5];
ShapePanel panel1;
public gongju(ShapePanel pan) {
panel1 = pan;
button[0] = new JButton(new ImageIcon("zhixian1.GIF"));
button[1] = new JButton(new ImageIcon("quxian1.gif"));
button[2] = new JButton(new ImageIcon("tuoyuan.GIF"));
button[3] = new JButton(new ImageIcon("juxing1.GIF"));
button[4] = new JButton(new ImageIcon("zifu.GIF"));
this.setLayout(new GridLayout(12,1));
this.add(button[0]);
this.add(button[1]);
this.add(button[2]);
this.add(button[3]);
this.add(button[4]);
this.setRollover(true);
button[0].addActionListener(this);
button[1].addActionListener(this);
button[2].addActionListener(this);
button[3].addActionListener(this);
button[4].addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == button[0]){
panel1.set(1);
}
if(e.getSource() == button[1]){
panel1.set(2);
}
if(e.getSource() == button[2]){
panel1.set(3);
}
if(e.getSource() == button[3]){
panel1.set(4);
}
if(e.getSource() == button[4]){
panel1.sr = JOptionPane.showInputDialog(this,"輸入你想顯示的字符");
panel1.set(5);
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -