本文整理了Java中javax.swing.JTextArea.getSize()
方法的一些代码示例,展示了JTextArea.getSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.getSize()
方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:getSize
暂无
代码示例来源:origin: ganshane/shakey
@Override public void run() {
m_msg.append(str);
m_msg.append( "\n\n");
Dimension d = m_msg.getSize();
m_msg.scrollRectToVisible( new Rectangle( 0, d.height, 1, 1) );
}
});
代码示例来源:origin: net.sf.sfac/sfac-core
public void append(final String txt) {
if (SwingUtilities.isEventDispatchThread()) {
textArea.append(txt);
if (!isScrollLock()) {
Dimension textAreaSize = textArea.getSize();
int textAreaHeight = textAreaSize.height;
if (textAreaHeight > 16) {
Rectangle bottomRect = new Rectangle(0, textAreaHeight - 16, 16, 16);
textArea.scrollRectToVisible(bottomRect);
}
}
} else {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
append(txt);
}
});
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
private static Color getGTKProfilerResultsBackground() {
int[] pixels = new int[1];
pixels[0] = -1;
// Prepare textarea to grab the color from
JTextArea textArea = new JTextArea();
textArea.setSize(new Dimension(10, 10));
textArea.doLayout();
// Print the textarea to an image
Image image = new BufferedImage(textArea.getSize().width, textArea.getSize().height, BufferedImage.TYPE_INT_RGB);
textArea.printAll(image.getGraphics());
// Grab appropriate pixels to get the color
PixelGrabber pixelGrabber = new PixelGrabber(image, 5, 5, 1, 1, pixels, 0, 1);
try {
pixelGrabber.grabPixels();
if (pixels[0] == -1) return Color.WHITE; // System background not customized
} catch (InterruptedException e) {
return getNonGTKProfilerResultsBackground();
}
return pixels[0] != -1 ? new Color(pixels[0]) : getNonGTKProfilerResultsBackground();
}
代码示例来源:origin: org.appdapter/org.appdapter.lib.gui
Dimension dim = treeTextField.getSize();
dim.height = 24;
treeTextField.setSize(dim);
内容来源于网络,如有侵权,请联系作者删除!