javax.swing.text.JTextComponent.getClientProperty()方法的使用及代码示例

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

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

JTextComponent.getClientProperty介绍

暂无

代码示例

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

/**
   * Returns the font style of the prompt text, or <code>null</code> if the
   * prompt's font style should not differ from the <code>textComponent</code>s
   * font.
   * 
   * @param textComponent
   * @return font style of the prompt text
   */
  public static Integer getFontStyle(JTextComponent textComponent) {
    return (Integer) textComponent.getClientProperty(FONT_STYLE);
  }
}

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

/**
 * Get the prompt text of <code>textComponent</code>.
 * 
 * @param textComponent
 * @return the prompt text
 */
public static String getPrompt(JTextComponent textComponent) {
  return (String) textComponent.getClientProperty(PROMPT);
}

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

/**
 * Get the prompt text of <code>textComponent</code>.
 * 
 * @param textComponent
 * @return the prompt text
 */
public static String getPrompt(JTextComponent textComponent) {
  return (String) textComponent.getClientProperty(PROMPT);
}

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

/**
 * Get the prompt text of <code>textComponent</code>.
 * 
 * @param textComponent
 * @return the prompt text
 */
public static String getPrompt(JTextComponent textComponent) {
  return (String) textComponent.getClientProperty(PROMPT);
}

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

/**
   * Returns the font style of the prompt text, or <code>null</code> if the
   * prompt's font style should not differ from the <code>textComponent</code>s
   * font.
   * 
   * @param textComponent
   * @return font style of the prompt text
   */
  public static Integer getFontStyle(JTextComponent textComponent) {
    return (Integer) textComponent.getClientProperty(FONT_STYLE);
  }
}

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

/**
 * Get the prompt text of <code>textComponent</code>.
 * 
 * @param textComponent
 * @return the prompt text
 */
public static String getPrompt(JTextComponent textComponent) {
  return (String) textComponent.getClientProperty(PROMPT);
}

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

/**
   * Returns the font style of the prompt text, or <code>null</code> if the
   * prompt's font style should not differ from the <code>textComponent</code>s
   * font.
   * 
   * @param textComponent
   * @return font style of the prompt text
   */
  public static Integer getFontStyle(JTextComponent textComponent) {
    return (Integer) textComponent.getClientProperty(FONT_STYLE);
  }
}

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

/**
   * Returns the font style of the prompt text, or <code>null</code> if the
   * prompt's font style should not differ from the <code>textComponent</code>s
   * font.
   * 
   * @param textComponent
   * @return font style of the prompt text
   */
  public static Integer getFontStyle(JTextComponent textComponent) {
    return (Integer) textComponent.getClientProperty(FONT_STYLE);
  }
}

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

public static AnnotationMarkProvider getMarkProvider(JTextComponent pane) {
    return (AnnotationMarkProvider) pane.getClientProperty(PROVIDER_KEY);
  }
}

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

/**
 * Get the foreground color of the prompt text. If no color has been set,
 * the <code>textComponent</code>s disabled text color will be returned.
 * 
 * @param textComponent
 * @return the color of the prompt text or
 *         {@link JTextComponent#getDisabledTextColor()} if none is set
 */
public static Color getForeground(JTextComponent textComponent) {
  if (textComponent.getClientProperty(FOREGROUND) == null) {
    return textComponent.getDisabledTextColor();
  }
  return (Color) textComponent.getClientProperty(FOREGROUND);
}

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

/**
 * Get the foreground color of the prompt text. If no color has been set,
 * the <code>textComponent</code>s disabled text color will be returned.
 * 
 * @param textComponent
 * @return the color of the prompt text or
 *         {@link JTextComponent#getDisabledTextColor()} if none is set
 */
public static Color getForeground(JTextComponent textComponent) {
  if (textComponent.getClientProperty(FOREGROUND) == null) {
    return textComponent.getDisabledTextColor();
  }
  return (Color) textComponent.getClientProperty(FOREGROUND);
}

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

