我在框架中使用JTextArea
来显示一些文本文件,其中包含以下属性
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
文件中的数据包含长行(html标题和正文)。 现在当我尝试使用鼠标选择文本时,我无法选择最后一个字符 除非我也选择下一行,否则将换行。
您也可以尝试运行此示例:
import javax.swing.*;
class frame extends JFrame{
JTextArea t=new JTextArea();
public frame(){
t.setLineWrap(true);
this.add(t);
t.setText("jhdbjcdbhhdjbcjbjbjbsjbcsbjsbcjsbcksnkniuhihdehsdbjsbcjbcbccccccccccccccccccccccc ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ccccccccccccccc");}
public static void main(String[] args){
frame f=new frame();
f.setSize(500,500);
f.setVisible(true); }
}