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

📄 sw9.java

📁 swing.rar
💻 JAVA
字号:
/*
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -