javax.swing.text.SimpleAttributeSet.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(111)

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

SimpleAttributeSet.<init>介绍

暂无

代码示例

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

SimpleAttributeSet sas = new SimpleAttributeSet();
 StyleConstants.setForeground(sas, Color.YELLOW);
 doc.setCharacterAttributes(start, length, sas, false);

代码示例来源:origin: stanfordnlp/CoreNLP

private AttributeSet getAttributeSet(String tag) {
 MutableAttributeSet attr = new SimpleAttributeSet();
 Color color = tagToColorMap.get(tag);
 StyleConstants.setBackground(attr, color);
 StyleConstants.setForeground(attr, Color.WHITE);
 return attr;
}

代码示例来源:origin: stanfordnlp/CoreNLP

private AttributeSet getAttributeSet(String tag) {
 MutableAttributeSet attr = new SimpleAttributeSet();
 Color color = tagToColorMap.get(tag);
 StyleConstants.setBackground(attr, color);
 StyleConstants.setForeground(attr, Color.WHITE);
 return attr;
}

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

StyledDocument doc = textPane.getStyledDocument();
SimpleAttributeSet center = new SimpleAttributeSet();
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
doc.setParagraphAttributes(0, doc.getLength(), center, false);

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

JTextPane textPane = new JTextPane();
textPane.setText( "original text" );
StyledDocument doc = textPane.getStyledDocument();

//  Define a keyword attribute

SimpleAttributeSet keyWord = new SimpleAttributeSet();
StyleConstants.setForeground(keyWord, Color.RED);
StyleConstants.setBackground(keyWord, Color.YELLOW);
StyleConstants.setBold(keyWord, true);

//  Add some text

try
{
  doc.insertString(0, "Start of text\n", null );
  doc.insertString(doc.getLength(), "\nEnd of text", keyWord );
}
catch(Exception e) { System.out.println(e); }

代码示例来源:origin: stanfordnlp/CoreNLP

private void removeTags() {
 if (editorPane.getContentType().equals("text/html")) {
  editorPane.setText(htmlContents);
  editorPane.revalidate();
  editorPane.repaint();
 } else {
  DefaultStyledDocument doc = (DefaultStyledDocument)editorPane.getDocument();
  SimpleAttributeSet attr = new SimpleAttributeSet();
  StyleConstants.setForeground(attr, Color.BLACK);
  StyleConstants.setBackground(attr, Color.WHITE);
  doc.setCharacterAttributes(0, doc.getLength(), attr, false);
 }
 saveTaggedAs.setEnabled(false);
}

代码示例来源:origin: igniterealtime/Openfire

