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

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

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

JButton.setText介绍

暂无

代码示例

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

@Override
public void onError() {
  EventQueue.invokeLater(() -> {
    connectionStatusLabel.setText("Connection Error!");
    receiveMessages.set(false);
    startStopButton.setText("Start");
    newKeywordField.setEnabled(true);
    addButton.setEnabled(true);
  });
}

代码示例来源:origin: ballerina-platform/ballerina-lang

private JButton createNewRowButton() {
  final JButton newRowButton = new JButton();
  newRowButton.setText("+");
  newRowButton.addActionListener(e -> rootPanel.add(createArtifactRow("", "", "", "")));
  return newRowButton;
}

代码示例来源:origin: ballerina-platform/ballerina-lang

private JButton createRemoveRowButton(final JPanel panel) {
  final JButton removeRowButton = new JButton();
  removeRowButton.setText("-");
  removeRowButton.addActionListener(e -> {
    final int idx = getComponentIndex(panel);
    rootPanel.remove(panel);
    rows.remove(idx);
  });
  return removeRowButton;
}

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

bDetails = new javax.swing.JButton();
lStatus = new javax.swing.JLabel();
add(cbSelected, gridBagConstraints);
bDetails.setText("Details");
bDetails.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
    bDetailsActionPerformed(evt);
lStatus.setText((desc.isUpdateAvailable() ? "Update available" : desc.getStatus().toString()));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;

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

public MyButton(char c, String name, BundlesProbesTabUI listener, JPanel panel) {
  super.setText(name);
  super.setMnemonic(c);
  super.setMinimumSize(new Dimension(W, H));
  super.setPreferredSize(new Dimension(W, H));
  super.setMaximumSize(new Dimension(W, H));
  super.addActionListener(listener);
  panel.add(this);
 }
}

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

btnBlack = new javax.swing.JButton();
btnBlue = new javax.swing.JButton();
lblBlue = new javax.swing.JLabel();
lblGreen = new javax.swing.JLabel();
btnGreen = new javax.swing.JButton();
btnColorless = new javax.swing.JButton();
lblWhite = new javax.swing.JLabel();
lblBlack.setText("Black");
btnBlack.setText("0");
btnBlue.setText("0");
lblBlue.setText("Blue");
lblGreen.setText("Green");
btnGreen.setText("0");
btnColorless.setText("0");
lblColorless.setText("Colorless");
btnWhite.setText("0");
btnRed.setText("0");

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

public static void main(String args[]) {
    JFrame frame = new JFrame();
    frame.setTitle("Title");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton button = new JButton();
    button.setText("Hello, World!");
    frame.getContentPane().add(button, BorderLayout.CENTER);
    frame.setSize(200, 100);
    frame.pack();
    frame.setVisible(true);
    frame.show();
  }
}

代码示例来源:origin: stanfordnlp/CoreNLP

button.setText("Success!");
} else {
 button.setText("Done.  " + failures + " parses failed");
 button.addActionListener(evt -> dialog.setVisible(false));

代码示例来源:origin: stanfordnlp/CoreNLP

jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));
jLabel2.setText("Type in the internet address of a document or web page.");
jPanel1.add(jLabel2);
urlTextField.addActionListener(evt -> urlTextFieldActionPerformed(evt));
jPanel3.add(urlTextField);
jPanel1.add(jPanel3);
openButton.setText("Open");
openButton.setEnabled(false);
openButton.addActionListener(evt -> openButtonActionPerformed(evt));
jPanel2.add(openButton);
cancelButton.setText("Cancel");
cancelButton.addActionListener(evt -> cancelButtonActionPerformed(evt));
jPanel2.add(cancelButton);
browseButton.setText("Browse");
browseButton.addActionListener(evt -> browseButtonActionPerformed(evt));
jPanel2.add(browseButton);

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

bDetails = new javax.swing.JButton();
lStatus = new javax.swing.JLabel();
add(cbSelected, gridBagConstraints);
bDetails.setText("Details");
bDetails.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
    bDetailsActionPerformed(evt);
lStatus.setText((desc.isUpdateAvailable() ? "Update available" : desc.getStatus().toString()));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;

代码示例来源:origin: stanfordnlp/CoreNLP

JButton okay = new javax.swing.JButton();
okay.setText("Okay");
okay.setToolTipText("Okay");
okay.addActionListener(evt -> dialog.setVisible(false));
JButton cancel = new javax.swing.JButton();
cancel.setText("Cancel");
cancel.setToolTipText("Cancel");
cancel.addActionListener(evt -> {
 fileList.clearSelection();
 dialog.setVisible(false);

代码示例来源:origin: Slowpoke101/FTBLaunch

public void addUpdateJREButton (final String webLink, String unlocMessage) {
  btnInstallJava.setText(I18N.getLocaleString(unlocMessage));
  btnInstallJava.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed (ActionEvent arg0) {
      OSUtils.browse(webLink);
    }
  });
  btnInstallJava.setBounds(345, 210, 150, 28);
  fitterPane.add(btnInstallJava);
}

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

