我们今天主要向大家介绍的是Oracle Java的相关的实际应用程序添加漂亮的背景图片的实际操作,以下就是正文的相关内容的描述。
以下的文章主要是对Oracle Java的相关的实践使用程序增加美丽的布景图片的实践操作的描绘,其在收拾之后可执行的相关实践使用代码如下:期望本文章会给你在其实践使用方面带来一些协助在此方面。
- importjava.awt.*;
- importjavax.swing.*;
- publicclassTestBackgroundColorextendsJFrame
- {
- publicstaticvoidmain(String[]args)
- {
- TODOAuto-generatedmethodstub
- TestBackgroundColortbc=newTestBackgroundColor();
- tbc.setVisible(true);
- }
- privateJPanelimagePanel;
- privateImageIconbackground;
- publicTestBackgroundColor()
- {
- background=newImageIcon("突变布景14.png");
布景图片
- JLabellabel=newJLabel(background);
把布景图片显现在一个标签里边
把标签的巨细方位设置为图片刚好填充整个面板
- label.setBounds(0,0,background.getIconWidth(),background.getIconHeight());
把内容窗格转化为JPanel,不然不能用办法setOpaque()来使内容窗格通明
- imagePanel=(JPanel)this.getContentPane();
- imagePanel.setOpaque(false);
内容窗格默许的布局管理器为BorderLayout
- imagePanel.setLayout(newFlowLayout());
- imagePanel.add(newJButton("测验按钮"));
- this.getLayeredPane().setLayout(null);
把布景图片增加到分层窗格的最底层作为布景
- this.getLayeredPane().add(label,newInteger(Integer.MIN_VALUE));
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- this.setSize(background.getIconWidth(),background.getIconHeight());
- this.setVisible(true);
- }
- }
以上的相关内容便是对为Oracle Java程序增加美丽布景图片的介绍,望你能有所收成。
【修改引荐】
- Oracle ebs的oaf开发环境进行正确的装备
- Oracle reports功不可没,完成报表定长输出
- 检查Oracle当时连接数的详细计划
- 加快Oracle大批量数据处理的2个好用计划
- Oracle递归条件查询的操作流程