package swimg;
import javaawtBorderLayout;
import javaawtColor;
import javaawtContainer;
import javaxswingBorderFactory;
import javaxswingJColorChooser;
import javaxswingJComponent;
import javaxswingJFrame;
import javaxswingJLabel;
import javaxswingJPanel;
public class ColorChooserDemo extends JPanel{
protected JColorChooser tcc;
protected JLabel banner;
public ColorChooserDemo(){
super(new BorderLayout());
JPanel bannerPanel=new JPanel(new BorderLayout());
bannerPanelsetBorder(BorderFactorycreateTitledBorder(chooser Text color));
tcc=new JColorChooser(Colorred);
add(bannerPanelBorderLayoutCENTER);
add(tccBorderLayoutPAGE_END);
}
public static void main(String[] args) {
JFrame frame=new JFrame(选择颜色);
framesetBounds();
framesetDefaultCloseOperation(JFrameEXIT_ON_CLOSE);
framesetVisible(true);
JComponent newContentPane=new ColorChooserDemo();
newContentPanesetOpaque(true);
framesetContentPane(newContentPane);
framepack();
}
}