final SimpleAttributeSet styles = new SimpleAttributeSet();
SwingWorker<String, Void> inputWorker = new SwingWorker<String, Void>() {
  @Override

代码示例来源:origin: stanfordnlp/CoreNLP

private void removeTags() {
 if (editorPane.getContentType().equals("text/html")) {
  if (htmlContents != null) {
   editorPane.setText(htmlContents);
  }
  editorPane.revalidate();
  editorPane.repaint();
 } else {
  DefaultStyledDocument doc = (DefaultStyledDocument)editorPane.getDocument();
  SimpleAttributeSet attr = new SimpleAttributeSet();
  StyleConstants.setForeground(attr, Color.BLACK);
  StyleConstants.setBackground(attr, Color.WHITE);
  doc.setCharacterAttributes(0, doc.getLength(), attr, false);
 }
 saveTaggedAs.setEnabled(false);
}

代码示例来源:origin: kiegroup/optaplanner

private JComponent createNoPlannerFoundTextField() {
  String infoMessage = "No planner benchmarks have been found in the benchmarkDirectory ("
      + benchmarkAggregator.getBenchmarkDirectory() + ").";
  JTextPane textPane = new JTextPane();
  textPane.setEditable(false);
  textPane.setText(infoMessage);
  // center info message
  StyledDocument styledDocument = textPane.getStyledDocument();
  SimpleAttributeSet center = new SimpleAttributeSet();
  StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
  StyleConstants.setBold(center, true);
  styledDocument.setParagraphAttributes(0, styledDocument.getLength(),
      center, false);
  return textPane;
}

代码示例来源:origin: stanfordnlp/CoreNLP

/**
 * Creates new form ParserPanel
 */
public ParserPanel() {
 initComponents();
 // create dialogs for file selection
 jfc = new JFileChooser(System.getProperty("user.dir"));
 pageDialog = new OpenPageDialog(new Frame(), true);
 pageDialog.setFileChooser(jfc);
 jfcLocation = new JFileChooserLocation(jfc);
 tlp = new PennTreebankLanguagePack();
 encoding = tlp.getEncoding();
 setFont();
 // create a timer
 timer = new javax.swing.Timer(ONE_SECOND, new TimerListener());
 // for (un)highlighting text
 highlightStyle = new SimpleAttributeSet();
 normalStyle = new SimpleAttributeSet();
 StyleConstants.setBackground(highlightStyle, Color.yellow);
 StyleConstants.setBackground(normalStyle, textPane.getBackground());
 this.chooseJarParser = new JarFileChooser(".*\\.ser\\.gz", this);
}

代码示例来源:origin: RipMeApp/ripme

/**
 * Write a line to the Log section of the GUI
 *
 * @param text the string to log
 * @param color the color of the line
 */
private void appendLog(final String text, final Color color) {
  SimpleAttributeSet sas = new SimpleAttributeSet();
  StyleConstants.setForeground(sas, color);
  StyledDocument sd = logText.getStyledDocument();
  try {
    synchronized (this) {
      sd.insertString(sd.getLength(), text + "\n", sas);
    }
  } catch (BadLocationException e) { }
  logText.setCaretPosition(sd.getLength());
}

代码示例来源:origin: marytts/marytts

int left = 10;
int right = 10;
SimpleAttributeSet set = new SimpleAttributeSet();
StyleConstants.setAlignment(set, StyleConstants.ALIGN_LEFT);
StyleConstants.setSpaceAbove(set, top);

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

background = new SimpleAttributeSet();
StyleConstants.setBackground(background, Color.RED);

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

SimpleAttributeSet set = new SimpleAttributeSet();

代码示例来源:origin: ron190/jsql-injection

private static void addStyle(String name, Color bg, Color fg, boolean bold,
    boolean italic) {
  SimpleAttributeSet style = new SimpleAttributeSet();
  StyleConstants.setFontFamily(style, HelperUi.FONT_UBUNTU_MONO.getFontName());
  StyleConstants.setFontSize(style, HelperUi.FONT_UBUNTU_MONO.getSize());
  StyleConstants.setBackground(style, bg);
  StyleConstants.setForeground(style, fg);
  StyleConstants.setBold(style, bold);
  StyleConstants.setItalic(style, italic);
  styles.put(name, style);
}

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

SimpleAttributeSet normal = new SimpleAttributeSet();
StyleConstants.setFontFamily(normal, "Serif");
StyleConstants.setFontSize(normal, 72);

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

SimpleAttributeSet levelStyle = new SimpleAttributeSet();
switch (level)
SimpleAttributeSet nameStyle = new SimpleAttributeSet();
StyleConstants.setForeground(nameStyle, new Color(0x6A6A6A));

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

SimpleAttributeSet green = new SimpleAttributeSet();
StyleConstants.setFontFamily(green, "Courier New Italic");
StyleConstants.setForeground(green, Color.GREEN);

//  Add some text

try
{
  textPane.getDocument().insertString(0, "green text with Courier font", green);
}
catch(Exception e) {}

代码示例来源:origin: igniterealtime/Spark

protected MutableAttributeSet getMessageStyle()
{
  final MutableAttributeSet style = new SimpleAttributeSet();
  StyleConstants.setFontFamily( style, "Dialog" );
  StyleConstants.setFontSize( style, SettingsManager.getLocalPreferences().getChatRoomFontSize() );
  StyleConstants.setForeground( style, messageColor );
  StyleConstants.setBackground( style, backgroundColor );
  return style;
}

代码示例来源:origin: igniterealtime/Spark

protected AttributeSet getStyle()
{
  final MutableAttributeSet style = new SimpleAttributeSet();
  StyleConstants.setFontFamily( style, "Dialog" );
  StyleConstants.setFontSize( style, SettingsManager.getLocalPreferences().getChatRoomFontSize() );
  StyleConstants.setForeground( style, textColor );
  StyleConstants.setBold( style, bold );
  StyleConstants.setItalic( style, italic );
  StyleConstants.setUnderline( style, underline );
  StyleConstants.setStrikeThrough( style, strikeThrough );
  return style;
}

相关文章