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

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

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

JButton.setActionCommand介绍

暂无

代码示例

代码示例来源:origin: pedrovgs/AndroidWiFiADB

public ConnectDisconnectPanel() {
 setLayout(new GridBagLayout());
 setOpaque(false);
 connect = new JButton(ACTION_CONNECT);
 connect.setActionCommand(ACTION_CONNECT);
 connect.setOpaque(false);
 disconnect = new JButton(ACTION_DISCONNECT);
 disconnect.setActionCommand(ACTION_DISCONNECT);
 disconnect.setOpaque(false);
 add(connect);
 add(disconnect);
}

代码示例来源:origin: chewiebug/GCViewer

/**
 * @param gcResource resource to be tracked
 */
public GCModelLoaderView(GCResource gcResource) {
  super(new BorderLayout());
  setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  JPanel parserInfo = new JPanel(new FlowLayout(FlowLayout.LEFT));
  progressBar = new JProgressBar(0, 100);
  progressBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  progressBar.setVisible(true);
  progressBar.setValue(0);
  progressBar.setStringPainted(true);
  cancelButton = new JButton(new SquareIcon());
  cancelButton.setActionCommand(CMD_CANCEL);
  cancelButton.addActionListener(this);
  messageLabel = new JLabel();
  messageLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  messageLabel.setVisible(false);
  parserInfo.add(progressBar);
  parserInfo.add(cancelButton);
  parserInfo.add(messageLabel);
  add(parserInfo, BorderLayout.NORTH);
  JTextArea textArea = textAreaLogHandler.getTextArea();
  textArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  JScrollPane textAreaScrollPane = new JScrollPane(textArea);
  textAreaScrollPane.setPreferredSize(new Dimension(700, 500));
  add(textAreaScrollPane, BorderLayout.CENTER);
  setGCResource(gcResource);
}

代码示例来源:origin: chewiebug/GCViewer

protected void initComponents() {
  Panel buttonPanel = new Panel();
  buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  JButton okButton = new JButton(LocalisationHelper.getString("button_ok"));
  okButton.setActionCommand(ACTION_OK);
  okButton.addActionListener(this);
  buttonPanel.add(okButton);
  
  getContentPane().add("South", buttonPanel);
}

代码示例来源:origin: RipMeApp/ripme