/**
 * Shows annotations sidebar.
 */
public static AnnotationBar showAnnotationBar(JTextComponent target) {
  AnnotationBar ab = (AnnotationBar) target.getClientProperty(BAR_KEY);
  assert ab != null: "#58828 reappeared!"; // NOI18N
  ab.annotate();
  return ab;
}

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

/**
   * Tests wheteher given editor shows annotations.
   */
  public static boolean annotationBarVisible(JTextComponent target) {
    if (target == null) return false;
    AnnotationBar ab = (AnnotationBar) target.getClientProperty(BAR_KEY);
    if (ab == null) {
      return false;
    }
    return ab.isAnnotated();
  }
}

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

/**
 * Shows annotations sidebar.
 */
public static void hideAnnotationBar(JTextComponent target) {
  if (target == null) return;
  AnnotationBar ab = (AnnotationBar) target.getClientProperty(BAR_KEY);
  assert ab != null: "#58828 reappeared!"; // NOI18N
  ab.hideBar();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-editor-fold-nbui

/**
 * removeNotify will be called during sidebar rebuild, but
 * before the constructor for a new sidebar is called
 */
@Override
public void removeNotify() {
  Object o = component.getClientProperty(PROP_SIDEBAR_MARK);
  if (o == this) {
    component.putClientProperty(PROP_SIDEBAR_MARK, null);
  }
  super.removeNotify();
}

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

public static void assureInstalled(JTextComponent pane) {
  if (pane.getClientProperty(ComponentPeer.class) == null) {
    pane.putClientProperty(ComponentPeer.class, new ComponentPeer(pane));
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-editor-fold-nbui

/**
 * This is just in case; usually sidebars are created anew, so the constructor
 * will set the property. But if the components are just reattached, not rebuilt for
 * whatever reason, stuff back the flag removed in addNotify.
 */
@Override
public void addNotify() {
  super.addNotify();
  Object o = component.getClientProperty(PROP_SIDEBAR_MARK);
  if (o == null) {
    component.putClientProperty(PROP_SIDEBAR_MARK, this);
  }
}

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

public static synchronized OffsetsBag getBag(JTextComponent component) {
  OffsetsBag bag = (OffsetsBag) component.getClientProperty(SpellcheckerHighlightLayerFactory.class);
  Spellchecker.register (component);
  if (bag == null) {
    component.putClientProperty(SpellcheckerHighlightLayerFactory.class, bag = new OffsetsBag(component.getDocument()));
  }
  
  return bag;
}

代码示例来源:origin: com.jtattoo/JTattoo

protected void paintBackground(Graphics g) {
  g.setColor(getComponent().getBackground());
  if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
    Boolean doShow = (Boolean) getComponent().getClientProperty("doShowFocusFrame");
    if (doShow == null || doShow.booleanValue()) {
      if (getComponent().hasFocus() && getComponent().isEditable()) {
        g.setColor(AbstractLookAndFeel.getTheme().getFocusBackgroundColor());
      }
    }
  }
  g.fillRect(0, 0, getComponent().getWidth(), getComponent().getHeight());
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-refactoring

@Override
public boolean beforeRemove(DeletedTextInterceptor.Context context) throws BadLocationException {
  Object getObject = context.getComponent().getClientProperty(InstantRenamePerformer.class);
  if (getObject instanceof InstantRenamePerformer) {
    InstantRenamePerformer instantRenamePerformer = (InstantRenamePerformer)getObject;
    MutablePositionRegion region = instantRenamePerformer.region.getRegion(0);
    return ((context.isBackwardDelete() && region.getStartOffset() == context.getOffset()) || (!context.isBackwardDelete() && region.getEndOffset() == context.getOffset()));
  } else {
    return false;
  }
}
@Override

相关文章

JTextComponent类方法