- 浏览: 40929 次
- 性别:
- 来自: 成都
最新评论
-
zjhlht:
期待楼主用tware做一个,然后能分享一下学习经验!
周六一天的劳动成果(QQ登录窗) -
chen6485:
可以参看下我的博客,我直接写出整个QQ界面了,一模一样的QQ
周六一天的劳动成果(QQ登录窗) -
javageek123:
这个除了登录真的没别的用。。。。
周六一天的劳动成果(QQ登录窗) -
moqinan:
同疑惑除了登录还有啥功能撒。
周六一天的劳动成果(QQ登录窗) -
little_bill:
我也来学习一个swing。谢谢分享。
周六一天的劳动成果(QQ登录窗)
做了6年的J2EE开发了,一直没有机会认识swing,看完Swing的几把刀,心血来潮,学习了一周,为了检验学习成果,试着用swing做了个QQ游戏登录窗体,如附件图,代码也一并附上。
代码说明,
1. 主要为了学习,所以代码没有抽取分类,也为了便于发布,全部在一个类里面。里面可能有不尽如意的方式去实习,大家多多讨论。
2. 点击登录的时候我想作出一个跟QQ一样的loading状态,可惜没有想到方法。
效果图如下:
打包的图片资源和代码一直发不上来,主程序在二楼,
终于发不上来了,原来不能用chrome,IE可以正常的上传。
GaussQQ.rar直接解压,是个Eclipse项目。里面包含所用的图片和代码。
评论
10 楼
gauss2008
2010-12-06
多谢朋友们的建议,我对swing是个新手,其实很多图片都是腾讯自己的,因为不会做UI设计,所以才找腾讯的登录窗来练手,不需要自己设计图片。loading用gif最好,但是我不会做哈,所以没有加上。这仅仅是个练手,没有后续。其实360的界面也可以,原想登录成功后就是360的控制界面,没做完,也就不发了。
9 楼
wzju64676266
2010-12-06
这东西玩玩还可以,曾经在学校花了两周用c#做一个模仿qq的聊天工具,不过高并发就挂了,没有去优化
8 楼
kidfang
2010-12-06
除了登录,接下来能做点什么?
7 楼
tq02ksu
2010-12-06
LZ是想做假的QQ登录页面来盗号啊
6 楼
qianhd
2010-12-06
90%的时间花在截图上吧?
serialVersionUID = 1L 这是个不好的习惯 除非你知道自己在干嘛
serialVersionUID = 1L 这是个不好的习惯 除非你知道自己在干嘛
5 楼
cqllang
2010-12-05
其实我想看看有几张图。所以点了附件。。
4 楼
elan1986
2010-12-05
swing的那几刀确实不错,但是一直有些纠结用swing做桌面应用,最近在看python,顺便看了一下qtpy,wxpython很不错,LZ可以去看看。比较不错!那个qypy里面有一些demo,看的我很心动!哈哈!
3 楼
lijingyao8206
2010-12-05
做loading状态只要在点击登陆后响应一个关闭当前窗口且弹出一个长方形窗口,就像TX那个的窗口就可以了,当然验证都在后台进行中,登陆成功后就显示新的用户列表框了,对于那个桌面右下角的企鹅也不难的,Java封装了相应的类库了。loading的图片用PS做一个就ok,添加到转换的窗口就可以啦~以前小组做过桌面版Twitter,也做过QQ,功能简陋的呵呵~
2 楼
sdujq
2010-12-05
做个gif的图片贴上……
1 楼
gauss2008
2010-12-05
<p>附上代码<br><br></p>
<pre name="code" class="java">/**
*
*/
package com.gauss.swingtest.qq;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.TexturePaint;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import com.sun.awt.AWTUtilities;
/**
* @author gauzhang
*
*/
public class AdaLoginFrame2 extends JFrame {
private String bgtopc = ImageManager.getImageURL("logintc.png");
private Image topl = ImageManager.getImageWithImgName("logintl.png");
private Image topr = ImageManager.getImageWithImgName("logintr.png");
private TexturePaint topcPaint = ImageManager.createTexturePaint(bgtopc);
private Image bgline = ImageManager.getImageWithImgName("loginline.png");
private TexturePaint bglinePaint = ImageManager.createTexturePaint(bgline);
private String bgbottomc = ImageManager.getImageURL("loginbc.png");
private Image bottoml = ImageManager.getImageWithImgName("loginbl.png");
private Image bottomr = ImageManager.getImageWithImgName("loginbr.png");
private TexturePaint bottomcPaint = ImageManager.createTexturePaint(bgbottomc);
private Image miniImgTwo = ImageManager.getImageWithImgName("miniturn.png");
private ImageIcon minButtonIcon = ImageManager.getIconWithName("transmini.png");
private ImageIcon minButtonRoverIcon = createIcon(miniImgTwo, 0, 0, 18, 22);
private ImageIcon minButtonPressedIcon = createIcon(miniImgTwo, 18, 0, 26, 22);
private Image closeImgTwo = ImageManager.getImageWithImgName("dialog_close.png");
private ImageIcon closeButtonIcon = ImageManager.getIconWithName("transclose.png");
private ImageIcon closeButtonRoverIcon = createIcon(closeImgTwo, 0, 0, 35, 22);
private ImageIcon closeButtonPressedIcon = createIcon(closeImgTwo, 36, 0, 35, 22);
private JButton splitButton = createCommonButton(ImageManager.getIconWithName("loginsplit.png"));
private Image banner = ImageManager.getImageWithImgName("loginbanner.png");
private Image logginProcessback = ImageManager.getImageWithImgName("login_processbar2.png");
private Image logginProcess = ImageManager.getImageWithImgName("loginprocess.png");
private JButton minButton = ImageManager.createTransparentButton(minButtonIcon, minButtonRoverIcon,
minButtonPressedIcon);
private JButton closeButton = ImageManager.createTransparentButton(closeButtonIcon, closeButtonRoverIcon,
closeButtonPressedIcon);
private ImageIcon logoIcon = ImageManager.getIconWithName("qqlogo.png");
private ImageIcon advset = ImageManager.getIconWithName("setbutton.png");
private JButton setButton = createCommonButton(advset);
private ImageIcon loginButtonIcon = ImageManager.getIconWithName("login.png");
private ImageIcon loginButtonRoverIcon = ImageManager.getIconWithName("loginh.png");
private JButton loginButton = ImageManager.createTransparentButton(loginButtonIcon, loginButtonRoverIcon,
loginButtonRoverIcon);
private ImageIcon ckButtonIcon = ImageManager.getIconWithName("emptyck.png");
private JButton ckButton = createCommonButton(ckButtonIcon);
private JLabel hintText = new JLabel("请输入帐号和密码:");
private JLabel userIDText = new JLabel("账号:");
private JLabel pwdText = new JLabel("密码:");
private JLabel remText = new JLabel("记着我哈");
//id border color: 82 186 255
//pwd 107 174 222
private Color idBordercolor = new Color(82,186,255);
private Color pwdBordercolor = new Color(107,174,222);
private Font commonTxtFont = new Font("宋体", Font.PLAIN, 12);
private int width = 354;
private int height = 240;
// 354
private final int topheight = topl.getHeight(null);
private JPanel topPanel = new JPanel() {
private static final long serialVersionUID = 1L;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(topl, 0, 0, null);
g2d.setPaint(topcPaint);
g2d.drawImage(topl, 0, 0, null);
int x = topl.getWidth(null);
int y = 0;
g2d.fillRect(x, y, 334, 29);
g2d.drawImage(topr, 344, 0, null);
}
};
private JPanel bottomPanel = new JPanel() {
private static final long serialVersionUID = 1L;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(bottoml, 0, 0, null);
g2d.setPaint(bottomcPaint);
g2d.drawImage(bottoml, 0, 0, null);
int x = bottoml.getWidth(null);
int y = 0;
g2d.fillRect(x, y, 334, 39);
g2d.drawImage(bottomr, 344, 0, null);
}
};
private JPanel llinePanel = new JPanel() {
private static final long serialVersionUID = 1L;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(bglinePaint);
g2d.fillRect(0, 0, 1, 175);
}
};
private JPanel rlinePanel = new JPanel() {
private static final long serialVersionUID = 1L;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(bglinePaint);
g2d.fillRect(0, 0, 1, 175);
}
};
private JButton createCommonButton(ImageIcon icon) {
JButton button = new JButton();
button.setBounds(110, 20, 40, 20);
button.setBorder(null);
button.setMargin(null);
button.setOpaque(false);
button.setIcon(icon);
button.setContentAreaFilled(false);
button.setFocusPainted(false);
button.setRequestFocusEnabled(false);
return button;
}
public AdaLoginFrame2() {
setIconImage(ImageManager.getImageWithImgName("qqlogo.png"));
init();
}
private void init() {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setUndecorated(true);
// this.setIconImage(traceImg);
// opaque switch
AWTUtilities.setWindowOpaque(this, true);
JPanel contentPanel = new JPanel();
//contentPanel.setOpaque(false);
contentPanel.setBackground(Color.WHITE);
contentPanel.setLayout(null);
contentPanel.addMouseListener(moveWindowListener);
contentPanel.addMouseMotionListener(moveWindowListener);
// 0075ad
topPanel.setBounds(0, 0, 354, topheight);
//topPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
topPanel.setLayout(null);
//createCommonButton(logoIcon)
JButton logoButton = createCommonButton(logoIcon);
logoButton.setBounds(8, 5, 16, 16);
JLabel logoText = new JLabel("QQ游戏2010");
Font logoFont = new Font("宋体", Font.BOLD, 13);
logoText.setForeground(Color.BLACK);
logoText.setBounds(28, 3, 150, 20);
logoText.setFont(logoFont);
topPanel.add(logoText);
topPanel.add(logoButton);
minButton.setBounds(301, 0, 18, 22);
topPanel.add(minButton);
splitButton.setBounds(320, 0, 2, 22);
topPanel.add(splitButton);
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
closeButton.setBounds(324, 0, 35, 22);
closeButton.setToolTipText("Close");
minButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
AdaLoginFrame2.this.setExtendedState(JFrame.ICONIFIED);
}
});
topPanel.add(closeButton);
contentPanel.add(topPanel);
llinePanel.setBounds(0, topheight, 1, 175);
contentPanel.add(llinePanel);
ImagePanel bannerPanel= new ImagePanel(banner, 0, 0);
bannerPanel.setBounds(2, topheight, 350, 70);
contentPanel.add(bannerPanel);
ImagePanel processPanel= new ImagePanel(logginProcessback, 0, 0);
processPanel.setBounds(2, topheight+70, 350, 4);
processPanel.setOpaque(false);
//contentPanel.add(processPanel);
ImagePanel processPanelDynamic= new ImagePanel(logginProcess, 0, 0);
processPanelDynamic.setBounds(2, topheight+70, 39, 4);
//processPanelDynamic.setBorder(BorderFactory.createLineBorder(Color.RED));
contentPanel.add(processPanelDynamic);
contentPanel.add(processPanel);
hintText.setBounds(15, topheight+74, 200, 18);
hintText.setFont(commonTxtFont);
contentPanel.add(hintText);
userIDText.setBounds(15, topheight+96, 200, 18);
userIDText.setFont(commonTxtFont);
contentPanel.add(userIDText);
JTextField userIDInput = new JTextField();
userIDInput.setBorder(BorderFactory.createLineBorder(idBordercolor));
userIDInput.setBounds(55, topheight+96, 230, 20);
contentPanel.add(userIDInput);
pwdText.setBounds(15, topheight+120, 200, 18);
pwdText.setFont(commonTxtFont);
contentPanel.add(pwdText);
JPasswordField pwdInput = new JPasswordField();
pwdInput.setBorder(BorderFactory.createLineBorder(pwdBordercolor));
pwdInput.setBounds(55, topheight+122, 230, 20);
contentPanel.add(pwdInput);
ckButton.setBounds(55, topheight+151, 13, 13);
contentPanel.add(ckButton);
remText.setFont(commonTxtFont);
remText.setBounds(73, topheight+149, 60, 18);
contentPanel.add(remText);
rlinePanel.setBounds(353, topheight, 1, 175);
contentPanel.add(rlinePanel);
// downPanel.setBorder(BorderFactory.createLineBorder(Color.RED));
bottomPanel.setBounds(0, 204, 354, 39);
contentPanel.add(bottomPanel);
bottomPanel.setLayout(null);
setButton.setBounds(10,10, 76,23);
bottomPanel.add(setButton);
loginButton.setBounds(260,10, 76,22);
bottomPanel.add(loginButton);
this.setContentPane(contentPanel);
this.setSize(width, 243);
centerWindow(this);
}
private void centerWindow(JFrame frame) {
// location
Dimension screSize = Toolkit.getDefaultToolkit().getScreenSize();
int x = screSize.width;
int y = screSize.height;
int appW = (int) getSize().getWidth();
int appH = (int) getSize().getHeight();
// display center
frame.setLocation((x - appW) / 2, (y - appH) / 2);
}
private ImageIcon createIcon(Image image, int startx, int starty, int width, int height) {
CropImage ci = new CropImage(image, startx, starty, width, height);
return new ImageIcon(ci.getImage());
}
private MouseAdapter moveWindowListener = new MouseAdapter() {
private Point lastPoint = null;
@Override
public void mousePressed(MouseEvent e) {
lastPoint = e.getLocationOnScreen();
}
@Override
public void mouseDragged(MouseEvent e) {
Point point = e.getLocationOnScreen();
int offsetX = point.x - lastPoint.x;
int offsetY = point.y - lastPoint.y;
Rectangle bounds = AdaLoginFrame2.this.getBounds();
bounds.x += offsetX;
bounds.y += offsetY;
AdaLoginFrame2.this.setBounds(bounds);
lastPoint = point;
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
};
/**
* @param args
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
//ImageManager.setupLookAndFeel();
AdaLoginFrame2 ui = new AdaLoginFrame2();
ui.setVisible(true);
}
});
}
}
class ImagePanel extends JPanel {
/**
*
*/
private int x = 0;
private int y = 0;
private Image image;
private static final long serialVersionUID = 1L;
public ImagePanel(Image image, int x, int y) {
this.image = image;
this.x = x;
this.y = y;
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(image, x, y, null);
}
}
</pre>
<p> </p>
<pre name="code" class="java">/**
*
*/
package com.gauss.swingtest.qq;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.TexturePaint;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import com.sun.awt.AWTUtilities;
/**
* @author gauzhang
*
*/
public class AdaLoginFrame2 extends JFrame {
private String bgtopc = ImageManager.getImageURL("logintc.png");
private Image topl = ImageManager.getImageWithImgName("logintl.png");
private Image topr = ImageManager.getImageWithImgName("logintr.png");
private TexturePaint topcPaint = ImageManager.createTexturePaint(bgtopc);
private Image bgline = ImageManager.getImageWithImgName("loginline.png");
private TexturePaint bglinePaint = ImageManager.createTexturePaint(bgline);
private String bgbottomc = ImageManager.getImageURL("loginbc.png");
private Image bottoml = ImageManager.getImageWithImgName("loginbl.png");
private Image bottomr = ImageManager.getImageWithImgName("loginbr.png");
private TexturePaint bottomcPaint = ImageManager.createTexturePaint(bgbottomc);
private Image miniImgTwo = ImageManager.getImageWithImgName("miniturn.png");
private ImageIcon minButtonIcon = ImageManager.getIconWithName("transmini.png");
private ImageIcon minButtonRoverIcon = createIcon(miniImgTwo, 0, 0, 18, 22);
private ImageIcon minButtonPressedIcon = createIcon(miniImgTwo, 18, 0, 26, 22);
private Image closeImgTwo = ImageManager.getImageWithImgName("dialog_close.png");
private ImageIcon closeButtonIcon = ImageManager.getIconWithName("transclose.png");
private ImageIcon closeButtonRoverIcon = createIcon(closeImgTwo, 0, 0, 35, 22);
private ImageIcon closeButtonPressedIcon = createIcon(closeImgTwo, 36, 0, 35, 22);
private JButton splitButton = createCommonButton(ImageManager.getIconWithName("loginsplit.png"));
private Image banner = ImageManager.getImageWithImgName("loginbanner.png");
private Image logginProcessback = ImageManager.getImageWithImgName("login_processbar2.png");
private Image logginProcess = ImageManager.getImageWithImgName("loginprocess.png");
private JButton minButton = ImageManager.createTransparentButton(minButtonIcon, minButtonRoverIcon,
minButtonPressedIcon);
private JButton closeButton = ImageManager.createTransparentButton(closeButtonIcon, closeButtonRoverIcon,
closeButtonPressedIcon);
private ImageIcon logoIcon = ImageManager.getIconWithName("qqlogo.png");
private ImageIcon advset = ImageManager.getIconWithName("setbutton.png");
private JButton setButton = createCommonButton(advset);
private ImageIcon loginButtonIcon = ImageManager.getIconWithName("login.png");
private ImageIcon loginButtonRoverIcon = ImageManager.getIconWithName("loginh.png");
private JButton loginButton = ImageManager.createTransparentButton(loginButtonIcon, loginButtonRoverIcon,
loginButtonRoverIcon);
private ImageIcon ckButtonIcon = ImageManager.getIconWithName("emptyck.png");
private JButton ckButton = createCommonButton(ckButtonIcon);
private JLabel hintText = new JLabel("请输入帐号和密码:");
private JLabel userIDText = new JLabel("账号:");
private JLabel pwdText = new JLabel("密码:");
private JLabel remText = new JLabel("记着我哈");
//id border color: 82 186 255
//pwd 107 174 222
private Color idBordercolor = new Color(82,186,255);
private Color pwdBordercolor = new Color(107,174,222);
private Font commonTxtFont = new Font("宋体", Font.PLAIN, 12);
private int width = 354;
private int height = 240;
// 354
private final int topheight = topl.getHeight(null);
private JPanel topPanel = new JPanel() {
private static final long serialVersionUID = 1L;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(topl, 0, 0, null);
g2d.setPaint(topcPaint);
g2d.drawImage(topl, 0, 0, null);
int x = topl.getWidth(null);
int y = 0;
g2d.fillRect(x, y, 334, 29);
g2d.drawImage(topr, 344, 0, null);
}
};
private JPanel bottomPanel = new JPanel() {
private static final long serialVersionUID = 1L;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(bottoml, 0, 0, null);
g2d.setPaint(bottomcPaint);
g2d.drawImage(bottoml, 0, 0, null);
int x = bottoml.getWidth(null);
int y = 0;
g2d.fillRect(x, y, 334, 39);
g2d.drawImage(bottomr, 344, 0, null);
}
};
private JPanel llinePanel = new JPanel() {
private static final long serialVersionUID = 1L;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(bglinePaint);
g2d.fillRect(0, 0, 1, 175);
}
};
private JPanel rlinePanel = new JPanel() {
private static final long serialVersionUID = 1L;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(bglinePaint);
g2d.fillRect(0, 0, 1, 175);
}
};
private JButton createCommonButton(ImageIcon icon) {
JButton button = new JButton();
button.setBounds(110, 20, 40, 20);
button.setBorder(null);
button.setMargin(null);
button.setOpaque(false);
button.setIcon(icon);
button.setContentAreaFilled(false);
button.setFocusPainted(false);
button.setRequestFocusEnabled(false);
return button;
}
public AdaLoginFrame2() {
setIconImage(ImageManager.getImageWithImgName("qqlogo.png"));
init();
}
private void init() {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setUndecorated(true);
// this.setIconImage(traceImg);
// opaque switch
AWTUtilities.setWindowOpaque(this, true);
JPanel contentPanel = new JPanel();
//contentPanel.setOpaque(false);
contentPanel.setBackground(Color.WHITE);
contentPanel.setLayout(null);
contentPanel.addMouseListener(moveWindowListener);
contentPanel.addMouseMotionListener(moveWindowListener);
// 0075ad
topPanel.setBounds(0, 0, 354, topheight);
//topPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
topPanel.setLayout(null);
//createCommonButton(logoIcon)
JButton logoButton = createCommonButton(logoIcon);
logoButton.setBounds(8, 5, 16, 16);
JLabel logoText = new JLabel("QQ游戏2010");
Font logoFont = new Font("宋体", Font.BOLD, 13);
logoText.setForeground(Color.BLACK);
logoText.setBounds(28, 3, 150, 20);
logoText.setFont(logoFont);
topPanel.add(logoText);
topPanel.add(logoButton);
minButton.setBounds(301, 0, 18, 22);
topPanel.add(minButton);
splitButton.setBounds(320, 0, 2, 22);
topPanel.add(splitButton);
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
closeButton.setBounds(324, 0, 35, 22);
closeButton.setToolTipText("Close");
minButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
AdaLoginFrame2.this.setExtendedState(JFrame.ICONIFIED);
}
});
topPanel.add(closeButton);
contentPanel.add(topPanel);
llinePanel.setBounds(0, topheight, 1, 175);
contentPanel.add(llinePanel);
ImagePanel bannerPanel= new ImagePanel(banner, 0, 0);
bannerPanel.setBounds(2, topheight, 350, 70);
contentPanel.add(bannerPanel);
ImagePanel processPanel= new ImagePanel(logginProcessback, 0, 0);
processPanel.setBounds(2, topheight+70, 350, 4);
processPanel.setOpaque(false);
//contentPanel.add(processPanel);
ImagePanel processPanelDynamic= new ImagePanel(logginProcess, 0, 0);
processPanelDynamic.setBounds(2, topheight+70, 39, 4);
//processPanelDynamic.setBorder(BorderFactory.createLineBorder(Color.RED));
contentPanel.add(processPanelDynamic);
contentPanel.add(processPanel);
hintText.setBounds(15, topheight+74, 200, 18);
hintText.setFont(commonTxtFont);
contentPanel.add(hintText);
userIDText.setBounds(15, topheight+96, 200, 18);
userIDText.setFont(commonTxtFont);
contentPanel.add(userIDText);
JTextField userIDInput = new JTextField();
userIDInput.setBorder(BorderFactory.createLineBorder(idBordercolor));
userIDInput.setBounds(55, topheight+96, 230, 20);
contentPanel.add(userIDInput);
pwdText.setBounds(15, topheight+120, 200, 18);
pwdText.setFont(commonTxtFont);
contentPanel.add(pwdText);
JPasswordField pwdInput = new JPasswordField();
pwdInput.setBorder(BorderFactory.createLineBorder(pwdBordercolor));
pwdInput.setBounds(55, topheight+122, 230, 20);
contentPanel.add(pwdInput);
ckButton.setBounds(55, topheight+151, 13, 13);
contentPanel.add(ckButton);
remText.setFont(commonTxtFont);
remText.setBounds(73, topheight+149, 60, 18);
contentPanel.add(remText);
rlinePanel.setBounds(353, topheight, 1, 175);
contentPanel.add(rlinePanel);
// downPanel.setBorder(BorderFactory.createLineBorder(Color.RED));
bottomPanel.setBounds(0, 204, 354, 39);
contentPanel.add(bottomPanel);
bottomPanel.setLayout(null);
setButton.setBounds(10,10, 76,23);
bottomPanel.add(setButton);
loginButton.setBounds(260,10, 76,22);
bottomPanel.add(loginButton);
this.setContentPane(contentPanel);
this.setSize(width, 243);
centerWindow(this);
}
private void centerWindow(JFrame frame) {
// location
Dimension screSize = Toolkit.getDefaultToolkit().getScreenSize();
int x = screSize.width;
int y = screSize.height;
int appW = (int) getSize().getWidth();
int appH = (int) getSize().getHeight();
// display center
frame.setLocation((x - appW) / 2, (y - appH) / 2);
}
private ImageIcon createIcon(Image image, int startx, int starty, int width, int height) {
CropImage ci = new CropImage(image, startx, starty, width, height);
return new ImageIcon(ci.getImage());
}
private MouseAdapter moveWindowListener = new MouseAdapter() {
private Point lastPoint = null;
@Override
public void mousePressed(MouseEvent e) {
lastPoint = e.getLocationOnScreen();
}
@Override
public void mouseDragged(MouseEvent e) {
Point point = e.getLocationOnScreen();
int offsetX = point.x - lastPoint.x;
int offsetY = point.y - lastPoint.y;
Rectangle bounds = AdaLoginFrame2.this.getBounds();
bounds.x += offsetX;
bounds.y += offsetY;
AdaLoginFrame2.this.setBounds(bounds);
lastPoint = point;
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
};
/**
* @param args
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
//ImageManager.setupLookAndFeel();
AdaLoginFrame2 ui = new AdaLoginFrame2();
ui.setVisible(true);
}
});
}
}
class ImagePanel extends JPanel {
/**
*
*/
private int x = 0;
private int y = 0;
private Image image;
private static final long serialVersionUID = 1L;
public ImagePanel(Image image, int x, int y) {
this.image = image;
this.x = x;
this.y = y;
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(image, x, y, null);
}
}
</pre>
<p> </p>
发表评论
-
模仿path布局写的页面
2012-04-10 11:05 6最近学些android,从简单入手,模仿path写了一个布局, ... -
商品分类表的设计
2010-01-29 13:26 1267&l 商品分类表的设计 ... -
SessionFactory.getCurrentSession
2010-01-28 14:24 2904在使用SessionFactory.getCurrentSes ... -
解决:Failed while installing Dynamic Web Module 2.5.
2009-10-13 16:13 9499使用Eclipse IDE for Java Develope ... -
rapid-validation 多验证,错误信息显示问题解决办法
2008-09-26 15:03 1438对于同一字段的多验证且使用了advice错误信息定位的,发现第 ... -
电子平台J2EE的安全体系
2005-08-08 14:44 1175...
相关推荐
该源码项目是一个使用C#语言开发的仿QQ登录窗口应用程序,基于.NET Framework 2.0平台。这个项目展示了如何创建一个与QQ登录界面类似的用户界面,而不依赖任何第三方控件,这使得开发者可以直接编译并运行代码,快速...
QQ登录界面是用户接触QQ应用的第一步,其设计和实现涉及到多个UI控件以及相应的背景图片资源。在本文中,我们将深入探讨QQ登录界面中各控件的图片资源及其重要性,同时也会提及如何管理和使用这些资源。 首先,登录...
网页QQ悬浮窗是一种轻量级的应用,它允许用户在浏览网页的同时,通过悬浮窗口与QQ好友进行即时通讯,无需打开独立的QQ客户端。这个技术主要基于JavaScript、HTML和CSS等前端技术实现,使得用户可以更加便捷地处理...
QQ登录界面Qt实现是一个在计算机编程领域中,利用Qt库创建QQ登录窗口的过程。Qt是一个跨平台的应用程序开发框架,广泛用于C++编程,适用于Windows、Linux、macOS等多种操作系统。这个项目的目标是构建一个与腾讯QQ...
在本文中,我们将深入探讨如何使用C# Winform来创建一个模仿QQ聊天窗口皮肤的控件。QQ聊天窗口因其简洁而美观的界面设计受到了广大用户的喜爱,因此许多开发者尝试通过编程技术来复制这一效果,以提升自己应用的用户...
在本文中,我们将深入探讨如何使用C#的WinForms框架创建一个高仿QQ登录界面的项目。这个项目涉及的关键知识点包括WinForms控件的使用、界面设计、事件处理以及项目结构的理解。 首先,"winform高仿qq登陆界面"这个...
【标题】"仿QQ多个聊天窗口合并"是一个项目,旨在模仿QQ软件的多聊天窗口合并功能。这个功能在QQ中非常实用,它允许用户将多个聊天窗口整合到一个单一的界面中,方便用户同时管理多个对话,提高工作效率。 【描述】...
QQ作为中国最流行的即时通讯工具之一,其登录界面的设计简洁而直观,对于初学者来说,模仿这个设计可以很好地提升Web前端开发技能。 首先,我们从HTML结构开始。HTML是网页的基础,用于构建页面的骨架。一个简单的...
【安卓QQ登录协议】是腾讯公司为Android平台开发的QQ应用程序设计的一种身份验证机制,它允许用户安全地登录并使用QQ服务。这个协议涉及到多个技术层面,包括但不限于网络安全、身份认证、数据加密以及服务器交互等...
对于"带QQ昵称QQ头像的"这一特点,说明该插件不仅能实现基本的QQ账号登录功能,还能同步用户的QQ昵称和头像到ECShop网站,使得用户在网站上的显示更个性化,提高用户黏性。 在实际使用中,安装插件通常包括以下步骤...
利用Qt 实现了QQ的登录界面,基本上实现了QQ的登陆界面全部效果,外加了QQ登录界面的旋转效果。虽不说100%相似,那也有99.99%相似了哈O(∩_∩)O。 详情见博客:...
在Android平台上,开发一款类似QQ管家的悬浮窗应用是一项具有挑战性的任务,因为涉及到系统级别的权限和用户界面设计。这个项目名为"ThunderQQFloatWindow",显然是一个模仿QQ悬浮窗功能的应用,允许用户在其上执行...
在本文中,我们将深入探讨如何使用Winform技术创建一个与QQ登录界面高度相似的应用程序。Winform是.NET Framework的一部分,它提供了一个强大的图形用户界面(GUI)开发平台,用于构建桌面应用程序。在这个项目中,...
在使用这个源码时,应当遵循开源社区的规则,尊重作者的劳动成果,如果用于商业用途,要确保已经获得了适当的授权。 总的来说,易语言取已登录过的QQ号源码涉及到了系统调用、进程分析和文件解析等多个方面的知识。...
本文将深入探讨如何使用MFC实现类似QQ的窗口靠边自动收缩隐藏效果,这是一种常见的用户界面(UI)特性,可以提高用户体验。 首先,我们需要了解MFC中的CWnd类,它是所有窗口类的基础。当我们创建一个MFC应用时,...
在C#编程环境中,创建一个高质量的QQ登录界面可以是一个挑战性的任务,但它也是学习Windows Forms应用程序设计和网络通信的良好实践。以下是对这个项目的一些详细解释和知识点。 首先,让我们了解C#的基础知识。C#...
QQ快捷登录功能是基于QQ互联OAuth2.0协议实现的,它允许开发者为自己的网站或应用集成QQ账号的登录选项,提升用户体验并扩大用户基础。OAuth2.0是一种授权框架,广泛应用于各种社交平台,包括QQ,使得第三方应用能够...
【标题】"高仿QQ2012登录界面 源代码"涉及到的是一个软件界面设计的项目,目的是实现一个与QQ2012版本相似的登录界面。这个项目主要关注的是用户界面(UI)的设计和用户体验(UX),并且可能包含了一些高级的图形...
实现一个简易仿qq登录界面,要求实现: 1) 登录界面有帐号、密码文本和编辑框,登录和退出按钮。在程序中维护一个帐号密码的数组,用以判断正确登录与否。如果登录成功,则进入qq主界面,否则清空帐号和密码编辑框,...
在本文中,我们将深入探讨如何使用WPF(Windows Presentation Foundation)技术来开发一个仿概念版的QQ登录界面,这是一个超炫的设计,非常适合初学者学习。WPF是.NET Framework 3.5的一部分,它提供了一个强大的...