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

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

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

JTextPane.putClientProperty介绍

暂无

代码示例

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

JTextPane textPane = new JTextPane();
textPane.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

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

private List<Highlight> getHighlights(JTextPane pane) {
  List<Highlight> highlights = (List<Highlight>) pane.getClientProperty(HIGHLIGHTS_PROPERTY);
  if(highlights == null) {
    highlights = new LinkedList<Highlight>();
    pane.putClientProperty(HIGHLIGHTS_PROPERTY, highlights);
  }
  return highlights;
}

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

private JComponent createEastPanel() {
 _piperDocument = new DefaultStyledDocument();
 _piperTextFilter = new PiperTextFilter( _piperDocument );
 _textPane = new JTextPane( _piperDocument );
 _textPane.putClientProperty( "caretWidth", 2 );
 _textPane.setCaretColor( Color.MAGENTA );
 _textPane.setEditable( false );
 final JScrollPane scroll = new JScrollPane( _textPane );
 final TextLineNumber lineNumber = new TextLineNumber( _textPane, 2 );
 scroll.setRowHeaderView( lineNumber );
 scroll.setMinimumSize( new Dimension( 100, 10 ) );
 return scroll;
}

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

private JComponent createEastPanel() {
 _piperDocument = new DefaultStyledDocument();
 _piperTextFilter = new PiperTextFilter( _piperDocument );
 _textPane = new JTextPane( _piperDocument );
 _textPane.putClientProperty( "caretWidth", 2 );
 _textPane.setCaretColor( Color.MAGENTA );
 final JScrollPane scroll = new JScrollPane( _textPane );
 final TextLineNumber lineNumber = new TextLineNumber( _textPane, 2 );
 scroll.setRowHeaderView( lineNumber );
 scroll.setMinimumSize( new Dimension( 100, 10 ) );
 return scroll;
}

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

