Ejemplo n.º 1
0
    BusinessPane() {
      setLayout(null);
      add(info_label);
      info_label.setBounds(10, 10, 300, 20);
      info_label.setFont(new Font("TimesRoman", Font.BOLD, 12));
      add(info_scroll);
      info_scroll.setBounds(5, 35, 615, 400);
      info_name.add(columnName[0]);
      info_name.add(columnName[1]);
      info_name.add(columnName[2]);
      info_name.add(columnName[3]);
      DefaultTableModel info_model = new DefaultTableModel(info_data, info_name);
      info_table.setModel(info_model);
      info_table.getColumnModel().getColumn(0).setWidth(25);
      info_table.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
              if (e.getClickCount() == 1) { // click to trigger the event
                // show_selected();
                // System.out.print(table_selected(0));
              }
            }
          });

      add(B_refresh);
      B_refresh.setMargin(new java.awt.Insets(1, 1, 1, 1));
      B_refresh.setBounds(530, 440, 90, 25);
      B_refresh.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              update_table();
            }
          });
    }
Ejemplo n.º 2
0
    MemberPane() {
      setLayout(null);
      /*add(B_add);
      B_add.setMargin(new java.awt.Insets(1, 1, 1, 1));
      B_add.setBounds(230,440,90,25);
      B_add.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent event){
                	String[] data={T_title.getText(),T_director.getText(),T_actor.getText(),T_actress.getText()};
                	DBcore.addData("movie_info",data);
                	DBcore.showDB("movie_info", movie_column,info_data,info_table);
                }
            });*/
      add(B_delete);
      B_delete.setMargin(new java.awt.Insets(1, 1, 1, 1));
      B_delete.setBounds(330, 440, 90, 25);
      B_delete.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              if (id != null) {
                int confirm =
                    JOptionPane.showConfirmDialog(
                        mainFrame, "是否删除该用户?", "删除提示", JOptionPane.OK_CANCEL_OPTION);
                if (confirm == JOptionPane.OK_OPTION) {
                  Database.deleteData("member", "id", id);
                }
                T_title.setText("");
                T_director.setText("");
                T_actor.setText("");
                T_actress.setText("");
              }
              update_table();
            }
          });
      /*add(B_edit);
      B_edit.setMargin(new java.awt.Insets(1, 1, 1, 1));
      B_edit.setBounds(430,440,90,25);
      B_edit.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent event){
                	String[] data={T_title.getText(),T_director.getText(),T_actor.getText(),T_actress.getText()};
                	if(id!=null){
                	DBcore.updateData("movie_info", "no", id, detail_column, data);
                	}
                	DBcore.showDB("movie_info", movie_column,info_data,info_table);
                }
            });*/

      add(B_refresh);
      B_refresh.setMargin(new java.awt.Insets(1, 1, 1, 1));
      B_refresh.setBounds(530, 440, 90, 25);
      B_refresh.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              update_table();
            }
          });

      add(info_label);
      info_label.setBounds(10, 10, 300, 20);
      info_label.setFont(new Font("TimesRoman", Font.BOLD, 12));
      add(info_scroll);
      info_scroll.setBounds(5, 35, 615, 400);
      info_name.add(columnName[0]);
      info_name.add(columnName[1]);
      info_name.add(columnName[2]);
      info_name.add(columnName[3]);
      info_name.add(columnName[4]);
      DefaultTableModel info_model = new DefaultTableModel(info_data, info_name);
      info_table.setModel(info_model);
      info_table.getColumnModel().getColumn(0).setWidth(25);
      info_table.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
              if (e.getClickCount() == 1) { // click to trigger the event
                show_selected();
                System.out.print(table_selected(0));
              }
            }
          });
      /*add(edit_panel);
      Border border=BorderFactory.createEtchedBorder(1);
      Border title1=BorderFactory.createTitledBorder(border,"Edit Area");
      edit_panel.setBorder(title1);
      edit_panel.setBounds(5,470,615,125);
      edit_panel.setLayout(null);
      edit_panel.add(L_title);
      edit_panel.add(L_director);
      edit_panel.add(L_actor);
      edit_panel.add(L_actress);
      edit_panel.add(T_title);
      edit_panel.add(T_director);
      edit_panel.add(T_actor);
      edit_panel.add(T_actress);
      L_title.setBounds(40,30,100,25);
      L_director.setBounds(325,30,100,25);
      L_actor.setBounds(40,75,100,25);
      L_actress.setBounds(325,75,100,25);
      T_title.setBounds(140,30,150,25);
      T_director.setBounds(425,30,150,25);
      T_actor.setBounds(140,75,150,25);
      T_actress.setBounds(425,75,150,25);*/
    }