javax.swing.JButton.setAction()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中javax.swing.JButton.setAction()方法的一些代码示例,展示了JButton.setAction()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.setAction()方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:setAction

JButton.setAction介绍

暂无

代码示例

代码示例来源:origin: apache/ignite

/**
 * @return Panel with close button.
 */
private JPanel createButtonPanel() {
  closeBtn.setAction(closeAct);
  closeBtn.setToolTipText("<html><b>Closes</b> Dialog</html>");
  JPanel btnPanel = new JPanel();
  btnPanel.add(closeBtn);
  return btnPanel;
}

代码示例来源:origin: groovy/groovy-core

REPLACE_BUTTON.setAction(action);

代码示例来源:origin: winder/Universal-G-Code-Sender

adjust5.setText("");
  adjust1.setAction(rapidActions.get(0));
  adjust3.setAction(rapidActions.get(1));
  adjust4.setAction(rapidActions.get(2));
} else {
  adjust2.setEnabled(true);
    adjust1.setAction(actions.get(0));
    adjust2.setAction(actions.get(1));
    adjust3.setAction(actions.get(2));
    adjust4.setAction(actions.get(3));
    adjust5.setAction(actions.get(4));

代码示例来源:origin: apache/pdfbox

nextButton.setAction(nextAction);
nextButton.setText("Next");
previousButton.setAction(previousAction);
previousButton.setText("Previous");
crossButton.setAction(closeAction);
crossButton.setText("Done");
closeAction.setEnabled(false);

代码示例来源:origin: winder/Universal-G-Code-Sender

rapidRadio.addActionListener((ActionEvent ae) -> radioSelected());
toggleSpindle.setAction(new RealTimeAction("spindle", Overrides.CMD_TOGGLE_SPINDLE, backend));
toggleSpindle.setBackground(Color.RED);
toggleFloodCoolant.setAction(new RealTimeAction("flood", Overrides.CMD_TOGGLE_FLOOD_COOLANT, backend));
toggleFloodCoolant.setBackground(Color.RED);
toggleMistCoolant.setAction(new RealTimeAction("mist", Overrides.CMD_TOGGLE_MIST_COOLANT, backend));
toggleMistCoolant.setBackground(Color.RED);

代码示例来源:origin: openpnp/openpnp

public void setActuatorName(String actuatorName) {
  this.actuatorName = actuatorName;
  if (actuatorName == null || actuatorName.trim().length() == 0) {
    buttonCaptureTool.setAction(captureToolCoordinatesAction);
    buttonCenterTool.setAction(positionToolAction);
  }
  else {
    buttonCaptureTool.setAction(captureActuatorCoordinatesAction);
    buttonCenterTool.setAction(positionActuatorAction);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

/**
 * Updates the toggle button to contain the Icon <code>icon</code>, and
 * Action <code>action</code>.
 */
private void updateToggleButton(Action action, Icon icon)
{
  toggleButton.setAction(action);
  toggleButton.setIcon(icon);
  toggleButton.setText(null);
}

代码示例来源:origin: org.apache.ignite/ignite-core

/**
 * @return Panel with close button.
 */
private JPanel createButtonPanel() {
  closeBtn.setAction(closeAct);
  closeBtn.setToolTipText("<html><b>Closes</b> Dialog</html>");
  JPanel btnPanel = new JPanel();
  btnPanel.add(closeBtn);
  return btnPanel;
}

代码示例来源:origin: kaklakariada/portmapper

@Override
  public void propertyChange(final PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals(PROPERTY_ROUTER_CONNECTED)) {
      logger.debug("Connection state changed to " + evt.getNewValue());
      if (evt.getNewValue().equals(Boolean.TRUE)) {
        connectDisconnectButton.setAction(actionMap.get(ACTION_DISCONNECT_ROUTER));
      } else {
        connectDisconnectButton.setAction(actionMap.get(ACTION_CONNECT_ROUTER));
      }
    }
  }
});

代码示例来源:origin: com.eas.platypus/platypus-js-forms

/**
 * Creates new form GridSearchView
 */
