Goodevening一個可伸縮的JTextArea與滾動面板
怎麼能有像在NetBeans一個JTextArea(參見圖)
alt text http://img10.hostingpics.net/pics/968190Sans_titre.png
我的JTextArea中的代碼:
JTextArea infoArea = new JTextArea(10,10);
infoArea.setLineWrap(true);
infoArea.setFont(police);
infoArea.setForeground(Color.YELLOW);
infoArea.setBackground(Color.BLACK);
infoArea.setEditable(false);
JScrollPane scroll = new JScrollPane(infoArea);
scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scroll.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
scroll.setPreferredSize(new Dimension(sousFrame.getWidth(),90));
scroll.setFont(new Font("Arial", Font.BOLD, 13));
scroll.setBorder(BorderFactory.createTitledBorder("Output"));
謝謝
你能否試着解釋究竟哪些方法無效? – 2010-05-03 19:45:55
@Peter Lang:它工作的很好,但我確實想讓它像NetBeans中的輸出面板一樣可接受或可伸縮(見圖片) – Eddinho 2010-05-03 21:02:16