Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java GUI 设计 » Swing  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 美化窗体
305457157





发贴: 1
积分: 0
于 2007-10-28 12:55 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
package teachman;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.Image;

public class Frame1 extends JFrame {
JPanel contentPane;
JLabel jLabel2 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel1 = new JLabel();
JLabel jLabel3 = new JLabel();
JPasswordField jPasswordField1 = new JPasswordField();
JComboBox jbcomb1 = new JComboBox();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JLabel jLabel4 = new JLabel();

//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {

contentPane = (JPanel)this.getContentPane();
jLabel2.setFont(new java.awt.Font("宋体", 0, 14));
jLabel2.setText("用户名:");
jLabel2.setBounds(new Rectangle(109, 57, 60, 24));

contentPane.setLayout(null);
this.getContentPane().setBackground(SystemColor.control);
this.setSize(new Dimension(400, 320));
this.setResizable(false);//禁用窗口标题栏上的最大化按钮

this.setTitle("登 录");
this.getWindowStateListeners();
// this.setUndecorated(truententPane); //不能拖动
jTextField1.setBounds(new Rectangle(172, 57, 112, 25));
jLabel1.setEnabled(true);
jLabel1.setFont(new java.awt.Font("宋体", 0, 14));
jLabel1.setText("密 码:");
jLabel1.setBounds(new Rectangle(109, 95, 61, 21));
jLabel3.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel3.setText("登录类型:");
jLabel3.setBounds(new Rectangle(100, 132, 74, 23));
jPasswordField1.setText("");
jPasswordField1.setBounds(new Rectangle(172, 89, 111, 27));
jbcomb1.setBounds(new Rectangle(172, 126, 116, 26));

jButton1.setBounds(new Rectangle(101, 187, 73, 25));
jButton1.setFont(new java.awt.Font("Dialog", 0, 14));
jButton1.setSelected(true);
jButton1.setText("登录");
jButton2.setBounds(new Rectangle(205, 190, 73, 25));
jButton2.setFont(new java.awt.Font("Dialog", 0, 14));
jButton2.setToolTipText("");
jButton2.setActionCommand("重置");
jButton2.setContentAreaFilled(true);
jButton2.setText("重置");
jButton2.setVerticalAlignment(SwingConstants.CENTER);
jLabel4.setBackground(Color.lightGray);
jLabel4.setEnabled(true);
jLabel4.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel4.setForeground(Color.red);
jLabel4.setText("新教师请注册");
jLabel4.setBounds(new Rectangle(239, 235, 98, 16));

contentPane.add(jTextField1, null);
contentPane.add(jLabel2, null);
contentPane.add(jPasswordField1, null);
contentPane.add(jLabel1, null);
contentPane.add(jLabel3, null);
contentPane.add(jbcomb1, null);
contentPane.add(jButton1, null);
contentPane.add(jButton2, null);
contentPane.add(jLabel4, null);

}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEventEnvelope;
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}

}

怎么为这个程序窗体上加一个背景图片,,,,,,,,标题栏左边的图标也换了,

这些图片放在什么地方可以用相对路径




关于Jute Forum的长期发展给官方的建议

话题树型展开
人气 标题 作者 字数 发贴时间
7619 美化窗体 305457157 3273 2007-10-28 12:55
6383 Re:美化窗体 javafriend 89 2007-11-04 11:42

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923