用于Eclipse的WindowBulder和垂直ScrollBar未在JTextArea上显示

时间:2013-06-05 15:38:35

标签: java swing jscrollpane jtextarea vertical-scrolling

我正在使用WindowBuilder为我的应用程序创建GUI。我正在使用JTextArea来显示Server的日志。为了能够读取我想要制作可滚动的JtextArea(垂直和水平)的所有日志记录。问题是垂直的不起作用。首先我添加了scrollpane,在scrollpane上我添加了JtextArea。这是我定义JtextArea和ScrollPane的代码。你能告诉我为什么垂直滚动条不起作用吗?问候。

textLogsArea = new JTextArea();
    textLogsArea.setText("Logovi Servera\n");
    textLogsArea.setFont(new Font("Times New Roman", Font.PLAIN, 12));
    scrollPane.setViewportView(textLogsArea);

以下是我定义scrollPane的代码行。 WindowBuilder添加了很多代码,所以我只提取程序定义scrollPane的行。如果您需要更多,请告诉我。

scrollPane = new JScrollPane();
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 684, Short.MAX_VALUE)

0 个答案:

没有答案