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

📄 requiredialog.java~1~

📁 基于面向对象的数据库编程
💻 JAVA~1~
📖 第 1 页 / 共 2 页
字号:
package view;import java.awt.*;import javax.swing.*;import javax.swing.table.*;import com.borland.jbcl.layout.*;import java.awt.event.*;import brgeometry.*;import java.util.*;import helper.ProBag.*;import com.versant.fund.*;import com.versant.trans.*;import operation.*;import javax.swing.border.*;public class requireDialog extends JDialog {  DefaultTableModel  SolidDtm; //定义体(平面体.曲面体)表格的数据模型  DefaultTableModel  cuboidDtm; //定义长方体表格的数据模型  DefaultTableModel  squareDtm; //定义立方体表格的数据模型  DefaultTableModel  cylinderDtm; //定义圆柱体表格的数据模型  DefaultTableModel  coneDtm; //定义圆锥体表格的数据模型  DefaultTableModel  SphereDtm; //定义球体表格的数据模型  Vector SolidVCdata =new Vector(); //定义表的列名(以vector存储)  Vector cuboidVCdata =new Vector(); //定义表的列名(以vector存储)  Vector squareVCdata =new Vector(); //定义表的列名(以vector存储)  Vector cylinderVCdata =new Vector(); //定义表的列名(以vector存储)  Vector coneVCdata =new Vector(); //定义表的列名(以vector存储)  Vector sphereVCdata =new Vector(); //定义表的列名(以vector存储)  VEnumeration result = null; //查询表的数据集合  private JPanel panel1 = new JPanel();  private XYLayout xYLayout1 = new XYLayout();  private JLabel jLabel1 = new JLabel();  private JTabbedPane jTabbedPane1 = new JTabbedPane();  private JPanel jPanel1 = new JPanel();  private JPanel jPanel2 = new JPanel();  private JPanel jPanel4 = new JPanel();  private JRadioButton jRadioButton1 = new JRadioButton();  private XYLayout xYLayout2 = new XYLayout();  private JRadioButton jRadioButton2 = new JRadioButton();  private JRadioButton jRadioButton3 = new JRadioButton();  private JRadioButton jRadioButton4 = new JRadioButton();  private ButtonGroup buttonGroup1 = new ButtonGroup();  private JComboBox jComboBox1 = new JComboBox();  private JLabel jLabel2 = new JLabel();  private JRadioButton jRadioButton5 = new JRadioButton();  private XYLayout xYLayout3 = new XYLayout();  private JRadioButton jRadioButton6 = new JRadioButton();  private JRadioButton jRadioButton9 = new JRadioButton();  private JRadioButton jRadioButton7 = new JRadioButton();  private JRadioButton jRadioButton8 = new JRadioButton();  private JTextField jTextField1 = new JTextField();  private JLabel jLabel3 = new JLabel();  private JButton jButton1 = new JButton();  private JButton jButton2 = new JButton();  private JButton jButton3 = new JButton();  private JButton jButton6 = new JButton();  private JButton jButton4 = new JButton();  private JList jList1 = new JList();  private XYLayout xYLayout5 = new XYLayout();  private JList jList2 = new JList();  private JList jList3 = new JList();  private JLabel jLabel5 = new JLabel();  private JLabel jLabel6 = new JLabel();  private JLabel jLabel7 = new JLabel();  private JTextField jTextField3 = new JTextField();  private JLabel jLabel8 = new JLabel();  private JComboBox jComboBox2 = new JComboBox();  private JLabel jLabel4 = new JLabel();  private JLabel jLabel9 = new JLabel();  private JLabel jLabel10 = new JLabel();  private JRadioButton jRadioButton10 = new JRadioButton();  private JRadioButton jRadioButton11 = new JRadioButton();  private ButtonGroup buttonGroup2 = new ButtonGroup();  private ButtonGroup buttonGroup3 = new ButtonGroup();  private JPopupMenu jPopupMenu1 = new JPopupMenu();  private JButton jButton5 = new JButton();  private JButton jButton7 = new JButton();  private JButton jButton8 = new JButton();  private TitledBorder titledBorder1;  private TitledBorder titledBorder2;  private TitledBorder titledBorder3;  private JScrollPane jScrollPane1 = new JScrollPane();  private JTable jTable1 = new JTable();  public requireDialog(Frame frame, String title, boolean modal) {    super(frame, title, modal);    try {      jbInit();      userInit(); //自定义的操作都在次方法中      pack();    }    catch(Exception ex) {      ex.printStackTrace();    }  }  public requireDialog() {    this(null, "", false);  }  private void jbInit() throws Exception {    titledBorder1 = new TitledBorder("");    titledBorder2 = new TitledBorder("");    titledBorder3 = new TitledBorder("");    panel1.setLayout(xYLayout1);    panel1.setBackground(SystemColor.info);    jLabel1.setFont(new java.awt.Font("Dialog", 0, 20));    jLabel1.setForeground(Color.red);    jLabel1.setText("查询");    jTabbedPane1.setBackground(SystemColor.info);    jTabbedPane1.setBorder(BorderFactory.createEtchedBorder());    jPanel4.setBackground(SystemColor.info);    jPanel4.setBorder(BorderFactory.createLineBorder(Color.black));    jPanel4.setLayout(xYLayout5);    jPanel2.setBackground(SystemColor.info);    jPanel2.setBorder(BorderFactory.createLineBorder(Color.black));    jPanel2.setLayout(xYLayout3);    jPanel1.setBackground(SystemColor.info);    jPanel1.setBorder(BorderFactory.createLineBorder(Color.black));    jPanel1.setLayout(xYLayout2);    jRadioButton1.setBackground(SystemColor.info);    jRadioButton1.setSelected(true);    jRadioButton1.setText("查询所有体");    jRadioButton1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jRadioButton1_actionPerformed(e);      }    });    jRadioButton2.setBackground(SystemColor.info);    jRadioButton2.setText("查询所有平面体");    jRadioButton2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jRadioButton2_actionPerformed(e);      }    });    jRadioButton3.setBackground(SystemColor.info);    jRadioButton3.setText("查询所有曲面体");    jRadioButton3.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jRadioButton3_actionPerformed(e);      }    });    jRadioButton4.setBackground(SystemColor.info);    jRadioButton4.setText("查询所有的具体的体");    jRadioButton4.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jRadioButton4_actionPerformed(e);      }    });    jLabel2.setText("请输入所要查询的体的类型");    jRadioButton5.setBackground(SystemColor.info);    jRadioButton5.setSelected(true);    jRadioButton5.setText("按表面查询");    jRadioButton6.setBackground(SystemColor.info);    jRadioButton6.setText("按体积查询");    jRadioButton9.setBackground(SystemColor.info);    jRadioButton9.setText("大于");    jRadioButton7.setBackground(SystemColor.info);    jRadioButton7.setSelected(true);    jRadioButton7.setText("小于");    jRadioButton8.setBackground(SystemColor.info);    jRadioButton8.setText("等于");    jLabel3.setText("指定条件");    jButton1.setBackground(SystemColor.inactiveCaptionText);    jButton1.setBorder(BorderFactory.createLineBorder(Color.black));    jButton1.setText("确定");    jButton1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton1_actionPerformed(e);      }    });    jButton2.setBackground(SystemColor.inactiveCaptionText);    jButton2.setBorder(BorderFactory.createLineBorder(Color.black));    jButton2.setText("重置");    jButton2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton2_actionPerformed(e);      }    });    jButton3.setBackground(SystemColor.inactiveCaptionText);    jButton3.setBorder(BorderFactory.createLineBorder(Color.black));    jButton3.setText("取消");    jButton3.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton3_actionPerformed(e);      }    });    jButton6.setBackground(SystemColor.inactiveCaptionText);    jButton6.setBorder(BorderFactory.createLineBorder(Color.black));    jButton6.setText("取消");    jButton6.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton6_actionPerformed(e);      }    });    jButton4.setBackground(SystemColor.inactiveCaptionText);    jButton4.setBorder(BorderFactory.createLineBorder(Color.black));    jButton4.setText("确定");    jButton4.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton4_actionPerformed(e);      }    });    jList1.setBackground(SystemColor.inactiveCaption);    jList1.setBorder(BorderFactory.createEtchedBorder());    jList2.setBackground(SystemColor.inactiveCaption);    jList2.setBorder(titledBorder2);    jList3.setBackground(SystemColor.inactiveCaption);    jList3.setBorder(titledBorder1);    jLabel5.setBorder(BorderFactory.createEtchedBorder());    jLabel5.setText("                面");    jLabel6.setBorder(BorderFactory.createEtchedBorder());    jLabel6.setText("                线");    jLabel7.setBorder(BorderFactory.createEtchedBorder());    jLabel7.setText("               点");    jLabel8.setText("请输入您要查询的体");    jLabel4.setText("查询体");    jLabel9.setText("查询面");    jLabel10.setText("查询线");    jRadioButton10.setBackground(SystemColor.info);    jRadioButton10.setText(" 按面积查询");    jRadioButton11.setBackground(SystemColor.info);    jRadioButton11.setText("按长度查询");    jButton5.setBackground(SystemColor.inactiveCaptionText);    jButton5.setBorder(BorderFactory.createLineBorder(Color.black));    jButton5.setText("确定");    jButton5.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton5_actionPerformed(e);      }    });    jButton7.setBackground(SystemColor.inactiveCaptionText);    jButton7.setBorder(BorderFactory.createLineBorder(Color.black));    jButton7.setText("重置");    jButton7.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton7_actionPerformed(e);      }    });    jButton8.setBackground(SystemColor.inactiveCaptionText);    jButton8.setBorder(BorderFactory.createLineBorder(Color.black));    jButton8.setText("取消");    jButton8.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton8_actionPerformed(e);      }    });    jComboBox1.setEnabled(false);    jComboBox1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jComboBox1_actionPerformed(e);      }    });    jScrollPane1.getViewport().setBackground(UIManager.getColor("CheckBoxMenuItem.background"));    jScrollPane1.setBorder(BorderFactory.createLineBorder(Color.black));    jTable1.setBackground(SystemColor.activeCaptionText);    jTable1.setBorder(BorderFactory.createLineBorder(Color.blue));    jTable1.setToolTipText("查询显示");    jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);    jTable1.setGridColor(Color.blue);    jTable1.setSelectionForeground(Color.darkGray);    jTable1.setTableHeader(null);    getContentPane().add(panel1);    panel1.add(jTabbedPane1,            new XYConstraints(54, 104, 364, 358));    jPanel1.add(jButton4,    new XYConstraints(53, 236, 64, 26));    jPanel1.add(jRadioButton3, new XYConstraints(37, 94, -1, -1));    jPanel1.add(jRadioButton1,  new XYConstraints(37, 44, -1, -1));    jPanel1.add(jComboBox1, new XYConstraints(165, 167, 143, 24));    jPanel1.add(jLabel2, new XYConstraints(157, 141, -1, -1));    jPanel1.add(jButton6, new XYConstraints(176, 235, 54, 27));    jPanel1.add(jRadioButton2, new XYConstraints(178, 43, -1, -1));    jPanel1.add(jRadioButton4,  new XYConstraints(179, 89, -1, -1));    jTabbedPane1.add(jPanel2,  "条件查询");    jPanel2.add(jRadioButton5, new XYConstraints(18, 43, -1, -1));    jPanel2.add(jLabel4, new XYConstraints(38, 17, 67, -1));    jPanel2.add(jRadioButton6, new XYConstraints(18, 68, -1, -1));    jPanel2.add(jLabel9, new XYConstraints(127, 17, -1, -1));    jPanel2.add(jRadioButton10, new XYConstraints(109, 41, -1, -1));    jPanel2.add(jLabel10, new XYConstraints(227, 19, -1, -1));    jPanel2.add(jRadioButton11, new XYConstraints(209, 41, -1, -1));    jPanel2.add(jRadioButton8, new XYConstraints(108, 120, -1, -1));    jPanel2.add(jLabel3, new XYConstraints(29, 158, 74, 27));    jPanel2.add(jTextField1, new XYConstraints(101, 162, 122, 26));    jPanel2.add(jRadioButton7, new XYConstraints(19, 121, -1, -1));    jPanel2.add(jRadioButton9, new XYConstraints(210, 121, -1, -1));    jPanel2.add(jButton3,    new XYConstraints(219, 226, 75, 27));    jPanel2.add(jButton2, new XYConstraints(125, 226, 77, 27));    jPanel2.add(jButton1, new XYConstraints(30, 226, 80, 28));    jTabbedPane1.add(jPanel4,   "高级查询");    jPanel4.add(jList1,           new XYConstraints(19, 145, 83, 152));    jPanel4.add(jTextField3,  new XYConstraints(24, 89, 111, 25));    jPanel4.add(jLabel8, new XYConstraints(23, 61, 167, 20));    jPanel4.add(jComboBox2,   new XYConstraints(22, 32, 113, -1));    jPanel4.add(jButton5,       new XYConstraints(172, 56, 73, 29));    jPanel4.add(jButton7,  new XYConstraints(277, 57, 65, 27));    jPanel4.add(jButton8,  new XYConstraints(370, 56, 61, 27));    jPanel4.add(jList3,   new XYConstraints(247, 144, 89, 154));    jPanel4.add(jLabel6,   new XYConstraints(126, 120, 90, 21));    jPanel4.add(jLabel7,    new XYConstraints(243, 121, 91, 21));    jPanel4.add(jLabel5,     new XYConstraints(19, 120, 81, 23));    jPanel4.add(jList2, new XYConstraints(126, 144, 85, 155));    jTabbedPane1.add(jPanel1, "展示性查询");    panel1.add(jScrollPane1,              new XYConstraints(425, 103, 554, 354));    jScrollPane1.getViewport().add(jTable1, null);    //jScrollPane1.    // jScrollPane1.getViewport().add(jTable2, null);    panel1.add(jLabel1,  new XYConstraints(200, 60, 107, -1));    buttonGroup1.add(jRadioButton1);    buttonGroup1.add(jRadioButton2);    buttonGroup1.add(jRadioButton3);    buttonGroup1.add(jRadioButton4);    buttonGroup2.add(jRadioButton5);    buttonGroup2.add(jRadioButton6);    buttonGroup2.add(jRadioButton10);    buttonGroup2.add(jRadioButton11);    buttonGroup3.add(jRadioButton8);    buttonGroup3.add(jRadioButton7);    buttonGroup3.add(jRadioButton9);    jComboBox1.addItem("");    jComboBox1.addItem("长方体");    jComboBox1.addItem("立方体");    jComboBox1.addItem("圆柱体");    jComboBox1.addItem("圆锥体");    jComboBox1.addItem("球体" );    jComboBox2.addItem("");    jComboBox2.addItem("长方体");    jComboBox2.addItem("立方体");    jComboBox2.addItem("圆柱体");    jComboBox2.addItem("圆锥体");    jComboBox2.addItem("球体" );  }  /*userInit() 数据表格的初始化*/  public void userInit()  {    SolidDtm=new DefaultTableModel(); //定义模式    SolidVCdata.add("类型");    SolidVCdata.add("表面积");    SolidVCdata.add("体积");    /**for 列出标题烂**/    for(int i=0;i<SolidVCdata.size();i++)      SolidDtm.addColumn((String)SolidVCdata.elementAt(i));    cuboidDtm=new DefaultTableModel(); //定义模式    cuboidVCdata.add("名字");    cuboidVCdata.add("长度");    cuboidVCdata.add("高度");    cuboidVCdata.add("宽度");    cuboidVCdata.add("体积");    cuboidVCdata.add("表面积");    /**for 列出标题烂**/    for(int i=0;i<cuboidVCdata.size();i++)      cuboidDtm.addColumn((String)cuboidVCdata.elementAt(i));    squareDtm=new DefaultTableModel(); //定义模式    squareVCdata.add("名字");    squareVCdata.add("边长");    squareVCdata.add("表面积");    squareVCdata.add("体积");    /**for 列出标题烂**/    for(int i=0;i<squareVCdata.size();i++)      squareDtm.addColumn((String)squareVCdata.elementAt(i));    cylinderDtm=new DefaultTableModel(); //定义模式    cylinderVCdata.add("名字");    cylinderVCdata.add("底面半径");    cylinderVCdata.add("高度");    cylinderVCdata.add("表面积");    cylinderVCdata.add("体积");    /**for 列出标题烂**/    for(int i=0;i<cylinderVCdata.size();i++)      cylinderDtm.addColumn((String)cylinderVCdata.elementAt(i));    coneDtm=new DefaultTableModel(); //定义模式    coneVCdata.add("名字");    coneVCdata.add("底面半径");    coneVCdata.add("高度");

⌨️ 快捷键说明

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