import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class zhengquan extends Jframe implements ActionListener{
JButton jb1;JButton jb2;JButton jb3;JButton jb4;
public static void main(String[] args){
zhengquan app = new zhengquan();
app.go();
}
public void go(){
setVisible(true);
setTitle("财富证券独立委托V6.20");
setSize(470,250);
setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
// 设置背景图片
ImageIcon bg = new ImageIcon("2.jpg");
JLabel label = new JLabel(bg);
label.setBounds(0, 0, bg.getIconWidth(), bg.getIconHeight());
getLayeredPane().add(label, new Integer(-30001));
// 设置ContentPane透明
JPanel contentPane = (JPanel)getContentPane();
contentPane.setOpaque(false);
// contentPane = topPanel + buttonPanel
contentPane.setLayout(new BorderLayout());
JPanel topPanel = getTopPanel();
topPanel.setOpaque(false);
contentPane.add(topPanel, "Center");
JPanel buttonPanel = getJLabel();
contentPane.add(buttonPanel, "South");
}
//getTopPanel函数
private JPanel getTopPanel() {
JPanel p = new JPanel();
p.setLayout(new GridLayout(5,1));
JPanel a = getUser1();
a.setOpaque(false);
p.add(a);
JPanel b = getUser2();
b.setOpaque(false);
p.add(b);
JPanel c = getUser3();
c.setOpaque(false);
p.add(c);
JPanel d = getUser4();
d.setOpaque(false);
p.add(d);
JPanel e = getUser5();
e.setOpaque(false);
p.add(e);
return p;
}
private JPanel getUser1(){
JPanel f = new JPanel();
f.setLayout(new FlowLayout(FlowLayout.LEFT));
f.add(new JLabel(" 帐号类型: "));
String[] item1 = {"客户号 ","手机号 ","QQ ","Wechat "};
String[] item2 = {"(3300)北京中关村 ","(3301)北京海淀区 ",};
JComboBox
JComboBox
f.add(comboBox1);
f.add(comboBox2);
f.add(new JCheckBox("保护帐号",true));
return (f);
}
private JPanel getUser2(){
JPanel f = new JPanel();
f.setLayout(new FlowLayout(FlowLayout.LEFT));
f.add(new JLabel(" 客户号: "));
String[] item3 = {"********* "};
JComboBox
f.add(comboBox3);
f.add(new JCheckBox("记住帐号",true));
return f;
}
private JPanel getUser3(){
JPanel f = new JPanel();
f.setLayout(new FlowLayout(FlowLayout.LEFT));
f.add(new JLabel(" 交易密码: "));
f.add(new JPasswordField(25));
return f;
}
private JPanel getUser4(){
JPanel f = new JPanel();
f.setLayout(new FlowLayout(FlowLayout.LEFT));
f.add(new JLabel(" 安全方式: "));
String[] item4 = {"验证码 ","手机号 "};
JComboBox
f.add(comboBox4);
f.add(new JTextField(17));
ImageIcon pic = new ImageIcon("12345.png");
JLabel imagelabel = new JLabel(pic);
f.add(imagelabel);
return f;
}
private JPanel getUser5(){
JPanel p = new JPanel();
jb1 = new JButton("确定");
jb2 = new JButton("取消");
jb3 = new JButton("帮助▽");
jb4 = new JButton("通讯设置");
p.setLayout(new FlowLayout(FlowLayout.RIGHT));
p.add(jb1);
jb1.addActionListener(this);
p.add(jb2);
jb2.addActionListener(this);
p.add(jb3);
jb3.addActionListener(this);
p.add(jb4);
jb4.addActionListener(this);
p.add(new JLabel(" "));
return p;
}
private JPanel getJLabel() {
JPanel p = new JPanel();
p.setLayout(new GridLayout(2,1));
p.add(new JLabel(" "));
p.add(new JLabel(" 请输入密码信息!"));
return p;
}
public void actionPerformed(ActionEvent e){
Object obj = e.getSource();
if(obj == (Object)jb1) JOptionPane.showMessageDialog(null, "请输入密码");
if(obj == (Object)jb2) JOptionPane.showMessageDialog(null, "登录取消");
if(obj == (Object)jb3) JOptionPane.showMessageDialog(null, "网络异常,请稍后");
if(obj == (Object)jb4) JOptionPane.showMessageDialog(null, "网络异常,请稍后");
}
}



