javax.swing.JTextArea.getUI()方法的使用及代码示例

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

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

JTextArea.getUI介绍

暂无

代码示例

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

JTextArea edit = new JTextArea(...);
...
try
{
  FileReader reader = new FileReader( "TextAreaLoad.txt" );
  BufferedReader br = new BufferedReader(reader);
  EditorKit kit = edit.getUI().getEditorKit(edit);
  Document doc = edit.getDocument();
  kit.read(br, doc, doc.getLength());
  br.close();
}
catch(Exception e2) { System.out.println(e2); }

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

void write(Writer writer) throws IOException {
  Document document = textArea.getDocument();
  // According to the documentation in DefaultEditorKit, the line separator is set to be as the system property
  // if no other line separator exists in the file, but in practice it is not, so this is a workaround for it
  if (!lineSeparatorExists)
    document.putProperty(DefaultEditorKit.EndOfLineStringProperty, System.getProperty("line.separator"));
  try {
    textArea.getUI().getEditorKit(textArea).write(new BufferedWriter(writer), document, 0, document.getLength());
  }
  catch(BadLocationException e) {
    throw new IOException(e.getMessage());
  }
}

代码示例来源:origin: com.numdata/numdata-swing

result.setFont( (Font)UIManager.get( "Label.font" ) );
result.setForeground( (Color)UIManager.get( "Label.foreground" ) );
makeTransparent( result, result.getUI() );

代码示例来源:origin: AndreasFagschlunger/O2Xfs

@Override
public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
  final Component template = super.getTableCellRendererComponent(table,
      value, isSelected, hasFocus, row, column);
  textArea.setForeground(template.getForeground());
  textArea.setBackground(template.getBackground());
  textArea.setBorder(((JLabel) template).getBorder());
  textArea.setText(String.valueOf(value));
  final TableColumn tableColumn = table.getColumnModel()
      .getColumn(column);
  final View view = textArea.getUI().getRootView(textArea);
  view.setSize(tableColumn.getWidth(), 0);
  final int rowHeight = (int) view.getPreferredSpan(View.Y_AXIS)
      + (table.getIntercellSpacing().height * 2);
  if (table.getRowHeight(row) != rowHeight) {
    table.setRowHeight(row, rowHeight);
  }
  return textArea;
}

代码示例来源:origin: com.github.gumtreediff/client.diff

txtSrc.getUI().getEditorKit(txtSrc).read(new FileReader(srcPath), txtSrc.getDocument(), 0);
  txtDst.getUI().getEditorKit(txtDst).read(new FileReader(dstPath), txtDst.getDocument(), 0);
} catch (IOException | BadLocationException e) {
  e.printStackTrace();

代码示例来源:origin: GumTreeDiff/gumtree

.getUI()
  .getEditorKit(txtSrc)
  .read(new StringReader(readFileAsString(srcPath)), txtSrc.getDocument(), 0);
txtDst
  .getUI()
  .getEditorKit(txtDst)
  .read(new StringReader(readFileAsString(dstPath)), txtDst.getDocument(), 0);

相关文章

JTextArea类方法