水平移动JScrollPane会导致文本模糊 [英] Moving JScrollPane horizontally results in blured text
问题描述
我在标准JPanel中的JScrollPane中有一个TextArea。
I have a TextArea inside JScrollPane inside standard JPanel.
JPanel panelMain = new JPanel();
panelMain.setBorder(titledBorder1);
panelMain.setBounds(new Rectangle(2, 5, 970, 700));
panelMain.setLayout(null);
JTextArea fieldBody = new JTextArea();
JScrollPane fieldBodyScrollPane = new JScrollPane(fieldBody);
fieldBodyScrollPane.setBounds(70, 140, 790, 500);
panelMain.add(fieldBodyScrollPane);
当我在一行中键入足够的文本时,水平旋钮出现 - 到目前为止还不错。但是当我开始左右移动旋钮时,文本会变得模糊(见图)。有趣的是,当我上下移动textarea时,没有什么奇怪的事情发生。
When I type enough text in a single row the horizontal knob appears - so far good. But when I start moving the knob left and right, the text gets blured (see image). Interestingly, nothing weird happens when I move the textarea up and down.
我在Unity中使用Ubuntu 12.04。这个图形工件以前从未出现过。有什么提示可能是什么问题?
I use Ubuntu 12.04 with Unity. This graphic artifact never appeared to me before. Any hints what could be the problem?
推荐答案
import java.awt.GridLayout;
import javax.swing.*;
import javax.swing.border.*;
public class CaseForLayoutsNumber547 {
CaseForLayoutsNumber547() {
Border titledBorder1 = new TitledBorder("Case for Layouts #547");
// START: code snippet variant
JPanel panelMain = new JPanel(new GridLayout());
panelMain.setBorder(titledBorder1);
JTextArea fieldBody = new JTextArea(5,40);
JScrollPane fieldBodyScrollPane = new JScrollPane(fieldBody);
panelMain.add(fieldBodyScrollPane);
// END: code snippet variant
JOptionPane.showMessageDialog(null, panelMain);
}
public static void main(String[] args) {
Runnable r = new Runnable() {
@Override
public void run() {
new CaseForLayoutsNumber547();
}
};
SwingUtilities.invokeLater(r);
}
}
我在这个SSCCE中没有看到任何滚动工件。你呢?
I do not see any scroll artifacts in this SSCCE. Do you?
这篇关于水平移动JScrollPane会导致文本模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!