private void initSourceEditor() {
  sourceEditorPane.setEditorKit(MimeLookup.getLookup(HTML_CONTENT_TYPE).lookup(EditorKit.class));
  // ui
  Font font = new JLabel().getFont();
  sourceEditorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
  sourceEditorPane.setFont(font);
  previewTextPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
  previewTextPane.setFont(font);
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

protected HashPanel(final String header) {

  super(new BorderLayout());
  
  setBorder(BorderFactory.createCompoundBorder(BorderFactory
      .createTitledBorder(header), BorderFactory.createEmptyBorder(
          5, 5, 5, 5)));
  
  // Text panes -> Comments
  hashTextPane = new JTextPane();
  
  hashTextPane.putClientProperty("charset", "UTF-8");
  hashTextPane.setEditable(false);
  hashTextPane.setVisible(true);
  hashTextPane.setFont(new Font("Verdana", Font.BOLD, 10));
  hashTextPane.setMargin(new Insets(1, 1, 1, 1));
  hashTextPane.setBackground(Color.LIGHT_GRAY);
  hashTextPane.setForeground(new Color(51, 51, 102));
  final JScrollPane hashScrollPane = new JScrollPane(hashTextPane,
      JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
      JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  this.add(hashScrollPane, BorderLayout.CENTER);
  
  hashTextPane.setText("Select Alt + Enter to Encode / Alt + Backspace to decode");
}

代码示例来源:origin: cytoscape.coreplugins/biopax

textPane.setEditable(false);
textPane.setContentType("text/html");
textPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

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

infoPanel.setEditorKitForContentType("text/html", new HTMLEditorKit()); //NOI18N
infoPanel.setContentType("text/html;charset=UTF-8"); //NOI18N
infoPanel.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
javadocList.addListSelectionListener(new ListSelectionListener() {
  @SuppressWarnings("synthetic-access")

代码示例来源:origin: cytoscape.coreplugins/biopax

/**
 * Constructor.
 */
public BioPaxDetailsPanel() {
  JLabel label = new JLabel();
  textPane = new JTextPane();
  //  Set Editor Kit that is capable of handling long words
  MyEditorKit kit = new MyEditorKit();
  textPane.setEditorKit(kit);
  modifyStyleSheetForSingleDocument(textPane);
  textPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
  textPane.setBorder(new EmptyBorder (5,5,5,5));
  textPane.setContentType("text/html");
  textPane.setEditable(false);
  textPane.addHyperlinkListener(new LaunchExternalBrowser());
  resetText();
  scrollPane = new JScrollPane(textPane);
  scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
  scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
  this.setLayout(new BorderLayout());
  this.add(scrollPane, BorderLayout.CENTER);
  this.setPreferredSize(new Dimension(300, 300));
  this.setMaximumSize(new Dimension(300, 300));
  // get a ref to node attributes
  nodeAttributes = Cytoscape.getNodeAttributes();
}

代码示例来源:origin: antlr/codebuff

scope.getOrigTextPane().putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
scope.getOrigTextPane().setFont(docFont);
scope.getFormattedTextPane().putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
scope.getFormattedTextPane().setFont(docFont);
scope.getOrigTextPane().setText(originalText);

代码示例来源:origin: hneemann/Digital

/**
 * Creates a new Frame
 *
 * @param owner the owner frame
 * @param font  the font to use
 */
public AllSolutionsDialog(JDialog owner, Font font) {
  super(owner, Lang.get("win_allSolutions"), false);
  setDefaultCloseOperation(HIDE_ON_CLOSE);
  textPane = new JTextPane();
  textPane.setContentType("text/html");
  textPane.setFont(font);
  textPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
  textPane.setEditable(false);
  textPane.setPreferredSize(Screen.getInstance().scale(new Dimension(600, 300)));
  scroll = new JScrollPane(textPane);
  getContentPane().add(scroll);
  pack();
  setLocation(0, 0);
}

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

private JTextPane createEditablePane() {
  JTextPane textPane = new JTextPane();
  // Get the preferences for wrapping lines of text
  final boolean wrapText = JBroFuzz.PREFS.getBoolean(
      JBroFuzzPrefs.FUZZING[2].getId(), false);
  if (wrapText) {
    textPane = new JTextPane();
  } else {
    textPane = new NonWrappingTextPane();
  }
  textPane.putClientProperty("charset", "UTF-8");
  textPane.setEditable(true);
  textPane.setVisible(true);
  textPane.setFont(new Font("Verdana", Font.PLAIN, 12));
  textPane.setMargin(new Insets(1, 1, 1, 1));
  textPane.setBackground(Color.WHITE);
  textPane.setForeground(Color.BLACK);
  // Set the editor kit responsible for highlighting
  textPane.setEditorKit(new StyledEditorKit() {
    private static final long serialVersionUID = -6085642347022880064L;
    public Document createDefaultDocument() {
      return new TextHighlighter();
    }
  });
  // Right click: Cut, Copy, Paste, Select All
  RightClickPopups.rightClickRequestTextComponent(this, textPane);
  return textPane;
}

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

@Override
  public void run() {
    StyledDocument doc = pane.getStyledDocument();
    Style hlStyle = doc.addStyle("regularBlue-findtype", defStyle);     // NOI18N
    hlStyle.addAttribute(HyperlinkSupport.TYPE_ATTRIBUTE, new TypeLink());
    StyleConstants.setForeground(hlStyle, UIUtils.getLinkColor());
    StyleConstants.setUnderline(hlStyle, true);            
    List<Integer> l = Collections.emptyList();
    try {
      l = getHighlightOffsets(doc.getText(0, doc.getLength()));
    } catch (BadLocationException ex) {
      Support.LOG.log(Level.SEVERE, null, ex);
    }
    List<Highlight> highlights = new ArrayList<Highlight>(l.size());
    for (int i = 0; i < l.size(); i++) {
      highlights.add(new Highlight(l.get(i), l.get(++i)));
    }
    pane.putClientProperty(HIGHLIGHTS_PROPERTY, highlights);
    pane.removeMouseMotionListener(FindTypesSupport.this);
    pane.addMouseMotionListener(FindTypesSupport.this);
    pane.removeMouseListener(FindTypesSupport.this);
    pane.addMouseListener(FindTypesSupport.this);
  }
});

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

pane.putClientProperty(PREV_HIGHLIGHT_PROPERTY, null);
pane.putClientProperty(PREV_HIGHLIGHT_ATTRIBUTES, null);
    Style hlStyle = doc.getStyle("regularBlue-findtype");               // NOI18N
    pane.putClientProperty(PREV_HIGHLIGHT_ATTRIBUTES, as.copyAttributes());
    doc.setCharacterAttributes(h.startOffset, h.endOffset - h.startOffset, hlStyle, true);
    pane.putClientProperty(PREV_HIGHLIGHT_PROPERTY, h);

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

ErrorManager.getDefault().log(ErrorManager.INFORMATIONAL, "Url " + descURL + " has charset " + charset); // NOI18N
if (charset != null) {
  infoPanel.putClientProperty("charset", charset); // NOI18N

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

/**
 * Creates new form WikiEditPanel
 */
public WikiEditPanel(String wikiLanguage, boolean editing, boolean switchable) {
  this.wikiLanguage = wikiLanguage;
  this.switchable = switchable;
  this.wikiFormatText = "";
  this.htmlFormatText = "";
  initComponents();
  pnlButtons.setVisible(switchable);
  textCode.getDocument().addDocumentListener(new RevalidatingListener());
  textPreview.getDocument().addDocumentListener(new RevalidatingListener());
  textCode.addCaretListener(new CaretListener() {
    @Override
    public void caretUpdate(CaretEvent e) {
      makeCaretVisible(textCode);
    }
  });
  textCode.getDocument().addDocumentListener(new EnablingListener());
  // A11Y - Issues 163597 and 163598
  UIUtils.fixFocusTraversalKeys(textCode);
  UIUtils.issue163946Hack(scrollCode);
  Spellchecker.register(textCode);
  textPreview.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
  setEditing(editing);
}

代码示例来源:origin: cytoscape.coreplugins/cpath2

textPane.setBorder(new EmptyBorder(7,7,7,7));
textPane.setContentType("text/html");
textPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
textPane.addHyperlinkListener(new HyperlinkListener() {
  public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {

代码示例来源:origin: org.cytoscape/cpath2-impl

textPane.setBorder(new EmptyBorder(7,7,7,7));
textPane.setContentType("text/html");
textPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
textPane.addHyperlinkListener(new HyperlinkListener() {
  public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {

代码示例来源:origin: com.davidbracewell/hermes-core

editorPane.setEditable(false);
editorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
editorPane.getCaret().setVisible(true);
DEFAULT = editorPane.addStyle("DEFAULT", null);

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

textPane.putClientProperty("HighlightsLayerExcludes", "^org\\.netbeans\\.modules\\.editor\\.lib2\\.highlighting\\.CaretRowHighlighting$");

相关文章

JTextPane类方法