📄 e877. getting and setting the selected color in a jcolorchooser dialog.txt
字号:
Normally, the color is retrieved from a color chooser dialog when the dialog is closed. See e884 Listening for OK and Cancel Events in a JColorChooser Dialog for an example of how to determine when the dialog is closed.
// Create the chooser
JColorChooser chooser = new JColorChooser();
// Set the selected color
chooser.setColor(Color.red);
// Create and show dialog.
// See e876 Creating a JColorChooser Dialog.
// Get current selected color
Color color = chooser.getColor();
Related Examples
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -