如何隐藏除 HSB 之外的所有其他默认面板?
是否可以仅显示HSB而无需JTabbedPane,仅显示纯面板
谢谢!
最佳答案
import javax.swing.*;
import javax.swing.colorchooser.*;
class ColorChooserTest {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JColorChooser cc = new JColorChooser();
AbstractColorChooserPanel[] panels = cc.getChooserPanels();
for (AbstractColorChooserPanel accp : panels) {
if (accp.getDisplayName().equals("HSB")) {
JOptionPane.showMessageDialog(null, accp);
}
}
}
});
}
}