熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

java顏色選擇器

2022-06-13   來源: Java核心技術 

  

  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();

  }

  }

  

  


From:http://tw.wingwit.com/Article/program/Java/hx/201311/26378.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.