openButton.setActionCommand(f.toString());
openButton.addActionListener(event -> {
  try {
    Desktop.getDesktop().open(new File(event.getActionCommand()));

代码示例来源:origin: chewiebug/GCViewer

logoPanel.add(la_icon);
JPanel versionPanel = new JPanel();
versionPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
versionPanel.setLayout(new GridBagLayout());
gridBagConstraints.gridx = 0;
versionPanel.add(copyright, gridBagConstraints);
versionPanel.add(contributors, gridBagConstraints);
gridBagConstraints.fill = GridBagConstraints.VERTICAL;
buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
if (UrlDisplayHelper.displayUrlIsSupported()) {
  JButton homePageButton = new JButton("Homepage");
  homePageButton.setActionCommand(ACTION_HOMEPAGE);
  homePageButton.addActionListener(this);
  buttonPanel.add(homePageButton);
JButton okButton = new JButton(LocalisationHelper.getString("button_ok"));
okButton.setActionCommand(ACTION_OK);
okButton.addActionListener(this);
buttonPanel.add(okButton);
getContentPane().add("North", logoPanel);

代码示例来源:origin: magefree/mage

btnConnect = new javax.swing.JButton();
btnSendMessage = new javax.swing.JButton();
lblStatus = new javax.swing.JLabel();
consolePanel1 = new mage.server.console.ConsolePanel();
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnConnect.addActionListener(evt -> btnConnectActionPerformed(evt));
jToolBar1.add(btnConnect);
btnSendMessage.setActionCommand("SendMessage");
btnSendMessage.setEnabled(false);
btnSendMessage.setFocusable(false);
btnSendMessage.setText("Send Message");
btnSendMessage.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnSendMessage.addActionListener(evt -> btnSendMessageActionPerformed(evt));
jToolBar1.add(btnSendMessage);

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

JSplitPane editingPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sourcePanel, astPanel);
editingPane.setResizeWeight(0.5d);
JPanel interactionsPane = new JPanel(new BorderLayout());
interactionsPane.add(xPathPanel, BorderLayout.SOUTH);
interactionsPane.add(editingPane, BorderLayout.CENTER);
getContentPane().add(interactionsPane, BorderLayout.CENTER);
JButton compileBtn = new JButton(NLS.nls("MAIN.FRAME.COMPILE_BUTTON.TITLE"));
compileBtn.setActionCommand(ActionCommands.COMPILE_ACTION);
compileBtn.addActionListener(this);
evalBtn = new JButton(NLS.nls("MAIN.FRAME.EVALUATE_BUTTON.TITLE"));
evalBtn.setActionCommand(ActionCommands.EVALUATE_ACTION);
evalBtn.addActionListener(this);
evalBtn.setEnabled(false);
statusLbl = new JLabel();
statusLbl.setHorizontalAlignment(SwingConstants.RIGHT);
JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
btnPane.add(compileBtn);
btnPane.add(evalBtn);
btnPane.add(statusLbl);

代码示例来源:origin: net.imagej/imagej-ui-swing

private JButton getDeselectButton() {
  final JButton button = new JButton("Deselect");
  button.setActionCommand(ACTION_DESELECT);
  button.addActionListener(this);
  return button;
}

代码示例来源:origin: igniterealtime/Openfire

JPanel mainPanel = new JPanel();
JLabel splashLabel = null;
final JButton startButton = new JButton("Start");
startButton.setActionCommand("Start");
final JButton stopButton = new JButton("Stop");
stopButton.setActionCommand("Stop");
final JButton browserButton = new JButton("Launch Admin");
browserButton.setActionCommand("Launch Admin");
final JButton quitButton = new JButton("Quit");
quitButton.setActionCommand("Quit");
startButton.addActionListener(actionListener);
stopButton.addActionListener(actionListener);
browserButton.addActionListener(actionListener);
quitButton.addActionListener(actionListener);
final JPanel bevelPanel = new JPanel();
bevelPanel.setBackground(Color.white);
bevelPanel.setLayout(new BorderLayout());

代码示例来源:origin: net.imagej/imagej-ui-swing

private JButton getDrawButton() {
  final JButton button = new JButton("Draw");
  button.setActionCommand(ACTION_DRAW);
  button.addActionListener(this);
  return button;
}

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

JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(this);
final JButton setButton = new JButton("Select");
setButton.setActionCommand("Select");
setButton.addActionListener(this);
getRootPane().setDefaultButton(setButton);
JPanel listPane = new JPanel();
listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
JLabel label = new JLabel("Layers");
label.setLabelFor(list);
listPane.add(label);
listPane.add(Box.createRigidArea(new Dimension(0, 5)));
listPane.add(listScroller);
listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));

代码示例来源:origin: net.imagej/imagej-ui-swing

private JButton getFillButton() {
  final JButton button = new JButton("Fill");
  button.setActionCommand(ACTION_FILL);
  button.addActionListener(this);
  return button;
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

public FindAndReplaceDemo() {
 JPanel cp = new JPanel(new BorderLayout());
 textArea.setCodeFoldingEnabled(true);
 RTextScrollPane sp = new RTextScrollPane(textArea);
 cp.add(sp);
 searchField = new JTextField(30);
 toolBar.add(searchField);
 final JButton nextButton = new JButton("Find Next");
 nextButton.setActionCommand("FindNext");
 nextButton.addActionListener(this);
 toolBar.add(nextButton);
 searchField.addActionListener(new ActionListener() {
 JButton prevButton = new JButton("Find Previous");
 prevButton.setActionCommand("FindPrev");
 prevButton.addActionListener(this);
 toolBar.add(prevButton);
 regexCB = new JCheckBox("Regex");
 matchCaseCB = new JCheckBox("Match Case");
 toolBar.add(matchCaseCB);
 cp.add(toolBar, BorderLayout.NORTH);

代码示例来源:origin: net.imagej/imagej-ui-swing

private JButton getFlattenButton() {
  final JButton button = new JButton("Flatten [f]");
  button.setActionCommand(ACTION_FLATTEN);
  button.addActionListener(this);
  return button;
}

代码示例来源:origin: magefree/mage

pnlSelect = new javax.swing.JPanel();
btnNone = new javax.swing.JButton();
btnAll = new javax.swing.JButton();
pnlApply = new javax.swing.JPanel();
btnApply = new javax.swing.JButton();
btnNone.setActionCommand("none");
btnNone.addActionListener(evt -> btnNoneActionPerformed(evt));
pnlSelect.add(btnNone);
btnAll.addActionListener(evt -> btnAllActionPerformed(evt));
pnlSelect.add(btnAll);
  btnApply.setToolTipText("At least 1 pack must be selected");
btnApply.addActionListener(evt -> btnApplyActionPerformed(evt));
pnlApply.add(btnApply);

代码示例来源:origin: net.imagej/ij-ui-swing

private JButton getDeselectButton() {
  final JButton button = new JButton("Deselect");
  button.setActionCommand(ACTION_DESELECT);
  button.addActionListener(this);
  return button;
}

代码示例来源:origin: magefree/mage

btnDisconnect.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
    btnDisconnectActionPerformed(evt);
btnEndSession.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
    btnEndSessionActionPerformed(evt);
btnMuteUser.setActionCommand("Mute 1h");
btnMuteUser.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
    btnMuteUserActionPerformed(evt);
btnDeActivate.setActionCommand("Mute 1h");
btnDeActivate.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLockUser.setActionCommand("Mute 1h");
btnLockUser.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {

代码示例来源:origin: net.imagej/ij-ui-swing

private JButton getDrawButton() {
  final JButton button = new JButton("Draw");
  button.setActionCommand(ACTION_DRAW);
  button.addActionListener(this);
  return button;
}

代码示例来源:origin: magefree/mage

lblFastConnect = new javax.swing.JLabel();
panelFlag = new javax.swing.JPanel();
cbFlag = new mage.client.util.gui.countryBox.CountryComboBox();
panelFast = new javax.swing.JPanel();
panelServer = new javax.swing.JPanel();
txtServer = new javax.swing.JTextField();
txtPort = new javax.swing.JTextField();
panelFlag.add(btnFlagSearch);
btnFindMain.setActionCommand("connectXmageDe");
btnFindMain.setAlignmentY(0.0F);
btnFindMain.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindLocal.setActionCommand("connectLocalhost");
btnFindLocal.setAlignmentY(0.0F);
btnFindLocal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnFindUs.setText("P");
btnFindUs.setToolTipText("Connect to mtg.powersofwar.com (USA, use any username without registration)");
btnFindUs.setActionCommand("connectXmageus");
btnFindUs.setAlignmentY(0.0F);
btnFindUs.setMargin(new java.awt.Insets(2, 2, 2, 2));

代码示例来源:origin: net.imagej/ij-ui-swing

private JButton getMeasureButton() {
  final JButton button = new JButton("Measure");
  button.setActionCommand(ACTION_MEASURE);
  button.addActionListener(this);
  return button;
}

相关文章

JButton类方法