2010-05-03 21 views
0

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")); 

謝謝

+1

你能否試着解釋究竟哪些方法無效? – 2010-05-03 19:45:55

+0

@Peter Lang:它工作的很好,但我確實想讓它像NetBeans中的輸出面板一樣可接受或可伸縮(見圖片) – Eddinho 2010-05-03 21:02:16

回答

1

我不確定NetBeans使用什麼,但我們在我最後的公司使用flexdock在Java Swing應用程序中創建可停靠的窗口(假設這是您的意思是「可伸縮」)。

+0

是的,就像在圖片中 – Eddinho 2010-05-03 20:23:05

+0

@tuxou:好的,然後一個對接框架就是你需要的。 Flexdock只是您可以在網上找到的許多產品之一(其中許多是免費的)。 – 2010-05-03 20:25:12

+0

flexdock中的任務列表 – Eddinho 2010-05-03 20:29:33