java.awt.Button.getLabel()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(142)

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

Button.getLabel介绍

暂无

代码示例

代码示例来源:origin: net.sf.jt400/jt400

/**
 * Returns the text for the Cancel button.
 *
 * @return The text for the Cancel button.
 **/
public String getCancelButtonText()
{
  return cancel.getLabel();
}

代码示例来源:origin: net.sf.jt400/jt400

/**
 * Returns the text for the Ok button.
 *
 * @return The text for the Ok button.
 **/
public String getOkButtonText()
{
  return open.getLabel();
}

代码示例来源:origin: stackoverflow.com

public void actionPerformed(ActionEvent e)
{
  Button b = (Button) e.getSource();

  if (b.getLabel().equals("Clear"))
  {
    tf.setText("");
  }
  else
  {
    tf.setText(tf.getText() + b.getLabel());
  }
}

代码示例来源:origin: net.java.openjdk.cacio/cacio-shared

@Override
JButton initSwingComponent() {
  JButton jbutton = new JButton();
  Button theButton = getAWTComponent();
  jbutton.setText(theButton.getLabel());
  jbutton.addActionListener(new SwingButtonListener());
  jbutton.setMargin(new Insets(0, 0, 0, 0));
  return jbutton;
}

代码示例来源:origin: com.att.research/grappa

@Override
  public void actionPerformed(ActionEvent evt)
  {
    Object src = evt.getSource();
    if (src instanceof Button) {
      Button btn = (Button) src;
      if (btn.getLabel().equals("Dismiss")) {
        setVisible(false);
      } else if (btn.getLabel().equals("Stack Trace")) {
        if (getException() == null) {
          setText("No stack trace available (exception is null).");
        } else {
          StringWriter swriter = new StringWriter();
          PrintWriter pwriter = new PrintWriter(swriter);
          getException().printStackTrace(pwriter);
          pwriter.flush();
          setText(swriter.toString());
          pwriter.close();
        }
      }
    }
  }
}

代码示例来源:origin: stackoverflow.com

pattern[0] = btnarray[0].getLabel() + btnarray[1].getLabel()
    + btnarray[2].getLabel();
pattern[1] = btnarray[3].getLabel() + btnarray[4].getLabel()
    + btnarray[5].getLabel();
pattern[2] = btnarray[6].getLabel() + btnarray[7].getLabel()
    + btnarray[8].getLabel();
pattern[3] = btnarray[0].getLabel() + btnarray[3].getLabel()
    + btnarray[6].getLabel();
pattern[4] = btnarray[1].getLabel() + btnarray[4].getLabel()
    + btnarray[7].getLabel();
pattern[5] = btnarray[2].getLabel() + btnarray[5].getLabel()
    + btnarray[8].getLabel();
pattern[6] = btnarray[0].getLabel() + btnarray[4].getLabel()
    + btnarray[8].getLabel();
pattern[7] = btnarray[2].getLabel() + btnarray[4].getLabel()
    + btnarray[6].getLabel();
int j = 0;

代码示例来源:origin: com.stevesoft.pat/pat

/** This action will dispose of this graphics object and
  deliver whatever action event it receives to the component
  object supplied by the ask method.
    @see com.stevesoft.pat.apps.Message#ask(java.awt.Component)
  */
  public boolean action(Event e,Object o) {
    if(c == null) return true;
    dispose();
    btxt = ((Button)e.target).getLabel();
    e.target = this;
    c.postEvent(e);
    return true;
  }
}

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

/** Programmatically clicks the Button if in AWT mode. */
  public void click(Component comp, int x, int y, int mask, int count) {
    if (getEventMode() == EM_AWT) {
      postEvent(comp, new ActionEvent(comp, ActionEvent.ACTION_PERFORMED,
                      ((Button)comp).getLabel()));
    }
    else {
      super.click(comp, x, y, mask, count);
    }
  }
}

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

descStr.append(": ").append(((Label) c).getText());
} else if (c instanceof Button) {
  descStr.append(": ").append(((Button) c).getLabel());
} else if (c instanceof Checkbox) {
  descStr.append(": ").append(((Checkbox) c).getLabel());

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

public static String getLabel(Component c) {
  String label = null;
  if (c instanceof JComponent) {
    Object obj =
      ((JComponent)c).getClientProperty(LABELED_BY_PROPERTY);
    // While the default is a JLabel, users may use something else as
    // the property, so be careful.
    if (obj != null) {
      if (obj instanceof JLabel) {
        label = ((JLabel)obj).getText();
      }
      else if (obj instanceof String) {
        label = (String)obj;
      }
    }
  }
  else if (c instanceof Button) {
    label = ((Button)c).getLabel();
  }
  else if (c instanceof Checkbox) {
    label = ((Checkbox)c).getLabel();
  }
  return ComponentTester.stripHTML(label);
}

代码示例来源:origin: stackoverflow.com

if (enter.getLabel() == "Enter MP1 Grade") {
  mp1 = Double.parseDouble(gradeField.getText());
  enter.setLabel("Enter MP2 Grade");
} else if (enter.getLabel() == "Enter MP2 Grade") {
  mp2 = Double.parseDouble(gradeField.getText());
  enter.setLabel("Enter Exam1 Grade");
} else if (enter.getLabel() == "Enter Exam1 Grade") {
  exam1 = Double.parseDouble(gradeField.getText());
  enter.setLabel("Enter MP3 Grade");
} else if (enter.getLabel() == "Enter MP3 Grade") {
  mp3 = Double.parseDouble(gradeField.getText());
  enter.setLabel("Enter MP4 Grade");
} else if (enter.getLabel() == "Enter MP4 Grade") {
  mp4 = Double.parseDouble(gradeField.getText());
  enter.setLabel("Enter Exam2 Grade");
} else if (enter.getLabel() == "Enter Exam2 Grade") {
  exam2 = Double.parseDouble(gradeField.getText());
  enter.setLabel("Calculate Final Grade");
} else if (enter.getLabel() == "Calculate Final Grade") {
  finalGrade = Math1.calcAverage(mp1, mp2, exam1, mp3, mp4, exam2);
  letterGrade = Math1.getLetter(finalGrade);

代码示例来源:origin: stackoverflow.com

if (source.getLabel() == "Add") {
  txtArea.append("Sum : " + sum + "\n");
if (source.getLabel() == "Subtract") {
  txtArea.append("Sub : " + Sub + "\n");
if (source.getLabel() == "Multiply") {
  txtArea.append("Mul = " + Mul + "\n");
if (source.getLabel() == "Divide") {
  txtArea.append("Divide = " + Div);

相关文章