本文整理匯總了Java中javax.swing.JColorChooser.setChooserPanels方法的典型用法代碼示例。如果您正苦於以下問題:Java JColorChooser.setChooserPanels方法的具體用法?Java JColorChooser.setChooserPanels怎麽用?Java JColorChooser.setChooserPanels使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JColorChooser
的用法示例。
在下文中一共展示了JColorChooser.setChooserPanels方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showDialog
import javax.swing.JColorChooser; //導入方法依賴的package包/類
private Color showDialog(Component component, String title, Color initialColor) throws HeadlessException {
final JColorChooser chooser = new JColorChooser(initialColor != null ? initialColor : Color.white);
// configuring color chooser panel
chooser.setPreviewPanel(new JPanel());
if (colorChoosers != null) {
chooser.setChooserPanels(colorChoosers);
} else {
chooser.removeChooserPanel(chooser.getChooserPanels()[0]);
chooser.removeChooserPanel(chooser.getChooserPanels()[1]);
}
// creating dialog
ColorTracker ok = new ColorTracker(chooser);
JDialog dialog = JColorChooser.createDialog(component, title, true, chooser, ok, null);
dialog.setVisible(true); // blocks until user brings dialog down...
return ok.getColor();
}
示例2: main
import javax.swing.JColorChooser; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
JColorChooser chooser = new JColorChooser();
AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });
JDialog dialog = show(chooser);
pause(DELAY);
dialog.dispose();
pause(DELAY);
Test4177735 test = new Test4177735();
SwingUtilities.invokeAndWait(test);
if (test.count != 0) {
throw new Error("JColorChooser leaves " + test.count + " threads running");
}
}
示例3: main
import javax.swing.JColorChooser; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
int hsvIndex = 0;
int panelsLength;
int finalIndex;
JColorChooser chooser = new JColorChooser();
AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
panelsLength = panels.length;
for(int i = 0; i < panelsLength; i++) {
if(panels[i].getDisplayName().equals("HSV")) {
hsvIndex = i;
}
}
finalIndex = Math.min(hsvIndex, panelsLength - 1);
chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[finalIndex] });
JDialog dialog = show(chooser);
pause(DELAY);
dialog.dispose();
pause(DELAY);
Test4177735 test = new Test4177735();
SwingUtilities.invokeAndWait(test);
if (test.count != 0) {
throw new Error("JColorChooser leaves " + test.count + " threads running");
}
}