private AttributeSet getStyle() { return text.getCharacterAttributes(); }
JTextPane myTextPane = new JTextPane(); SimpleAttributeSet sas = new SimpleAttributeSet(myTextPane.getCharacterAttributes());
Color newTextColor = JColorChooser.showDialog(this, "Choose a Color", Color.black); SimpleAttributeSet sas = new SimpleAttributeSet(myTextPane.getCharacterAttributes()); StyleConstants.setForeground(sas, newTextColor); try {
AttributeSet attributes = jTextPane1.getCharacterAttributes(); System.out.println("Bold " + attributes.containsAttribute(StyleConstants.Bold, Boolean.TRUE)); System.out.println("Italic " + attributes.containsAttribute("Italic " + StyleConstants.Italic, Boolean.TRUE));
AttributeSet attributes = myJTextComponent.getCharacterAttributes(); String attributeFamily = attributes.getAttribute(StyleConstants.FontFamily).toString();
AttributeSet mainAttrs = jtpMain.getCharacterAttributes(); Enumeration e = mainAttrs.getAttributeNames(); Object activeFontName = (Object) (Translatrix.getTranslationString("SelectorToolFontsDefaultFont"));
sasText = new SimpleAttributeSet(parentTextPane.getCharacterAttributes()); Enumeration attribEntries1 = sasText.getAttributeNames(); while(attribEntries1.hasMoreElements() && currentAnchor.equals("")) insertAttribute(sasAttr, entryKey, entryValue); SimpleAttributeSet baseAttrs = new SimpleAttributeSet(parentEkit.getTextPane().getCharacterAttributes()); Enumeration attribEntriesOriginal = baseAttrs.getAttributeNames(); while(attribEntriesOriginal.hasMoreElements())
public Color getColor() { return StyleConstants.getForeground(muTextPane.getCharacterAttributes());
} else if (command.equals("whattags")) { System.out.println("Caret Position : " + jtpMain.getCaretPosition()); AttributeSet attribSet = jtpMain.getCharacterAttributes(); Enumeration attribs = attribSet.getAttributeNames(); System.out.println("Attributes : ");
public void actionPerformed(ActionEvent e) { JTextPane parentTextPane = core_.getTextPane(); SimpleAttributeSet sasText = new SimpleAttributeSet(parentTextPane.getCharacterAttributes()); SimpleAttributeSet sasPara = new SimpleAttributeSet(parentTextPane.getParagraphAttributes()); String selText = parentTextPane.getSelectedText();