?? colorchooser.java.bak
字號:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
public class colorChooser extends JFrame {
private JPanel contentPane;
private XYLayout xYLayout1 = new XYLayout();
private JColorChooser jColorChooser1 = new JColorChooser();
private JButton jButton1 = new JButton();
private JTextPane jTextPane1 = new JTextPane();
public colorChooser() {
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(xYLayout1);
this.setSize(new Dimension(250, 250));
this.setTitle("使用 ColorChooser");
this.getContentPane().setLayout(xYLayout1);
jButton1.setText("設置顏色");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
this.getContentPane().add(jButton1, new XYConstraints(78, 17, 95, 25));
this.getContentPane().add(jTextPane1, new XYConstraints(23, 47, 204, 151));
}
public static void main(String[] args){
colorChooser f=new colorChooser();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
f.show();
}
void jButton1_actionPerformed(ActionEvent e) {
Color c=Color.white;
JFrame frame=new JFrame();
c=jColorChooser1.showDialog(frame,"選擇你要的顏色",c);
jTextPane1.setBackground(c);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -