Java--swing弹出框,多输入(选择)条件

来源:互联网 发布:java 读取配置文件 编辑:程序博客网 时间:2024/05/10 16:25
  JComboBox jcb1 = new JComboBox<Object>(strs1); 
     JComboBox jcb2 = new JComboBox<Object>(strs2); 
     
     //jcb1.setBounds(10+330+xOffset, firstOffsetY, 90, iLabelHeight);


     JPanel myPanel = new JPanel();
     myPanel.setBounds(40, 80, 200, 300);
     myPanel.add(new JLabel("芯片号:"));
     myPanel.add(jcb1);
     myPanel.add(Box.createHorizontalStrut(15)); // a spacer
     myPanel.add(new JLabel("消费终端:"));
     myPanel.add(jcb2);


 int result = JOptionPane.showConfirmDialog(null, myPanel, 
              "请选择查询条件", JOptionPane.OK_CANCEL_OPTION);
     if (result == JOptionPane.OK_OPTION) {
        //System.out.println("芯片号: " + jcb1.getSelectedItem().toString());
        txtCardNo.setText(card_no+"("+jcb1.getSelectedItem().toString()+")");
     }
            }
原创粉丝点击