e877. getting and setting the selected color in a jcolorchooser dialog.txt
来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 16 行
TXT
16 行
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 + =
减小字号Ctrl + -
显示快捷键?