Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
Explore Cafepress

Name anything in the world, and we'll show you hundreds of products that celebrate it. Or, you can design your own.
From our sponsors
JTabbedPane Size問題
Jan 7th 2014, 09:57

大家好~
最近在寫一支程式 但是遇到這個問題已經卡好久了
懇求聰明的各位為小弟指點迷津...

問題是這樣的:
我的JFrame裡面 有一個 JTabbedPane
其中 JTabbedPane 包含兩個 Box ( New, TYPE)
New 裡面有個 JTextArea 大小是已經設定好了 跟視窗剛好合身
然後TYPE裡面有一個包含 JTree 的 JPanel
當JTree沒打開時 世界是很和平的
但是當JTree打開後 New 裡面的 整個JTabbedPane就會被拉長 拉超出JFrame外
我已經用 JScrollPane 想包住她 讓他不要亂延伸
可是當我打開TYPE裡面的JTree 然後再點去 New 再點回 TYPE後
JSCrollPane 就不見了 整個視窗還是被拉長...

請問我該怎麼做 才可以讓JTree打開時 點去New 整個視窗還是可以很合身很漂亮呢?

附上部分相關程式碼:

public class Test extends JFrame {

private JTabbedPane tabs = new JTabbedPane(JTabbedPane.TOP);
private Box New = Box.createVerticalBox();
private Box TYPE = Box.createHorizontalBox();
private JPanel PS ;
private JTextArea psFrame ;
private JScrollPane psSC ;
private JPanel TypePanel ;
TypeTree TT ;

public Test(){
super("TEST") ;
setSize(530, 180);
setLocation(700, 100);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLayout(new FlowLayout());
setResizable(false) ;

PS = new JPanel();
psFrame = new JTextArea(5, 40);
psSC = new JScrollPane(psFrame);
psSC.setHorizontalScrollBar(null);
PS.setLayout(new FlowLayout());
PS.add(psSC);
New.add(PS);

TypePanel = new JPanel();
TypePanel.setLayout(new GridLayout(1, 2));
TypePanel.add(new JButton("NewType"));
TT = new TypeTree();
TypePanel.add(new JScrollPane(TT));
TYPE.add(TypePanel);

tabs.addTab("New",New) ;
tabs.addTab("TYPE", TYPE);
add(tabs) ;

setVisible(true) ;
}

public class TypeTree extends JPanel {
JTree typeTree ;
public TypeTree() {
setLayout( new BorderLayout() ) ;
DefaultMutableTreeNode root = new DefaultMutableTreeNode(
new String("ROOT"));
typeTree = new JTree(root);

for( int i = 0 ; i < 10 ; i++ ){
DefaultMutableTreeNode next=new DefaultMutableTreeNode(i) ;
root.add(next);
}
add(typeTree) ;
setVisible(true) ;
}
}
main{...}//打不下了..
}

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

candycrushsaga3 發表在 痞客邦 留言(0) 人氣()

Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
Looking for something light while keeping you safe and comfortable during extended waterside activities?

Shop New Drainmaker Shoe for Men, Women and Kids at Columbia!
From our sponsors
請問要如何網拍?(新手)
Jan 7th 2014, 10:02

[unable to retrieve full-text content]

請問要如何網拍? 我是個無經驗者, 可以告訴我如何經營,和注意事項嗎?@@ 還有在哪裡可以網拍 謝謝!...
You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

candycrushsaga3 發表在 痞客邦 留言(0) 人氣()

Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
Explore Cafepress

Name anything in the world, and we'll show you hundreds of products that celebrate it. Or, you can design your own.
From our sponsors
Windows資訊安全中心 電腦問題
Jan 7th 2014, 10:04

Windows 7 電腦問題!! 

我家是Windows 7

我家電腦桌面右下角 是顯示時間日期的地方

然後往左邊一格 有一個三角形 有些我開的程式 例如:樂鬥 RC

都會在這三角形圖案裡面

可是很奇怪的 有一個旗幟圖案的 它上面寫說 解決一則PC問題

我按下去 它寫說要備份

已經出現很久了 我也沒在理這個

!!!!!!!!!!!!!! 只是問題是說 前幾天我看這圖案它上面有一個紅色XX ( 叉叉

點下去看跑出控制台 寫說 Windows資訊安全中心未開啟

然後我點開啟後 過大約1~2個小時我在看

又跑出一個紅色XX 又寫說 Windows資訊安全中心未開啟

已經很多天了

我有上網查照這個網址 http://support.microsoft.com/kb/2518278/zh-tw 去做

結果還是一樣沒變 會有一個紅色X跑出來 ( 不過是要去點三角形圖案後才會看到

雖然好像玩電腦沒甚麼不同

總感覺怪怪的= =

不把這個弄好我渾身不對勁 ( 我有強迫症

有啥好ㄉ解決方法ㄇ??

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

candycrushsaga3 發表在 痞客邦 留言(0) 人氣()