栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Java实现证券交易页面

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Java实现证券交易页面

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 comboBox1 = new JComboBox(item1);
        JComboBox comboBox2 = new JComboBox(item2);
        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 comboBox3 = new JComboBox(item3);
      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 comboBox4 = new JComboBox(item4);
        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, "网络异常,请稍后");    
    } 
   }

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/439665.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号