📄 frameproductstoryinformation.java~2~
字号:
package Manager;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
//import java.util.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class FrameProductStoryInformation extends JFrame {
//定义所用的结果集
ResultSet rs;
//定义sql语句变量
String sql;
//定义DBManeger对象,利用其中的方法来操作数据库
private DBManager db =new DBManager();
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel8 = new JLabel();
JLabel jLabel4 = new JLabel();
JTextField jText44 = new JTextField();
JTextField jText41 = new JTextField();
JLabel jLabel12 = new JLabel();
JLabel jLabel13 = new JLabel();
JLabel jLabel3 = new JLabel();
JTextField jText43 = new JTextField();
JButton jButtonnext = new JButton();
JTextField jText37 = new JTextField();
JLabel jLabel14 = new JLabel();
JTextField jTextkuanxing = new JTextField();
JLabel jLabel9 = new JLabel();
JComboBox jCombocolor = new JComboBox();
JButton jButtonSearch = new JButton();
JLabel jText37ee = new JLabel();
JTextField jText36 = new JTextField();
JLabel jLabel16 = new JLabel();
JLabel jLabel11 = new JLabel();
JTextField jText40 = new JTextField();
JButton jButtonpre = new JButton();
JButton jButtonlast = new JButton();
JButton jButtonupdate = new JButton();
JPanel jPanel1 = new JPanel();
JTextField jText42 = new JTextField();
JButton jButtonexit = new JButton();
JButton jButtondelete = new JButton();
JTextField jText38 = new JTextField();
JButton jButtonfirst = new JButton();
JLabel jLabel6 = new JLabel();
XYLayout xYLayout2 = new XYLayout();
JLabel jLabel10 = new JLabel();
JTextField jText39 = new JTextField();
JButton jButtonShow = new JButton();
public FrameProductStoryInformation() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
FrameProductStoryInformation frameProductStoryInformation = new FrameProductStoryInformation();
}
private void jbInit() throws Exception {
jPanel1.setLayout(xYLayout2);
jPanel1.setToolTipText("");
jPanel1.setBorder(BorderFactory.createLineBorder(Color.black));
jButtonupdate.setFont(new java.awt.Font("Dialog", 0, 16));
jButtonupdate.setText("更新");
jButtonupdate.addMouseListener(new FrameProductStoryInformation_jButtonupdate_mouseAdapter(this));
jButtonlast.setText("最后一条");
jButtonlast.addMouseListener(new FrameProductStoryInformation_jButtonlast_mouseAdapter(this));
jButtonlast.setFont(new java.awt.Font("Dialog", 0, 16));
jButtonpre.setFont(new java.awt.Font("Dialog", 0, 16));
jButtonpre.setText("前一条");
jButtonpre.addMouseListener(new FrameProductStoryInformation_jButtonpre_mouseAdapter(this));
jText40.setText("");
jLabel11.setText("39");
jLabel11.setFont(new java.awt.Font("Dialog", 0, 16));
jLabel16.setFont(new java.awt.Font("Dialog", 0, 16));
jLabel16.setText("款型 ");
jText36.setText("");
jText37ee.setText("37");
jText37ee.setFont(new java.awt.Font("Dialog", 0, 16));
jButtonSearch.setFont(new java.awt.Font("Dialog", 0, 16));
jButtonSearch.setText("查询");
jButtonSearch.addMouseListener(new FrameProductStoryInformation_jButtonSearch_mouseAdapter(this));
jCombocolor.setFont(new java.awt.Font("Dialog", 0, 16));
jLabel9.setText("40");
jLabel9.setFont(new java.awt.Font("Dialog", 0, 16));
jTextkuanxing.setText("");
jLabel14.setText("44");
jLabel14.setFont(new java.awt.Font("Dialog", 0, 16));
jText37.setText("");
jButtonnext.setFont(new java.awt.Font("Dialog", 0, 16));
jButtonnext.setText("下一条");
jButtonnext.addMouseListener(new FrameProductStoryInformation_jButtonnext_mouseAdapter(this));
jLabel3.setText("颜色");
jLabel3.setFont(new java.awt.Font("Dialog", 0, 16));
jLabel13.setText("43");
jLabel13.setFont(new java.awt.Font("Dialog", 0, 16));
jLabel12.setText("42");
jLabel12.setFont(new java.awt.Font("Dialog", 0, 16));
jText41.setText("");
jText44.setText("");
jLabel4.setFont(new java.awt.Font("Dialog", 0, 16));
jLabel4.setText("");
jLabel8.setText("38");
jLabel8.setFont(new java.awt.Font("Dialog", 0, 16));
this.getContentPane().setLayout(xYLayout1);
//jCombocolor下拉框中添加颜色值
jCombocolor.addItem("");
jCombocolor.addItem("red");
jCombocolor.addItem("black");
jCombocolor.addItem("blue");
jText42.setText("");
jButtonexit.setFont(new java.awt.Font("Dialog", 0, 16));
jButtonexit.setText("退出");
jButtonexit.addMouseListener(new FrameProductStoryInformation_jButtonexit_mouseAdapter(this));
jButtondelete.setFont(new java.awt.Font("Dialog", 0, 16));
jButtondelete.setText("删除");
jButtondelete.addMouseListener(new FrameProductStoryInformation_jButtondelete_mouseAdapter(this));
jText38.setText("");
jButtonfirst.setText("第一条");
jButtonfirst.addMouseListener(new FrameProductStoryInformation_jButtonfirst_mouseAdapter(this));
jButtonfirst.setFont(new java.awt.Font("Dialog", 0, 16));
jLabel6.setFont(new java.awt.Font("Dialog", 0, 16));
jLabel6.setText("36");
jLabel10.setFont(new java.awt.Font("Dialog", 0, 16));
jLabel10.setText("41");
jText39.setText("");
xYLayout1.setWidth(658);
xYLayout1.setHeight(371);
jButtonShow.setFont(new java.awt.Font("Dialog", 0, 16));
jButtonShow.setText("分析结果");
jButtonShow.addMouseListener(new FrameProductStoryInformation_jButtonShow_mouseAdapter(this));
this.setTitle("产品库存信息管理");
jPanel1.add(jLabel11, new XYConstraints(187, 15, 40, 25));
jPanel1.add(jLabel13, new XYConstraints(407, 64, 35, 22));
jPanel1.add(jLabel12, new XYConstraints(410, 20, 35, 21));
jPanel1.add(jLabel14, new XYConstraints(406, 113, 41, 20));
jPanel1.add(jLabel6, new XYConstraints(14, 18, 34, 20));
jPanel1.add(jText37ee, new XYConstraints(13, 61, 41, 22));
jPanel1.add(jLabel8, new XYConstraints(13, 120, 36, 26));
jPanel1.add(jLabel9, new XYConstraints(183, 70, 35, -1));
jPanel1.add(jLabel10, new XYConstraints(185, 122, 34, 21));
jPanel1.add(jText36, new XYConstraints(62, 17, 90, 27));
jPanel1.add(jText37, new XYConstraints(63, 62, 87, 26));
jPanel1.add(jText38, new XYConstraints(64, 120, 85, -1));
jPanel1.add(jText39, new XYConstraints(251, 20, 104, 23));
jPanel1.add(jText40, new XYConstraints(251, 67, 108, 25));
jPanel1.add(jText41, new XYConstraints(252, 122, 109, 23));
jPanel1.add(jText42, new XYConstraints(462, 23, 104, 25));
jPanel1.add(jText43, new XYConstraints(462, 66, 106, 24));
jPanel1.add(jText44, new XYConstraints(462, 112, 108, 21));
this.getContentPane().add(jButtonShow, new XYConstraints(486, 55, 108, 29));
this.getContentPane().add(jButtonSearch, new XYConstraints(485, 17, 109, 29));
this.getContentPane().add(jButtonfirst, new XYConstraints(29, 281, -1, 26));
this.getContentPane().add(jPanel1, new XYConstraints(25, 90, 613, 172));
this.getContentPane().add(jLabel4, new XYConstraints(124, 138, 239, 28));
this.getContentPane().add(jLabel3, new XYConstraints(258, 19, 50, 27));
this.getContentPane().add(jTextkuanxing, new XYConstraints(118, 23, 80, -1));
this.getContentPane().add(jCombocolor, new XYConstraints(352, 19, 80, 24));
this.getContentPane().add(jLabel16, new XYConstraints(25, 20, 83, -1));
this.getContentPane().add(jButtonpre, new XYConstraints(110, 281, 82, 26));
this.getContentPane().add(jButtonnext, new XYConstraints(193, 281, 89, 26));
this.getContentPane().add(jButtonlast, new XYConstraints(282, 281, 105, 27));
this.getContentPane().add(jButtondelete, new XYConstraints(471, 282, 86, 28));
this.getContentPane().add(jButtonexit, new XYConstraints(558, 282, 70, 28));
this.getContentPane().add(jButtonupdate, new XYConstraints(388, 282, 83, 27));
}
//用于在窗体上绑定出与当前游标状态下的rs中的值
void showResult(){
try {
jTextkuanxing.setText(rs.getString("kuanxing") );
jCombocolor.setSelectedItem(rs.getString("color") ) ;
jText36.setText(rs.getString("36") );
jText37.setText(rs.getString("37") );
jText38.setText(rs.getString("38") );
jText39.setText(rs.getString("39") );
jText40.setText(rs.getString("40") );
jText41.setText(rs.getString("41") );
jText42.setText(rs.getString("42") );
jText43.setText(rs.getString("43") );
jText44.setText(rs.getString("44") );
}
catch (SQLException ex) {
System.out.println(ex.toString() ) ;
}
}
//执行制定查询条件下的查询操作
void jButtonSearch_mouseClicked(MouseEvent e) {
//定义变量,用来判断是否是第一个查询条件
boolean isfirst =true;
sql="select * from ProductStore ";
if (jTextkuanxing.getText().trim().length() ==0) //如果款型的查询条件不为空
{}
else
{
sql=sql+" where kuanxing='"+jTextkuanxing.getText().trim()+"'";
isfirst=false;
}//如果颜色的查询条件不为空
if (jCombocolor.getSelectedItem().toString().trim() .length() ==0)
{}
else
{
if (isfirst) //如果是第一个查询条件
sql=sql+" where color='"+jCombocolor.getSelectedItem().toString().trim() +"'";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -