本文整理汇总了Java中java.awt.Container.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java Container.setBackground方法的具体用法?Java Container.setBackground怎么用?Java Container.setBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Container
的用法示例。
在下文中一共展示了Container.setBackground方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SplashScreen
import java.awt.Container; //导入方法依赖的package包/类
public SplashScreen() throws IOException {
execute =this;
Container container = getContentPane();
container.setLayout(null);
container.setBackground(new Color(0,51,102));
JPanel panel = new JPanel();
panel.setBorder(new javax.swing.border.EtchedBorder());
panel.setBackground(new Color(255, 255, 255));
panel.setBounds(10, 10, 640, 400);
panel.setLayout(null);
panel.setBackground(new Color(156,213,242));
// container.add(panel);
BufferedImage image = ImageIO.read(getClass().getResource("/splash.jpg"));
ImageIcon icon = new ImageIcon(image);
JLabel label = new JLabel("",icon,SwingConstants.CENTER);
label.setFont(new Font("Comic Sans MS",Font.BOLD,19));
label.setBounds(0, 0, 640, 400);
panel.add(label);
container.add(label);
progressBar.setMaximum(50);
progressBar.setBounds(0, 400, 640, 15);
progressBar.setForeground(new Color(24,112,11));
container.add(progressBar);
loadProgressBar();
setSize(640, 415);
setLocationRelativeTo(null);
setVisible(true);
}
示例2: initFrame
import java.awt.Container; //导入方法依赖的package包/类
/**
* �����ʼ��
*/
private void initFrame() {
Container c = getContentPane();
setLayout(null);
setBounds(100, 100, 500, 400);
c.setBackground(Color.white);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
/*JRegularStarButton jb = new JRegularStarButton();
jb.setBounds(0, 50, 50, 50);
JRegularStarButton jb2 = new JRegularStarButton();
jb2.setBounds(100, 100, 100, 150);
jb2.setTopColor(new Color(100,100,100,1));
jb2.setBottomColor(new Color(255,0,255,200));
jb2.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
new CustomTask((JRegularStarButton)(e.getSource())).execute();
// JOptionPane.showMessageDialog(null, "actionPerformed");
// ((JRegularStarButton)e.getSource()).setPressed(false);
}
});*/
JRadialEllipseButton jb3 = new JRadialEllipseButton();
jb3.setLocation(200, 150);
jb3.setSize(110, 110);
JRadialEllipseButton jb4 = new JRadialEllipseButton();
jb4.setBounds(320, 100, 50, 80);
jb4.setRadioColor(new Color[]{
new Color(200,100,0),
new Color(150,200,150),
new Color(100,150,0),
new Color(200,255,100)});
/*add(jb);
add(jb2);*/
add(jb3);
add(jb4);
}