javax.swing.JLabel.getLabelFor()方法的使用及代码示例

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

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

JLabel.getLabelFor介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-jellytools-ruby

public boolean checkComponent(Component comp) {
  JLabel jLabel = (JLabel) comp;
  String text = jLabel.getText();
  if (text == null || nameAndLocationLabel.equals(text)) {
    return false;
  } else if (text.indexOf(nameLabel) > -1 && (jLabel.getLabelFor() == null || jLabel.getLabelFor() instanceof JTextField)) {
    return true;
  }
  return false;
}

代码示例来源:origin: senbox-org/snap-desktop

private JLabel findLabelFor(JComponent component) {
    Optional<Component> label = Arrays.stream(component.getParent().getComponents())
        .filter(c -> c instanceof JLabel && component.equals(((JLabel) c).getLabelFor()))
        .findFirst();
    return label.map(component1 -> (JLabel) component1).orElse(null);
  }
}

代码示例来源:origin: joel-costigliola/assertj-swing

@Nonnull private <T> T labelFor(@Nonnull Component label, @Nonnull Class<T> type) {
 assertThat(label).isInstanceOf(JLabel.class);
 Component target = ((JLabel) label).getLabelFor();
 assertThat(target).isInstanceOf(type);
 return type.cast(target);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-junit-ui

&& (((JLabel) opposite).getLabelFor() == tfClassToTest)) {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-junit-ui

Component labelFor = lbl.getLabelFor();
if ((labelFor != null) && (labelFor != tfClassToTest)
    && (lbl.getDisplayedMnemonic() != 0)) {

代码示例来源:origin: com.jgoodies/jgoodiesforms

/**
 * Checks and answers whether the given component shall be set
 * as component for a previously added label using
 * {@link JLabel#setLabelFor(Component)}.
 *
 * This default implementation checks whether the component is focusable,
 * and - if a JComponent - whether it is already labeled by a JLabel.
 * Subclasses may override.
 *
 * @param label        the candidate for labeling {@code component}
 * @param component    the component that could be labeled by {@code label}
 * @return true if focusable, false otherwise
 */
protected boolean isLabelForApplicable(JLabel label, Component component) {
  // 1) Is the label labeling a component?
  if (label.getLabelFor() != null) {
    return false;
  }
  // 2) Is the component focusable?
  if (!component.isFocusable()) {
    return false;
  }
  // 3) Is the component labeled by another label?
  if (!(component instanceof JComponent)) {
    return true;
  }
  JComponent c = (JComponent) component;
  return c.getClientProperty(LABELED_BY_PROPERTY) == null;
}

代码示例来源:origin: joel-costigliola/assertj-swing

return false;
Component labeled = labelForComponent.getLabelFor();
return type.isInstance(labeled) && requireShowingMatches(checkNotNull(labeled));

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

if (c instanceof JLabel) {
 JLabel lb = (JLabel) c;
 if (lb.getLabelFor() == null) {
  Component tg = (Component) v.elementAt(i + 1);
  if (!tg.isFocusable() && (tg instanceof Container)) {
 int mn = lb.getDisplayedMnemonic();
 if (auto && (mn <= 0) && (lb.getLabelFor() != null)) {
  String tx = candidateMnemonics(lb.getText());
  if (tx != null) for (int j = 0; j < tx.length(); j++) {

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

Component c = label.getLabelFor();
  JTextField tf = (JTextField) c;
  tf.setText(value);
Component c = label.getLabelFor();
JTextField tf = (JTextField) c;
prop.put(label.getText(), tf.getText());

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-junit-ui

&& (((JLabel) opposite).getLabelFor() == tfClassToTest)) {

相关文章

微信公众号

最新文章

更多

JLabel类方法