コード例 #1
4
 /** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user changed the service filter option
   if (e.getSource() == service_box) {
     service_list.setEnabled(service_box.isSelected());
     service_list.clearSelection();
     remove_service_button.setEnabled(false);
     add_service_field.setEnabled(service_box.isSelected());
     add_service_field.setText("");
     add_service_button.setEnabled(false);
   }
   // Check if the user pressed the add service button
   if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) {
     String text = add_service_field.getText();
     if ((text != null) && (text.length() > 0)) {
       service_data.addElement(text);
       service_list.setListData(service_data);
     }
     add_service_field.setText("");
     add_service_field.requestFocus();
   }
   // Check if the user pressed the remove service button
   if (e.getSource() == remove_service_button) {
     Object[] sels = service_list.getSelectedValues();
     for (int i = 0; i < sels.length; i++) {
       service_data.removeElement(sels[i]);
     }
     service_list.setListData(service_data);
     service_list.clearSelection();
   }
 }
コード例 #2
1
  private JPanel createDynamicCenterPanel(PrimitiveForm primitiveForm, DOTProperty property) {
    final JTable theTable = new JTable();
    PrimitiveFormPropertyPair pfpPair =
        new PrimitiveFormPropertyPair(primitiveForm.getName(), property);
    _dynamicTables.put(pfpPair, theTable);
    DOTPoint dotPoint = (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType();
    final DynamicDOTItemManager tableModel =
        (DynamicDOTItemManager) dotPoint.getTableModel(primitiveForm, property);
    theTable.setModel(tableModel);

    class NumberComparator implements Comparator<Number> {

      public int compare(Number o1, Number o2) {
        final double d1 = o1.doubleValue();
        final double d2 = o2.doubleValue();
        if (d1 < d2) {
          return -1;
        }
        if (d1 == d2) {
          return 0;
        }
        return 1;
      }
    }
    TableRowSorter<DynamicDOTItemManager> tableRowSorter =
        new TableRowSorter<DynamicDOTItemManager>();
    tableRowSorter.setModel(tableModel);
    tableRowSorter.setComparator(4, new NumberComparator());
    tableRowSorter.setComparator(5, new NumberComparator());
    theTable.setRowSorter(tableRowSorter);

    JButton newDOTItemButton = new JButton("Neue Zeile");
    newDOTItemButton.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JButton deleteDOTItemButton = new JButton("Zeile löschen");
    deleteDOTItemButton.setEnabled(false);
    JButton showConflictsButton = new JButton("Zeige Konflikte");

    addButtonListeners(
        primitiveForm, property, newDOTItemButton, deleteDOTItemButton, showConflictsButton);
    addListSelectionListener(theTable, deleteDOTItemButton);

    JPanel dotButtonsPanel = new JPanel();
    dotButtonsPanel.setLayout(new SpringLayout());

    dotButtonsPanel.add(newDOTItemButton);
    dotButtonsPanel.add(deleteDOTItemButton);
    dotButtonsPanel.add(showConflictsButton);

    dotButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
    SpringUtilities.makeCompactGrid(dotButtonsPanel, 1, 5, 20);

    JPanel thePanel = new JPanel();
    thePanel.setLayout(new SpringLayout());
    thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK));
    thePanel.add(new JScrollPane(theTable));
    thePanel.add(dotButtonsPanel);
    SpringUtilities.makeCompactGrid(thePanel, 2, 20, 5);

    return thePanel;
  }
コード例 #3
0
ファイル: GenXml.java プロジェクト: abel533/EasyXls
 private void prev1() {
   prevBtn.setEnabled(true);
   nextBtn.setEnabled(true);
   doneBtn.setEnabled(false);
   card.previous(pane);
   step--;
 }
コード例 #4
0
ファイル: SurveyWizard.java プロジェクト: edexpit/dotcomgame
  SurveyPanel(String ques, String[] resp, int def) {
    super();
    setSize(160, 110);
    question = new JLabel(ques);
    response = new JRadioButton[resp.length];
    JPanel sub1 = new JPanel();
    ButtonGroup group = new ButtonGroup();
    JLabel quesLabel = new JLabel(ques);
    sub1.add(quesLabel);
    JPanel sub2 = new JPanel();
    for (int i = 0; i < resp.length; i++) {

      if (def == i) {

        response[i] = new JRadioButton(resp[i], true);
      } else {
        response[i] = new JRadioButton(resp[i], false);
      }

      group.add(response[i]);
      sub2.add(response[i]);
    }

    JPanel sub3 = new JPanel();
    nextButton.setEnabled(true);
    sub3.add(nextButton);
    finalButton.setEnabled(false);
    sub3.add(finalButton);
    GridLayout grid = new GridLayout(3, 1);
    setLayout(grid);
    add(sub1);
    add(sub2);
    add(sub3);
  }
コード例 #5
0
  private void onBatch() {
    final boolean b = useBatchInputCheckbox.isSelected();

    orientationComboBox.setEnabled(b);
    lengthField.setEnabled(b);
    dpiXField.setEnabled(b);
    dpiYField.setEnabled(b);
    startDepthField.setEnabled(b);
    depthIncField.setEnabled(b);
    applyToAllButton.setEnabled(b);
    applyToSelectedButton.setEnabled(b);

    if (!b) {
      orientationLabel.setEnabled(b);
      lengthLabel.setEnabled(b);
      dpiXLabel.setEnabled(b);
      dpiYLabel.setEnabled(b);
      startDepthLabel.setEnabled(b);
      depthIncLabel.setEnabled(b);
    } else {
      orientationLabel.setEnabled(orientationComboBox.getSelectedIndex() != 2); // [Blank]
      lengthLabel.setEnabled(!lengthField.getText().equals(""));
      dpiXLabel.setEnabled(!dpiXField.getText().equals(""));
      dpiYLabel.setEnabled(!dpiYField.getText().equals(""));
      startDepthLabel.setEnabled(!startDepthField.getText().equals(""));
      depthIncLabel.setEnabled(!depthIncField.getText().equals(""));
    }
  }
コード例 #6
0
  /**
   * Handles the various button clicking type activities.
   *
   * @param e a value of type 'ActionEvent'
   */
  public void actionPerformed(ActionEvent e) {

    if (e.getSource() == m_ConfigureBut) {
      selectProperty();
    } else if (e.getSource() == m_StatusBox) {
      // notify any listeners
      for (int i = 0; i < m_Listeners.size(); i++) {
        ActionListener temp = ((ActionListener) m_Listeners.elementAt(i));
        temp.actionPerformed(
            new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Editor status change"));
      }

      // Toggles whether the custom property is used
      if (m_StatusBox.getSelectedIndex() == 0) {
        m_Exp.setUsePropertyIterator(false);
        m_ConfigureBut.setEnabled(false);
        m_ArrayEditor.setEnabled(false);
        m_ArrayEditor.setValue(null);
        validate();
      } else {
        if (m_Exp.getPropertyArray() == null) {
          selectProperty();
        }
        if (m_Exp.getPropertyArray() == null) {
          m_StatusBox.setSelectedIndex(0);
        } else {
          m_Exp.setUsePropertyIterator(true);
          m_ConfigureBut.setEnabled(true);
          m_ArrayEditor.setEnabled(true);
        }
        validate();
      }
    }
  }
コード例 #7
0
 /** Stop talking to the server */
 public void stop() {
   if (socket != null) {
     // Close all the streams and socket
     if (out != null) {
       try {
         out.close();
       } catch (IOException ioe) {
       }
       out = null;
     }
     if (in != null) {
       try {
         in.close();
       } catch (IOException ioe) {
       }
       in = null;
     }
     if (socket != null) {
       try {
         socket.close();
       } catch (IOException ioe) {
       }
       socket = null;
     }
   } else {
     // Already stopped
   }
   // Make sure the right buttons are enabled
   start_button.setEnabled(true);
   stop_button.setEnabled(false);
   setStatus(STATUS_STOPPED);
 }
コード例 #8
0
 /** Requests the list of all lost packages */
 private void buttonShowLostActionPerformed(ActionEvent event) {
   this.packages = DataAdapter.getLostPackages();
   this.jListPackages.setListData(new Vector(this.packages));
   jButtonSetLost.setEnabled(false);
   jButtonSetFound.setEnabled(this.packages.size() > 0);
   jListScans.setListData(new Vector());
 }
コード例 #9
0
 /** Listener to handle service list selection changes */
 public void valueChanged(ListSelectionEvent e) {
   if (service_list.getSelectedIndex() == -1) {
     remove_service_button.setEnabled(false);
   } else {
     remove_service_button.setEnabled(true);
   }
 }
コード例 #10
0
 /** Start talking to the server */
 public void start() {
   String codehost = getCodeBase().getHost();
   if (socket == null) {
     try {
       // Open the socket to the server
       socket = new Socket(codehost, port);
       // Create output stream
       out = new ObjectOutputStream(socket.getOutputStream());
       out.flush();
       // Create input stream and start background
       // thread to read data from the server
       in = new ObjectInputStream(socket.getInputStream());
       new Thread(this).start();
     } catch (Exception e) {
       // Exceptions here are unexpected, but we can't
       // really do anything (so just write it to stdout
       // in case someone cares and then ignore it)
       System.out.println("Exception! " + e.toString());
       e.printStackTrace();
       setErrorStatus(STATUS_NOCONNECT);
       socket = null;
     }
   } else {
     // Already started
   }
   if (socket != null) {
     // Make sure the right buttons are enabled
     start_button.setEnabled(false);
     stop_button.setEnabled(true);
     setStatus(STATUS_ACTIVE);
   }
 }
コード例 #11
0
 /** Enalbe all the view history related toolbar icons. */
 public void enableHistoryButtons() {
   pbBack.setEnabled(history.canGoBack());
   pbShowBackHistory.setEnabled(history.canGoBack());
   pbForward.setEnabled(history.canGoForward());
   pbShowForwardHistory.setEnabled(history.canGoForward());
   tbrToolBar.repaint();
 }
コード例 #12
0
 private void selFolder() {
   // selects a single folder, then makes table uneditable other than launch, sel res folder and
   // cancel, gui table different, just shows folder
   final JFileChooser fc = new JFileChooser(currentPath);
   fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
   int result = fc.showOpenDialog(FrontEnd.this);
   dir = fc.getSelectedFile();
   switch (result) {
     case JFileChooser.APPROVE_OPTION:
       dirImp = dir.toString();
       dtm.getDataVector().removeAllElements();
       dtm.fireTableDataChanged();
       curRow = 0;
       addRow();
       dtm.setValueAt(
           "You have chosen the folder '" + dirImp.substring(67) + "' and all of its subfolders.",
           0,
           0);
       dtm.setValueAt(dirImp.substring(67), 0, 1);
       if (table.getRowCount() > 0) {
         openF.setEnabled(false);
         openFo.setEnabled(false);
         selFo.setEnabled(false);
         canF.setEnabled(true);
       }
       selFoFl = 1;
     case JFileChooser.CANCEL_OPTION:
       break;
   }
 }
コード例 #13
0
  void setData(boolean equal, Trace newTrace, Trace oldTrace) {
    boolean equalComments = newTrace.getComment().equals(oldTrace.getComment());
    if (equal) {
      if (equalComments) {
        messageLabel.setText("Passed");
        saveButton.setEnabled(false);
        replaceButton.setEnabled(false);
      } else {
        messageLabel.setText("Passed, but comments differ");
      }
    } else {
      messageLabel.setText("Discrepency found");
    }

    if (equalComments) {
      addText(newTrace.getComment(), "regular", commentPane);
    } else {
      System.out.println("Old Comment: " + oldTrace.getComment());
      System.out.println("New Comment: " + newTrace.getComment());
      Object[] v = stringToArray(oldTrace.getComment());
      Object[] h = stringToArray(newTrace.getComment());
      displayDifferencesToPane(v, h, commentPane);
    }

    if (equal) {
      copyTraceToPane(newTrace);
    } else {
      Object[] v = traceToArray(oldTrace);
      Object[] h = traceToArray(newTrace);
      displayDifferencesToPane(v, h, jTextPane);
    }
  }
コード例 #14
0
ファイル: ThumbMaker.java プロジェクト: ctrueden/web-toys
  private void setComponentsEnabled(boolean enabled) {
    list.setEnabled(enabled);
    process.setEnabled(enabled);
    remove.setEnabled(enabled);
    xres.setEnabled(enabled);
    yres.setEnabled(enabled);
    aspect.setEnabled(enabled);

    boolean b = aspect.isSelected() && enabled;
    colorLabel.setEnabled(b);
    colorBox.setEnabled(b);
    redLabel.setEnabled(b);
    red.setEnabled(b);
    redValue.setEnabled(b);
    greenLabel.setEnabled(b);
    green.setEnabled(b);
    greenValue.setEnabled(b);
    blueLabel.setEnabled(b);
    blue.setEnabled(b);
    blueValue.setEnabled(b);

    format.setEnabled(enabled);
    algorithm.setEnabled(enabled);
    prepend.setEnabled(enabled);
    append.setEnabled(enabled);
    output.setEnabled(enabled);
  }
コード例 #15
0
  public void substarterEnd(String prefix, String userName, String input) {
    System.out.println("ending give");
    if (substarter.end(winNum)) {

      g_start.setEnabled(true);
      g_end.setEnabled(false);

      String winner = substarter.returnWinner(winNum);

      input = "Congrats to the new sub winner: " + winner + "!";
      prefix = "<b><font color=blue>[" + userName + "]:</font></b> ";

      registeredUserList.setText(winner + "\n");

    } else {
      g_start.setEnabled(true);
      g_end.setEnabled(false);

      prefix = "<b><font color=blue>[" + userName + "]:</font></b> ";
      input = "No one entered giveaway, ending giveaway.";
    }
    sock.outputToChannel(input, channelName);
    try {
      toChatScreen(prefix + input, false);
    } catch (IOException | BadLocationException ex) {
      Logger.getLogger(IRCBOT.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
コード例 #16
0
 void enableButtons(JList list) {
   int nSelected = list.getSelectedIndices().length;
   int nListed = list.getModel().getSize();
   saveButton.setEnabled(nListed > 0);
   deleteInstanceButton.setEnabled(nSelected > 0);
   showInstanceButton.setEnabled(nSelected == 1);
 }
コード例 #17
0
ファイル: Mart.java プロジェクト: Camtendo/jokemon
 // Checks to see if you can sell
 private void updateSellButton() {
   if (totalAmount.getText().equalsIgnoreCase("Error")) {
     sellButton.setEnabled(false);
   } else {
     sellButton.setEnabled(true);
   }
 }
コード例 #18
0
  /** {@inheritDoc} */
  public void setEnabled(boolean b) {
    if (b != isEnabled()) {
      super.setEnabled(b);

      if ((selectedComponents & DISPLAY_DATE) > 0) {
        yearDecrButton.setEnabled(b);
        monthDecrButton.setEnabled(b);
        monthYearLabel.setEnabled(b);
        monthIncrButton.setEnabled(b);
        yearIncrButton.setEnabled(b);

        for (int day = 0; day < 7; day++) {
          dayOfWeekLabels[day].setEnabled(b);
        }

        for (int row = 0; row < 6; row++) {
          for (int day = 0; day < 7; day++) {
            if (dayButtons[row][day].getText().length() > 0) {
              dayButtons[row][day].setEnabled(b);
            }
          }
        }
      }

      if ((selectedComponents & DISPLAY_TIME) > 0) {
        spinner.setEnabled(b);
      }
    }
  }
コード例 #19
0
ファイル: GenXml.java プロジェクト: abel533/EasyXls
 private void next1() {
   // 显示xml基本信息
   card.next(pane);
   nextBtn.setEnabled(false);
   doneBtn.setEnabled(true);
   step++;
 }
コード例 #20
0
  /**
   * Shows given list of reading lists.
   *
   * @param lists lists.
   */
  protected void setReadingLists(ReadingList[] lists) {
    tblReadingLists.setEnabled(lists != null);
    btnAddReadingList.setEnabled(lists != null);
    btnRemoveList.setEnabled(lists != null);

    readingListsModel.setLists(lists);
  }
コード例 #21
0
ファイル: NavigatorBar.java プロジェクト: nutsh/oswing
 /** Method called by grid component each time a row is selected. */
 public void setFirstRow(boolean isFirstRecord) {
   firstButton.setEnabled(!isFirstRecord);
   prevPgButton.setEnabled(!isFirstRecord);
   prevButton.setEnabled(!isFirstRecord);
   controlPageNr.setEnabled(true);
   //    controlPageNr.setEnabled(resultSetController.getTotalResultSetLength()!=-1);
 }
コード例 #22
0
ファイル: NavigatorBar.java プロジェクト: nutsh/oswing
 /** Method called by grid component each time a row is selected. */
 public void setLastRow(boolean isLastRecord) {
   lastButton.setEnabled(!isLastRecord);
   nextButton.setEnabled(!isLastRecord);
   nextPgButton.setEnabled(!isLastRecord);
   controlPageNr.setEnabled(true);
   //    controlPageNr.setEnabled(resultSetController.getTotalResultSetLength()!=-1);
 }
コード例 #23
0
ファイル: Example1.java プロジェクト: RWTH-OS/MP-MPICH
  /**
   * And now for a little assembly. Put together the buttons, progress bar and status text field.
   */
  Example1(String name) {
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), name));

    progressBar.setMaximum(NUMLOOPS);

    startButton = new JButton("Start");
    startButton.addActionListener(startListener);
    startButton.setEnabled(true);

    interruptButton = new JButton("Cancel");
    interruptButton.addActionListener(interruptListener);
    interruptButton.setEnabled(false);

    JComponent buttonBox = new JPanel();
    buttonBox.add(startButton);
    buttonBox.add(interruptButton);

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(buttonBox);
    add(progressBar);
    add(statusField);
    statusField.setAlignmentX(CENTER_ALIGNMENT);

    buttonBox.setBorder(spaceBelow);
    Border pbBorder = progressBar.getBorder();
    progressBar.setBorder(BorderFactory.createCompoundBorder(spaceBelow, pbBorder));
  }
コード例 #24
0
  // FUNCTION TO GENERATE A STRING OF 10 ADDRESS REFERENCES
  public void autoGenerateString() {
    int random;

    for (int i = 0; i < 10; i++) {

      // RANDOMLY SELECT AN INDEX BETWEEN 0 AND 255
      random = (int) (Math.random() * 256);

      // ADD THE ADDRESS AT THIS INDEX IN ARRAY addresses TO THE LIST OF ADDRESS REFERENCE STRINGS
      //	listData[i] = addresses[random];
      listData.add(addresses[random]);
    }

    // ADD THIS LIST TO THE LISTBOX
    addRefStrList.setListData(listData);

    // ENABLE THE Next BUTTON AND DISABLE Back BUTTON
    //		moveStatus = 0;
    next.setEnabled(true);
    back.setEnabled(false);

    // UPDATE THE PROGRESS FIELD
    tProgress.setText(
        "We have automatically generated an address string of 10 addresses for you to work with."
            + "\nClick on \"Next\" to continue.");
  } // END FUNCTION autoGenerateString
コード例 #25
0
        @Override
        public void actionPerformed(ActionEvent event) {
          // todo something need to be done here...
          worker =
              new eva2.gui.SwingWorker() {
                @Override
                public Object construct() {
                  return doWork();
                }

                @Override
                public void finished() {
                  runButton.setEnabled(true);
                  continueButton.setEnabled(true);
                  stopButton.setEnabled(false);
                  backupPopulation =
                      (Population) optimizationParameters.getOptimizer().getPopulation().clone();
                  continueFlag = false;
                }
              };
          // also mal ganz anders ich gehe davon aus, dass der Benutzer das Ding parametrisiert hat
          // setze einfach die Backup population ein...
          continueFlag = true;
          multiRuns = 1; // multiruns machen bei continue einfach keinen Sinn...
          worker.start();
          runButton.setEnabled(false);
          continueButton.setEnabled(false);
          stopButton.setEnabled(true);
        }
コード例 #26
0
ファイル: StartChess.java プロジェクト: Vitvicky/java
  public void JudgeWhoIsWinner() // 判断胜负
      {
    String winner = "";

    if (white == 0) {
      JOptionPane.showMessageDialog(null, "黑方胜!" + black + ":" + white);
      //			JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
      submit.setEnabled(false);
      winner = "黑";
    }
    if (black == 0) {
      JOptionPane.showMessageDialog(null, "白方胜!" + white + ":" + black);
      //			JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
      submit.setEnabled(false);
      winner = "白";
    }
    if (black + white == 64) {
      if (white > black) {
        JOptionPane.showMessageDialog(null, "白方胜!" + white + ":" + black);
        //				JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
        submit.setEnabled(false);
        winner = "白";
      } else if (black > white) {
        JOptionPane.showMessageDialog(null, "黑方胜!" + black + ":" + white);
        //				JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
        submit.setEnabled(false);
        winner = "白";
      } else if (black == white) {
        JOptionPane.showMessageDialog(null, "和局!");
        //				JOptionPane.showMessageDialog(null, "游戏结束!用时" + time + "秒");
        winner = "";
      }
    }
  }
コード例 #27
0
ファイル: SurveyWizard.java プロジェクト: edexpit/dotcomgame
  void setFinalQuestion(boolean finalQuestion) {

    if (finalQuestion) {

      nextButton.setEnabled(false);
      finalButton.setEnabled(true);
    }
  }
コード例 #28
0
ファイル: FrameServer.java プロジェクト: Jasi2169/EDMIS
 public void jButtonStop_actionPerformed(ActionEvent e) {
   jButtonStart.setEnabled(true);
   server.interrupt();
   connections(0);
   statusBar.setText("Server stopped!");
   jButtonStop.setEnabled(false);
   jButtonConfig.setEnabled(false);
 }
コード例 #29
0
ファイル: JavaPanel.java プロジェクト: CTMM-TraIT/trait_ctp
 private void setStatus() {
   // Update the status display
   status.setText(running ? "Running" : "Stopped");
   status.setForeground(running ? Color.BLACK : Color.RED);
   start.setEnabled(!running);
   stop.setEnabled(running);
   launchBrowser.setEnabled(running);
 }
コード例 #30
0
 private void setStepButtonStates(final boolean allDisabled) {
   firstStepButton.setEnabled(!allDisabled && this.currentStep > 1);
   previousStepButton.setEnabled(!allDisabled && this.currentStep > 1);
   nextStepButton.setEnabled(!allDisabled && this.currentStep < this.timeController.getEndTime());
   lastStepButton.setEnabled(!allDisabled && this.currentStep < this.timeController.getEndTime());
   final int endTime = (int) this.timeController.getEndTime();
   this.stepPositionLabel.setText(this.currentStep + "/" + endTime);
 }