sw9.java
来自「swing.rar」· Java 代码 · 共 45 行
JAVA
45 行
/*
JColorChooser
Class
Used to load the color Palatte
cons:
JColorChooser()
Methods:
showDialog(component,String title,java.awt.Color)
*/
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class sw9 extends JFrame implements ActionListener
{
JButton b1 = new JButton("Load");
JColorChooser jcc = new JColorChooser();
Container con;
public sw9()
{
con = getContentPane();
con.add(b1);
b1.addActionListener(this);
con.setLayout(new FlowLayout());
setSize(300,300);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == b1)
{
con.setBackground(jcc.showDialog(this,"MyColors",Color.red));
}
}
public static void main(String args[])
{
new sw9();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?