private void changeLocale() {
  statusLabel.setText(rb.getString("inactive"));
  configUpdateButton.setText(rb.getString("check.for.updates"));
  configUpdateLabel.setText(rb.getString("current.version") + ": " + UpdateUtils.getThisJarVersion());
  configThreadsLabel.setText(rb.getString("max.download.threads"));
  configTimeoutLabel.setText(rb.getString("timeout.mill"));
  configRetriesLabel.setText(rb.getString("retry.download.count"));
  configOverwriteCheckbox.setText(rb.getString("overwrite.existing.files"));
  configAutoupdateCheckbox.setText(rb.getString("auto.update"));
  configPlaySound.setText(rb.getString("sound.when.rip.completes"));
  configShowPopup.setText(rb.getString("notification.when.rip.starts"));
  configSaveOrderCheckbox.setText(rb.getString("preserve.order"));
  configSaveLogs.setText(rb.getString("save.logs"));
  configSaveURLsOnly.setText(rb.getString("save.urls.only"));
  configSaveAlbumTitles.setText(rb.getString("save.album.titles"));
  configClipboardAutorip.setText(rb.getString("autorip.from.clipboard"));
  configSaveDescriptions.setText(rb.getString("save.descriptions"));
  configUrlFileChooserButton.setText(rb.getString("download.url.list"));
  configSaveDirButton.setText(rb.getString("select.save.dir") + "...");
  configPreferMp4.setText(rb.getString("prefer.mp4.over.gif"));
  configWindowPosition.setText(rb.getString("restore.window.position"));
  configURLHistoryCheckbox.setText(rb.getString("remember.url.history"));
  optionLog.setText(rb.getString("Log"));
  optionHistory.setText(rb.getString("History"));
  optionQueue.setText(rb.getString("Queue"));
  optionConfiguration.setText(rb.getString("Configuration"));
}

代码示例来源:origin: haraldk/TwelveMonkeys

private static void addImage(final Container pParent, final ImageReader pReader, final int pImageNo) throws IOException {
  final JButton button = new JButton();
  button.setText("" + image.getWidth() + "x" +
      image.getHeight() + ": "
      + ((image.getColorModel() instanceof IndexColorModel) ?

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

File f = rsc.dir;
String prettyFile = Utils.shortenPath(f);
openButton.setText("Open " + prettyFile);
mainFrame.setTitle("RipMe v" + UpdateUtils.getThisJarVersion());
try {
openButton.addActionListener(event -> {
  try {
    Desktop.getDesktop().open(new File(event.getActionCommand()));

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

appliedEffectsPanel.add(this, constrains);
  JPanel titlePanel = new JPanel();
  titlePanel.setLayout(new LayoutManager() {
    public void removeLayoutComponent (Component comp) {
    upButton = new JButton();
    titlePanel.add(upButton);
    upButton.setText("Up");
    upButton.setMargin(new Insets(0, 0, 0, 0));
    Font font = upButton.getFont();
    downButton = new JButton();
    titlePanel.add(downButton);
    downButton.setText("Down");
    downButton.setMargin(new Insets(0, 0, 0, 0));
    Font font = downButton.getFont();
    deleteButton = new JButton();
    titlePanel.add(deleteButton);
    deleteButton.setText("X");
    deleteButton.setMargin(new Insets(0, 0, 0, 0));
    Font font = deleteButton.getFont();
upButton.addActionListener(new ActionListener() {
  public void actionPerformed (ActionEvent evt) {
    int currentIndex = effectPanels.indexOf(EffectPanel.this);

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

btnNo = new javax.swing.JButton();
btnYes = new javax.swing.JButton();
lblQuestion.setText("question");
btnNo.setText("No");
btnNo.addActionListener(evt -> btnNoActionPerformed(evt));
btnYes.setText("Yes");
btnYes.addActionListener(evt -> btnYesActionPerformed(evt));

代码示例来源:origin: stanfordnlp/CoreNLP

JButton cancel = new javax.swing.JButton();
 new SaveOutputThread(filename, progress, dialog, cancel, sentences);
cancel.setText("Cancel");
cancel.setToolTipText("Cancel");
cancel.addActionListener(evt -> thread.cancelled = true);

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

startStopButton.setText("Start");
newKeywordField.setEnabled(true);
addButton.setEnabled(true);
startStopButton.setText("Stop");
connectionStatusLabel.setText("Connecting...");
newKeywordField.setEnabled(false);
addButton.setEnabled(false);

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

jButtonSort = new JButton();
int w = getDlgParams().rect.width - 75;
int h = getDlgParams().rect.height - 75;
jButtonSort.setBounds(new Rectangle(w / 2 + 150, h - 30, 78, 22));
jButtonSort.setText("Sort");
jButtonSort.setVisible(false);
if (maxPages == 1) {

相关文章

微信公众号

最新文章

更多

JButton类方法