本文整理汇总了Java中javax.swing.JColorChooser.addChooserPanel方法的典型用法代码示例。如果您正苦于以下问题:Java JColorChooser.addChooserPanel方法的具体用法?Java JColorChooser.addChooserPanel怎么用?Java JColorChooser.addChooserPanel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JColorChooser
的用法示例。
在下文中一共展示了JColorChooser.addChooserPanel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStaticChooser
import javax.swing.JColorChooser; //导入方法依赖的package包/类
/** Gets <code>staticChooser</code> instance. */
public static JColorChooser getStaticChooser(ColorEditor ce) {
JColorChooser staticChooser = new JColorChooser(new SuperColorSelectionModel())
{
public void setColor (Color c) {
if (c == null) return;
super.setColor (c);
}
};
staticChooser.addChooserPanel (
new NbColorChooserPanel (AWT_PALETTE, getAWTColorNames(), awtColors,
getString ("CTL_AWTPalette"), ce)
);
initSwingConstants();
staticChooser.addChooserPanel (
new NbColorChooserPanel (SWING_PALETTE, swingColorNames, swingColors,
getString ("CTL_SwingPalette"), ce)
);
staticChooser.addChooserPanel (
new NbColorChooserPanel (SYSTEM_PALETTE, getSystemColorNames(), systemColors,
getString ("CTL_SystemPalette"), ce)
);
return staticChooser;
}
示例2: showDialog
import javax.swing.JColorChooser; //导入方法依赖的package包/类
public static Color showDialog(Component component, String title,
Color initial) {
JColorChooser choose = new JColorChooser(initial);
JDialog dialog = createDialog(component, title, true, choose, null, null);
AbstractColorChooserPanel[] panels = choose.getChooserPanels();
for (AbstractColorChooserPanel accp : panels) {
choose.removeChooserPanel(accp);
}
GrayScaleSwatchChooserPanel grayScaleSwatchChooserPanelFreeStyle = new GrayScaleSwatchChooserPanel();
GrayScalePanel grayScalePanelFreeStyle = new GrayScalePanel();
choose.addChooserPanel(grayScaleSwatchChooserPanelFreeStyle);
choose.addChooserPanel(grayScalePanelFreeStyle);
dialog.getContentPane().add(choose);
dialog.pack();
dialog.setVisible(true);//.show();
return choose.getColor();
}