コード例 #1
0
ファイル: MainFrameTest.java プロジェクト: wadiee/drjava
  /**
   * Tests that the returned JButton of <code>createManualToolBarButton</code>: 1. Is disabled upon
   * return. 2. Inherits the tooltip of the Action parameter <code>a</code>.
   */
  public void testCreateManualToolBarButton() {
    final Action a =
        new AbstractAction("Test Action") {
          public void actionPerformed(ActionEvent ae) {}
        };

    a.putValue(Action.LONG_DESCRIPTION, "test tooltip");
    Utilities.invokeAndWait(
        new Runnable() {
          public void run() {
            _but = _frame._createManualToolBarButton(a);
          }
        });

    assertTrue("Returned JButton is enabled.", !_but.isEnabled());
    assertEquals("Tooltip text not set.", "test tooltip", _but.getToolTipText());
    _log.log("testCreateManualToobarButton completed");
  }
コード例 #2
0
ファイル: FrameServer.java プロジェクト: Jasi2169/EDMIS
 public void jButtonExit_actionPerformed(ActionEvent e) {
   if (jButtonStop.isEnabled()) {
     jButtonStop_actionPerformed(e);
   }
   System.exit(0);
 }
コード例 #3
0
    /** Background thread used to receive data from the server. */
    public void run() {
      Long id;
      Integer message_type;
      String target;
      String soap;
      SOAPMonitorData data;
      int selected;
      int row;
      boolean update_needed;
      while (socket != null) {
        try {
          // Get the data from the server
          message_type = (Integer) in.readObject();
          // Process the data depending on its type
          switch (message_type.intValue()) {
            case SOAPMonitorConstants.SOAP_MONITOR_REQUEST:
              // Get the id, target and soap info
              id = (Long) in.readObject();
              target = (String) in.readObject();
              soap = (String) in.readObject();
              // Add new request data to the table
              data = new SOAPMonitorData(id, target, soap);
              model.addData(data);
              // If "most recent" selected then update
              // the details area if needed
              selected = table.getSelectedRow();
              if ((selected == 0) && model.filterMatch(data)) {
                valueChanged(null);
              }
              break;
            case SOAPMonitorConstants.SOAP_MONITOR_RESPONSE:
              // Get the id and soap info
              id = (Long) in.readObject();
              soap = (String) in.readObject();
              data = model.findData(id);
              if (data != null) {
                update_needed = false;
                // Get the selected row
                selected = table.getSelectedRow();
                // If "most recent", then always
                // update details area
                if (selected == 0) {
                  update_needed = true;
                }
                // If the data being updated is
                // selected then update details
                row = model.findRow(data);
                if ((row != -1) && (row == selected)) {
                  update_needed = true;
                }
                // Set the response and update table
                data.setSOAPResponse(soap);
                model.updateData(data);
                // Refresh details area (if needed)
                if (update_needed) {
                  valueChanged(null);
                }
              }
              break;
          }

        } catch (Exception e) {
          // Exceptions are expected here when the
          // server communication has been terminated.
          if (stop_button.isEnabled()) {
            stop();
            setErrorStatus(STATUS_CLOSED);
          }
        }
      }
    }