public GridSearchView(ModelGrid aGrid) {
  initComponents();
  grid = aGrid;
  //grid.getRowsSelectionModel().addListSelectionListener(this);
  btnClose.setAction(closeAction);
  btnFind.setAction(findAction);
  txtText2Find.setAction(new SurrogateFindAction());
  txtText2Find.getDocument().addDocumentListener(new SearchViewDocumentListener());
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

@Override
protected void bind() {
  super.bind();
  searchField
      .addActionListener(getAction(JXDialog.EXECUTE_ACTION_COMMAND));
  findNext.setAction(getAction(FIND_NEXT_ACTION_COMMAND));
  findPrevious.setAction(getAction(FIND_PREVIOUS_ACTION_COMMAND));
  KeyStroke stroke = KeyStroke.getKeyStroke("ESCAPE");
  getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(stroke,
      JXDialog.CLOSE_ACTION_COMMAND);
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

@Override
protected void bind() {
  super.bind();
  searchField
      .addActionListener(getAction(JXDialog.EXECUTE_ACTION_COMMAND));
  findNext.setAction(getAction(FIND_NEXT_ACTION_COMMAND));
  findPrevious.setAction(getAction(FIND_PREVIOUS_ACTION_COMMAND));
  KeyStroke stroke = KeyStroke.getKeyStroke("ESCAPE");
  getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(stroke,
      JXDialog.CLOSE_ACTION_COMMAND);
}

代码示例来源:origin: freeplane/freeplane

private void setAcceleratorAction(final JButton button, final KeyStroke ks) {
  final Action setAcceleratorAction = new SetFKeyAcceleratorOnNextClickAction(ks);
  button.setAction(setAcceleratorAction);
  button.setEnabled(setAcceleratorAction.isEnabled());
  final String text = TextUtils.getText("f_button_unassigned");
  button.setText(text);
}

代码示例来源:origin: org.simplericity.jettyconsole/jetty-console-core

public void actionPerformed(ActionEvent actionEvent) {
    try {
      stopAction.setEnabled(false);
      jettyManager.stopServer();
      portField.setEnabled(true);
      startAction.setEnabled(true);
      startStop.setAction(startAction);
    } catch (Exception e) {
      throw new RuntimeException();
    }
  }
};

代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-dialog

private void addRestoreButton() {
  JButton restoreButton = getRestoreButton();
  restoreAction.setDialog(this);
  restoreAction.setTexts(texts);
  restoreButton.setVisible(true);
  restoreButton.setAction(restoreAction);
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

@Override
public void setAction( Action a )
{
 super.setAction( a );
 UpdateNotifier.instance().addActionComponent( this );
 ToolTipManager.sharedInstance().registerComponent( this );
}

代码示例来源:origin: openpnp/openpnp

@Override
  public void actionPerformed(ActionEvent arg0) {
    btnMeasure.setAction(confirmMeasureAction);
    cancelMeasureAction.setEnabled(true);
    CameraView cameraView = MainFrame.get().getCameraViews().setSelectedCamera(camera);
    cameraView.setSelectionEnabled(true);
    cameraView.setSelection(0, 0, 100, 100);
  }
};

代码示例来源:origin: openpnp/openpnp

@Override
  public void actionPerformed(ActionEvent e) {
    startLensCalibrationBtn.setAction(startCalibration);
    referenceCamera.cancelCalibration();
    CameraView cameraView = MainFrame.get().getCameraViews().getCameraView(referenceCamera);
    cameraView.setText(null);
    cameraView.flash();
  }
};

代码示例来源:origin: openpnp/openpnp

@Override
  public void actionPerformed(ActionEvent e) {
    btnAutoSetup.setAction(autoSetup);
    CameraView cameraView = MainFrame.get()
                     .getCameraViews()
                     .getCameraView(autoSetupCamera);
    cameraView.setText(null);
    cameraView.setCameraViewFilter(null);
    cameraView.removeActionListener(autoSetupPart1Clicked);
    cameraView.removeActionListener(autoSetupPart2Clicked);
  }
};

代码示例来源:origin: openpnp/openpnp

@Override
  public void actionPerformed(ActionEvent arg0) {
    UiUtils.messageBoxOnException(() -> {
      Camera camera = MainFrame.get().getMachineControls().getSelectedTool().getHead()
          .getDefaultCamera();
      CameraView cameraView = MainFrame.get().getCameraViews().setSelectedCamera(camera);
      btnChangeTemplateImage.setAction(selectTemplateImageAction);
      cancelSelectTemplateImageAction.setEnabled(false);
      cameraView.setSelectionEnabled(false);
    });
  }
};

相关文章

JButton类方法