📄 mainframe.java
字号:
String[] valuesOfThird=null;
String selected=null;
String selectedValue=(String)JOptionPane.showInputDialog(null, "请选择查询方式:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, values, values[0]);
if(selectedValue==null){
return;
}
if(selectedValue.equals("按大类查询")){
GetAllNamesFromFirstCatalog allNamesOfFirst=new GetAllNamesFromFirstCatalog();
ResultSet set=allNamesOfFirst.getSet();
int count=0;
tip2=1;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品大类!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfFirst=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfFirst[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品大类:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfFirst, valuesOfFirst[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
if(selectedValue.equals("按明细类查询")){
GetAllNamesFromSecondCatalog allNamesOfSecond=new GetAllNamesFromSecondCatalog();
ResultSet set=allNamesOfSecond.getSet();
int count=0;
tip2=2;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品明细类!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfSecond=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfSecond[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品明细类:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfSecond, valuesOfSecond[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
if(selectedValue.equals("按具体商品查询")){
GetAllNamesFromThirdCatalog allNamesOfThird=new GetAllNamesFromThirdCatalog();
ResultSet set=allNamesOfThird.getSet();
int count=0;
tip2=3;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfThird=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfThird[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品名称:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfThird, valuesOfThird[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
//JOptionPane.showMessageDialog(null, tip1+","+tip2+","+selected,"",JOptionPane.INFORMATION_MESSAGE);//测试tip1,tip2,selected得到的值是否有错
SingleSaleConditionPane singleSaleConditionPane=new SingleSaleConditionPane(tip1,tip2,selected);
JDialog dialog=new JDialog(this,true);
dialog.setSize(600, 400);
dialog.setLocation(100, 50);
dialog.getContentPane().add(singleSaleConditionPane);
dialog.setVisible(true);
}
if(e.getSource()==saleOfThisYear){
int tip1=3;//该参数说明查的是本年的统计数据
int tip2=0;//该参数说明查的是本年的哪一类的统计数据
String[] values={"按大类查询","按明细类查询","按具体商品查询"};
String[] valuesOfFirst=null;
String[] valuesOfSecond=null;
String[] valuesOfThird=null;
String selected=null;
String selectedValue=(String)JOptionPane.showInputDialog(null, "请选择查询方式:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, values, values[0]);
if(selectedValue==null){
return;
}
if(selectedValue.equals("按大类查询")){
GetAllNamesFromFirstCatalog allNamesOfFirst=new GetAllNamesFromFirstCatalog();
ResultSet set=allNamesOfFirst.getSet();
int count=0;
tip2=1;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品大类!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfFirst=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfFirst[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品大类:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfFirst, valuesOfFirst[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
if(selectedValue.equals("按明细类查询")){
GetAllNamesFromSecondCatalog allNamesOfSecond=new GetAllNamesFromSecondCatalog();
ResultSet set=allNamesOfSecond.getSet();
int count=0;
tip2=2;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品明细类!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfSecond=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfSecond[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品明细类:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfSecond, valuesOfSecond[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
if(selectedValue.equals("按具体商品查询")){
GetAllNamesFromThirdCatalog allNamesOfThird=new GetAllNamesFromThirdCatalog();
ResultSet set=allNamesOfThird.getSet();
int count=0;
tip2=3;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfThird=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfThird[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品名称:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfThird, valuesOfThird[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
SingleSaleConditionPane singleSaleConditionPane=new SingleSaleConditionPane(tip1,tip2,selected);
JDialog dialog=new JDialog(this,true);
dialog.setSize(600, 400);
dialog.setLocation(100, 50);
dialog.getContentPane().add(singleSaleConditionPane);
dialog.setVisible(true);
}
if(e.getSource()==store_in){
int tip1=0;
String[] values={"按大类查询","按明细类查询","按具体商品查询"};
String[] valuesOfFirst=null;
String[] valuesOfSecond=null;
String[] valuesOfThird=null;
String selected=null;
String selectedValue=(String)JOptionPane.showInputDialog(null, "请选择查询方式:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, values, values[0]);
if(selectedValue==null){
return;
}
if(selectedValue.equals("按大类查询")){
GetAllNamesFromFirstCatalog allNamesOfFirst=new GetAllNamesFromFirstCatalog();
ResultSet set=allNamesOfFirst.getSet();
int count=0;
tip1=1;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品大类!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfFirst=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfFirst[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品大类:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfFirst, valuesOfFirst[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
if(selectedValue.equals("按明细类查询")){
GetAllNamesFromSecondCatalog allNamesOfSecond=new GetAllNamesFromSecondCatalog();
ResultSet set=allNamesOfSecond.getSet();
int count=0;
tip1=2;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品明细类!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfSecond=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfSecond[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品明细类:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfSecond, valuesOfSecond[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
if(selectedValue.equals("按具体商品查询")){
GetAllNamesFromThirdCatalog allNamesOfThird=new GetAllNamesFromThirdCatalog();
ResultSet set=allNamesOfThird.getSet();
int count=0;
tip1=3;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何具体商品!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfThird=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfThird[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择具体商品:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfThird, valuesOfThird[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
ClassStore classStore=new ClassStore(tip1,selected);
JDialog dialog=new JDialog(this,true);
dialog.setSize(600, 400);
dialog.setLocation(100, 50);
dialog.getContentPane().add(classStore);
dialog.setVisible(true);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -