java

位置:IT落伍者 >> java >> 浏览文章

java颜色选择器


发布日期:2022年12月01日
 
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();

}

}

               

上一篇:JAVA如何实现从最后一行读取文件

下一篇:浅谈Java的输入输出流