我正在執行此程序,並且我需要: a Frame
具有拆分視圖,適合框架的寬度,每個視圖都有多行,這些字符串包括這些字符串字符串可以具有特定的字體和顏色。如何將幀拆分爲多行視圖
您能否提供一些示例或我應該使用哪些類來解決問題?
謝謝@trashgod,這真的會幫助我。關於佈局,我在netbeans中構建了一個jframe,它擴展爲正在使用的屏幕的全分辨率,並且在它內部,我希望像您向我建議的那樣,2 JTextPane將jframe的一半寬度並排放置當jframe展開時調整自己的大小......直到現在,我在每個JTextPane上嘗試了setSize()和setPreferredSize(),但到目前爲止沒有任何想法爲什麼不工作?這裏是我的代碼
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int width = (int)screenSize.getWidth();
int height = (int)screenSize.getHeight();
System.out.println(width +" x "+ height);
this.setSize(width,height);
Dimension dimTextArea1 = new Dimension((width/2),height);
Dimension dimTextArea2 = new Dimension((width/2),height);
jTextPane1.setPreferredSize(dimTextArea1);
jTextPane2.setPreferredSize(dimTextArea2);
你看過[docs](http://docs.oracle.com/javase/tutorial/uiswing/)嗎? – tarrsalah 2013-05-06 23:56:30
是的,但我沒有找到我在找什麼。我對圖形是新的,我發現的所有東西都是jSplitpane,jTextArea和jTextPane。但在我看來,每個人都缺少我的一項要求。 – 2013-05-07 00:10:27
從[使用Swing創建UI](http://docs.oracle.com/javase/tutorial/uiswing/)開始並查看[How to Use Tables](http://docs.oracle.com/) javase/tutorial/uiswing/components/table.html)和[如何使用列表](http://docs.oracle.com/javase/tutorial/uiswing/components/list.html) – MadProgrammer 2013-05-07 00:12:10