⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 whole.java

📁 小程序 自己写的 请多多指教 希望高手不吝赐教
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class whole extends JDialog implements ActionListener
{ private condb con=null;
  private ResultSet rs=null;
  private String sql=null;
  private JLabel khhao=new JLabel("订单号:");
  private JLabel khname=new JLabel("或  客户姓名:");
  private JTextField wholetx1=new JTextField();
  private JTextField wholetx2=new JTextField();
  private JButton ok=new JButton("查询");
  private JOptionPane jop=new JOptionPane();
  private JTable ta=null;
  private JScrollPane taooo=new JScrollPane();
  private String col[]={"订单号","客户姓名","客户电话","商品代码","商品名","出库日期",
                        "价格","调度方式","调度数量","目的地"};
  private Object rowline[][]=new String[45][10];
  private boolean tf=false;
   
  public whole()
  { setTitle("物流综合查询");
    setSize(600,300);
    getContentPane().setBackground(Color.LIGHT_GRAY);
    getContentPane().setLayout(null);
    Dimension scr=Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frm=getSize();
    setLocation((int)(scr.getWidth()-frm.getWidth())/2,150);
    khhao.setBounds(50,20,80,30);
    wholetx1.setBounds(140,20,50,20);
    khname.setBounds(210,20,80,30);
    wholetx2.setBounds(300,20,50,20);
    ok.setBounds(400,20,100,30);
    getContentPane().add(khhao);
    getContentPane().add(wholetx1);
    getContentPane().add(khname);
    getContentPane().add(wholetx2);

    getContentPane().add(ok);
    ok.addActionListener(this);
    setVisible(true);
  }
  public void initTable(Object row[][],String col[])
  {
  con=new condb();
     if(wholetx1.getText().equals("")==false)
       { sql="select * from 客户管理,库存管理,调度管理  where  客户管理.商品代码=库存管理.商品代码 and 客户管理.商品代码=调度管理.商品代码 and 客户管理.订单号='"+wholetx1.getText()+"'";
        }
   else if(wholetx2.getText().equals("")==false)
     {sql="select * from 客户管理,库存管理,调度管理  where  客户管理.商品代码=库存管理.商品代码 and 客户管理.商品代码=调度管理.商品代码 and 客户管理.客户姓名='"+wholetx2.getText()+"'";
     }
   try{ rs=con.getrs(con.con,sql);
         int cnt=0;
          while(rs.next())
          
        { 
         rowline[cnt][0]=rs.getString("订单号");
          rowline[cnt][1]=rs.getString("客户姓名");
          rowline[cnt][2]=rs.getString("客户电话");
          rowline[cnt][3]=rs.getString("商品代码");
          rowline[cnt][4]=rs.getString("商品名");
          rowline[cnt][5]=rs.getString("出库日期");
          rowline[cnt][6]=rs.getString("价格");
          rowline[cnt][7]=rs.getString("调度方式");
          rowline[cnt][8]=rs.getString("调度数量");
          rowline[cnt][9]=rs.getString("目的地");
          cnt++;
        }
       ta=new JTable(rowline,col);
       ta.setSize(580,190);
       taooo=new JScrollPane(ta);
       taooo.setLocation(20,50);
       taooo.setSize(560,190);
       getContentPane().add(taooo);
       this.repaint(0,0,500,300);
       con.dbclose(con.con,rs);
       con=null;
       tf=false;
     }catch(Exception se){}
  }
  public void actionPerformed(ActionEvent ae)
  { 
    /* {int cnt=1;
        while(cnt<11)
        { rowline[cnt][0]="1";
          rowline[cnt][1]="2";
          rowline[cnt][2]="3";
          rowline[cnt][3]="4";
          rowline[cnt][4]="5";
          rowline[cnt][5]="6";
          rowline[cnt][6]="7";
          rowline[cnt][7]="8";
          rowline[cnt][8]="9";
          rowline[cnt][9]="10";
         cnt++;
        }
       ta=new JTable(rowline,col);
       ta.setSize(580,190);
       taooo=new JScrollPane(ta);
       taooo.setLocation(20,50);
       taooo.setSize(560,190);
       getContentPane().add(taooo);
       this.repaint(0,0,500,300);
       con.dbclose(con.con,rs);
       con=null;
          tf=false;}//删除*/  

   if(wholetx1.getText().equals("")&&wholetx2.getText().equals(""))
       { JOptionPane jop=new JOptionPane();
          jop.showMessageDialog(null,"两者不能全空","信息提示!",-1);
        }
     if(tf==false)
         {  for(int i=0;i<rowline.length;i++)
            for(int j=0;j<10;j++)
            rowline[i][j]=null;
         initTable(rowline,col);
         wholetx1.setText("");
         wholetx2.setText("");
       }
   }
   
}        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -