本文整理了Java中javax.swing.JTextArea.getInsets()
方法的一些代码示例,展示了JTextArea.getInsets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.getInsets()
方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:getInsets
暂无
代码示例来源:origin: org.netbeans.api/org-openide-dialogs
@Override
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus
) {
if (index == selected) {
numberLabel.setFont(doDeriveFont(numberLabel.getFont(), Font.BOLD));
ta.setFont(doDeriveFont(ta.getFont(), Font.BOLD));
} else {
numberLabel.setFont(doDeriveFont(numberLabel.getFont(), Font.PLAIN));
ta.setFont(doDeriveFont(ta.getFont(), Font.PLAIN));
}
if (contentNumbered) {
numberLabel.setText(Integer.toString(index + 1) + "."); // NOI18N
}
// #21322: on JDK1.4 wrapping width is cleared between two rendering runs
Insets taInsets = ta.getInsets();
ta.setSize(taWidth, taInsets.top + taInsets.bottom + 1);
ta.setText((String) value);
return this;
}
代码示例来源:origin: org.netbeans.api/org-openide-dialogs
taWidth -= 25;
Insets taInsets = ta.getInsets();
ta.setSize(taWidth, taInsets.top + taInsets.bottom + 1);
代码示例来源:origin: bobbylight/RSyntaxTextArea
Insets i = textArea.getInsets();
bounds.x = i.left;
bounds.y = i.top;
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private static int getTextAreaBaseline(JTextArea text, int height) {
Insets insets = text.getInsets();
FontMetrics fm = text.getFontMetrics(text.getFont());
return insets.top + fm.getAscent();
}
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private int getTextAreaBaseline(JTextArea text, int height) {
Insets insets = text.getInsets();
FontMetrics fm = text.getFontMetrics(text.getFont());
return insets.top + fm.getAscent();
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
{
if (index == selected) {
numberLabel.setFont(numberLabel.getFont().deriveFont(Font.BOLD));
ta.setFont(ta.getFont().deriveFont(Font.BOLD));
} else {
numberLabel.setFont(numberLabel.getFont().deriveFont(Font.PLAIN));
ta.setFont(ta.getFont().deriveFont(Font.PLAIN));
}
if (contentNumbered) {
numberLabel.setText(Integer.toString(index + 1) + "."); // NOI18N
}
// #21322: on JDK1.4 wrapping width is cleared between two rendering runs
Insets taInsets = ta.getInsets();
ta.setSize(taWidth,
taInsets.top + taInsets.bottom + 1);
ta.setText((String)value);
return this;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
{
if (index == selected) {
numberLabel.setFont(numberLabel.getFont().deriveFont(Font.BOLD));
ta.setFont(ta.getFont().deriveFont(Font.BOLD));
} else {
numberLabel.setFont(numberLabel.getFont().deriveFont(Font.PLAIN));
ta.setFont(ta.getFont().deriveFont(Font.PLAIN));
}
if (contentNumbered) {
numberLabel.setText(Integer.toString(index + 1) + "."); // NOI18N
}
// #21322: on JDK1.4 wrapping width is cleared between two rendering runs
Insets taInsets = ta.getInsets();
ta.setSize(taWidth,
taInsets.top + taInsets.bottom + 1);
ta.setText((String)value);
return this;
}
代码示例来源:origin: stackoverflow.com
public String formatText(JTextArea textArea)
{
StringBuilder text = new StringBuilder( textArea.getText() );
int lineHeight = textArea.getFontMetrics( textArea.getFont() ).getHeight();
Point view = new Point(textArea.getWidth(), textArea.getInsets().top);
int length = textArea.getDocument().getLength();
int endOfLine = textArea.viewToModel(view);
int lines = 0;
while (endOfLine < length)
{
int adjustedEndOfLine = endOfLine + lines;
if (text.charAt(adjustedEndOfLine) == ' ')
{
text.insert(adjustedEndOfLine + 1, '\n');
lines++;
}
view.y += lineHeight;
endOfLine = textArea.viewToModel(view);
}
return text.toString();
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
taWidth -= 25;
Insets taInsets = ta.getInsets();
ta.setSize(taWidth,
taInsets.top + taInsets.bottom + 1);
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
taWidth -= 25;
Insets taInsets = ta.getInsets();
ta.setSize(taWidth,
taInsets.top + taInsets.bottom + 1);
代码示例来源:origin: stackoverflow.com
private static int countLines(JTextArea textArea)
{
AttributedString text = new AttributedString(textArea.getText());
text.addAttribute(TextAttribute.FONT, textArea.getFont());
FontRenderContext frc = textArea.getFontMetrics(textArea.getFont()).getFontRenderContext();
AttributedCharacterIterator charIt = text.getIterator();
LineBreakMeasurer lineMeasurer = new LineBreakMeasurer(charIt, frc);
Insets textAreaInsets = textArea.getInsets();
float formatWidth = textArea.getWidth() - textAreaInsets.left - textAreaInsets.right;
lineMeasurer.setPosition(charIt.getBeginIndex());
int noLines = 0;
while (lineMeasurer.getPosition() < charIt.getEndIndex())
{
lineMeasurer.nextLayout(formatWidth);
noLines++;
}
return noLines;
}
代码示例来源:origin: com.fifesoft/rsyntaxtextarea
Insets i = textArea.getInsets();
bounds.x = i.left;
bounds.y = i.top;
内容来源于网络,如有侵权,请联系作者删除!