示例#1
0
文件: MainForm.java 项目: andsp/oou
 private void initUI() {
   tblMain.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   refresh();
   btAdd.addActionListener(
       e -> {
         PropertyForm.start(null);
         refresh();
       });
   btEdit.addActionListener(e -> editAction());
   btRemove.addActionListener(
       e -> {
         Instance instance =
             ((InstanceTableModel) tblMain.getModel()).getItem(tblMain.getSelectedRow());
         if (instance != null && !instance.isNew()) {
           int dialogButton = JOptionPane.YES_NO_OPTION;
           int dialogResult =
               JOptionPane.showConfirmDialog(null, "Remove row ?", "Confirm", dialogButton);
           if (dialogResult == 0) {
             ConfigHelper.getInstance().remove(instance);
             refresh();
           }
         }
       });
   btRun.addActionListener(e -> this.startLoad(this));
   progressBar.setMinimum(0);
   progressBar.setStringPainted(true);
   tblMain.addMouseListener(
       new MouseAdapter() {
         public void mousePressed(MouseEvent me) {
           if (me.getClickCount() == 2) {
             editAction();
           }
         }
       });
 }
示例#2
0
文件: MainForm.java 项目: andsp/oou
 private void refresh() {
   tblMain.setModel(new InstanceTableModel(ConfigHelper.getInstance().getInstances()));
 }