zoukankan      html  css  js  c++  java
  • Swing做的简单超市收银系统

     

    现在写一些新得和开发过程中遇到的问题

    1.登录密码获取问题

    String password = new String(txtPwd.getPassword());

    2.登录成功界面消失

      

    this.dispose();
    

     

      打开新窗体

       

    new MainFra().setVisible(true);
    

     

    3.设置窗体最大化

      

    this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    

     

    4.点击菜单添加面板

     

    GoodsInterFra goodsInterFra = new GoodsInterFra();
    
    goodsInterFra.setVisible(true);
    
    this.jDesktopPane1.add(goodsInterFra);
    

    5.table的鼠标pressed时间

     

    int row = tabBookType.getSelectedRow();
    this.txtId.setText((String) tabBookType.getValueAt(row, 0));
    this.txtBookT.setText((String) tabBookType.getValueAt(row, 1));
    this.txtBookTypeDesc.setText((String) tabBookType.getValueAt(row, 2));
    

    6.下拉框

     

    Connection conn = null;
    GoodsType goodsType = null;
    try {
        conn = dbutil.getCon();
        ResultSet rs = goodsTypeDao.goodsTypeList(conn, new GoodsType());
        while(rs.next()){
            goodsType = new GoodsType();
            goodsType.setId(rs.getInt("id"));
            goodsType.setGoodsType(rs.getString("goodsType"));
            this.jcbGoodsType.addItem(goodsType);
        }
    

    解决下拉框中内容不显示问题,重写toString方法

    public String toString() {
        return this.getGoodsType();
    }
    

    7.java.util.Date转java.sql.Date

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    java.sql.Date productTimeDate = null,baozhiDate = null;
    try {
        java.util.Date date = sdf.parse(productDate);
        java.util.Date date2 =sdf.parse(baozhiqi);
        productTimeDate = new java.sql.Date(date.getTime());
        baozhiDate = new java.sql.Date(date2.getTime());
    } catch (ParseException e) {
    e.printStackTrace();
    }
    

    8.String转换int

    String goodCount = this.txtCountNum.getText();
    int count = Integer.parseInt(goodCount.trim());
    

    9.float转换String

    float tatalPrice = count*price;
    this.txtTotalPrice.setText(String.valueOf(tatalPrice));
  • 相关阅读:
    分享的选择
    @contextmanager 另外一种实现上下文的方法(含yield 生成器)
    Linux ☞ Good good study,day day up
    Linux常用命令
    python 新手遇到的问题
    Pyqt 基础功能
    redis安装使用
    python 对任意文件(jpg,png,mp3,mp4)base64的编码解码
    PHP7.* AES的加密解密
    Ubuntu宝塔面板设置网站 Apache Server API为Apache 2.0 Handler模式
  • 原文地址:https://www.cnblogs.com/java-lzm/p/4368008.html
Copyright © 2011-2022 走看看