📄 colordialog1.java
字号:
/**
* @作者:陈刚
* @Email:glchengang@yeah.net
* @Blog:http://blog.csdn.net/glchengang
*/
package jface.dialog.other;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.ColorDialog;
import org.eclipse.swt.widgets.Shell;
public class ColorDialog1 {
public static void main(String[] args) {
final Shell shell = new Shell();
//创建颜色选择对话框
ColorDialog dlg = new ColorDialog(shell);
//打开颜色选择对话框,并得到包含所选颜色的RGB值的对象
RGB rgb = dlg.open();
//根据rgb生成一个color对象
if (rgb != null) {
Color color = new Color(shell.getDisplay(), rgb);
// 使用颜色对象color …… ……
// 一定要记得用完后,调用color.dispose()将color释放掉
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -