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

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

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

JTextComponent.putClientProperty介绍

暂无

代码示例

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

@Override
public void actionPerformed(ActionEvent evt, JTextComponent target) {
  target.putClientProperty(NextCharProvider.class, this);
  try {
    currentTarget = target;
    super.actionPerformed(evt, target);
  } finally {
    currentTarget = null;
    target.putClientProperty(NextCharProvider.class, null);
  }
}

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

/**
 * Sets the foreground color of the prompt on <code>textComponent</code>
 * and repaints the component to reflect the changes. This color will be
 * used when no text is present.
 * 
 * @param promptTextColor
 * @param textComponent
 */
public static void setForeground(Color promptTextColor, JTextComponent textComponent) {
  textComponent.putClientProperty(FOREGROUND, promptTextColor);
  textComponent.repaint();
}

代码示例来源:origin: com.jidesoft/jide-oss

public void action(Component c) {
  if (onlyOnce) {
    ((JTextComponent) c).putClientProperty(CLIENT_PROPERTY_ONLYONCE, Boolean.TRUE);
  }
  c.addFocusListener(SELECT_ALL);
}

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

public MarkProvider createMarkProvider(JTextComponent pane) {
  AnnotationMarkProvider amp = new AnnotationMarkProvider();
  pane.putClientProperty(PROVIDER_KEY, amp);
  return amp;
}

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

/**
 * Sets the foreground color of the prompt on <code>textComponent</code>
 * and repaints the component to reflect the changes. This color will be
 * used when no text is present.
 * 
 * @param promptTextColor
 * @param textComponent
 */
public static void setForeground(Color promptTextColor, JTextComponent textComponent) {
  textComponent.putClientProperty(FOREGROUND, promptTextColor);
  textComponent.repaint();
}

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

/**
 * Sets the foreground color of the prompt on <code>textComponent</code>
 * and repaints the component to reflect the changes. This color will be
 * used when no text is present.
 * 
 * @param promptTextColor
 * @param textComponent
 */
public static void setForeground(Color promptTextColor, JTextComponent textComponent) {
  textComponent.putClientProperty(FOREGROUND, promptTextColor);
  textComponent.repaint();
}

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

/**
 * Sets the foreground color of the prompt on <code>textComponent</code>
 * and repaints the component to reflect the changes. This color will be
 * used when no text is present.
 * 
 * @param promptTextColor
 * @param textComponent
 */
public static void setForeground(Color promptTextColor, JTextComponent textComponent) {
  textComponent.putClientProperty(FOREGROUND, promptTextColor);
  textComponent.repaint();
}

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

/**
 * Creates initially hidden annotations sidebar.
 * It's called once by target lifetime.
 */
public JComponent createSideBar(JTextComponent target) {
  final AnnotationBar ab = new AnnotationBar(target);
  target.putClientProperty(BAR_KEY, ab);
  return ab;
}

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

FoldingEditorSupport(FoldHierarchy h, JTextComponent component) {
  this.component = component;
  this.foldHierarchy = h;
  component.putClientProperty("org.netbeans.api.fold.expander", new C());
  foldHierarchy.addFoldHierarchyListener(this);
}

代码示例来源:origin: robo-code/robocode

/**
 * Uninstalls CurrentLineHighligher for the given JTextComponent.
 * @param c is the text component
 */
public static void uninstall(JTextComponent c) {
  c.putClientProperty(LINE_HIGHLIGHT, null);
  c.putClientProperty(PREVIOUS_CARET, null);
  c.removeCaretListener(caretListener);
  c.removeMouseListener(mouseListener);
  c.removeMouseMotionListener(mouseMotionListener);
  EditorThemePropertiesManager.removeListener(editorThemePropertyChangeListener);
}

代码示例来源: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.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * Sets the {@link FocusBehavior} on <code>textComponent</code> and
 * repaints the component to reflect the changes, if it is the focus owner.
 * 
 * @param focusBehavior
 * @param textComponent
 */
public static void setFocusBehavior(FocusBehavior focusBehavior, JTextComponent textComponent) {
  textComponent.putClientProperty(FOCUS_BEHAVIOR, focusBehavior);
  if (textComponent.isFocusOwner()) {
    textComponent.repaint();
  }
}

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

/**
 * Sets the {@link FocusBehavior} on <code>textComponent</code> and
 * repaints the component to reflect the changes, if it is the focus owner.
 * 
 * @param focusBehavior
 * @param textComponent
 */
public static void setFocusBehavior(FocusBehavior focusBehavior, JTextComponent textComponent) {
  textComponent.putClientProperty(FOCUS_BEHAVIOR, focusBehavior);
  if (textComponent.isFocusOwner()) {
    textComponent.repaint();
  }
}

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

/**
 * Sets the {@link FocusBehavior} on <code>textComponent</code> and
 * repaints the component to reflect the changes, if it is the focus owner.
 * 
 * @param focusBehavior
 * @param textComponent
 */
public static void setFocusBehavior(FocusBehavior focusBehavior, JTextComponent textComponent) {
  textComponent.putClientProperty(FOCUS_BEHAVIOR, focusBehavior);
  if (textComponent.isFocusOwner()) {
    textComponent.repaint();
  }
}

代码示例来源: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: org.netbeans.modules/org-netbeans-modules-editor-fold-nbui

@Override
public void foldsAttached(FoldHierarchy h) {
  FoldingEditorSupport supp = new FoldingEditorSupport(h, h.getComponent());
  // stick as client property to prevent GC:
  h.getComponent().putClientProperty(F.class, supp);
}

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

private void release() {
  target.putClientProperty(InstantRenamePerformer.class, null);
  if (doc instanceof BaseDocument) {
    ((BaseDocument) doc).removePostModificationDocumentListener(this);
  }
  target.removeKeyListener(this);
  target = null;
  region = null;
  attribs = null;
  
  requestRepaint();
  doc = null;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public void settingsChange(SettingsChangeEvent evt) {
  JTextComponent component = getComponent();
  if (component == null) return;
  
  if (evt == null || Utilities.getKitClass(component) != evt.getKitClass()) return;
  
  if (SettingsNames.CODE_FOLDING_ENABLE.equals(evt.getSettingName())){
    Boolean foldingEnabledBoolean =(Boolean)Settings.getValue(evt.getKitClass(), SettingsNames.CODE_FOLDING_ENABLE);
    foldingEnabled = foldingEnabledBoolean.booleanValue();
    component.putClientProperty(SettingsNames.CODE_FOLDING_ENABLE, foldingEnabledBoolean);
    needsRefresh = true;
    refresh();
  }
}

代码示例来源:origin: khuxtable/seaglass

protected void uninstallDefaults() {
  SeaGlassContext context = getContext(getComponent(), ENABLED);
  getComponent().putClientProperty("caretAspectRatio", null);
  getComponent().removeFocusListener(this);
  style.uninstallDefaults(context);
  context.dispose();
  style = null;
  super.uninstallDefaults();
}

相关文章

JTextComponent类方法