2017-05-03 70 views
0

我有一個TabbedPane,其中有100個標籤顯示在tabbedpane中。正因爲如此,我無法看到標籤的內容。如果有幾個標籤,iam能夠看到內容,當我點擊特定的標籤。所以我想提供垂直滾動到只有標籤。當更多數量的選項卡存在時,如何將VerticalScrollPane設置爲僅JtabbedPane中的選項卡?

JTabbedPane tabbedPane   = new JTabbedPane(); 
private void addTabForFiles(String fileName) 
    { 
     try 
     { 
      TextPanel panel = new TextPanel(); 
      tabbedPane.addTab(fileName, panel);  
     } 
     catch (Exception e) 
     { 
      e.printStackTrace(); 
     } 
    } 

<code>enter image description here</code>

回答

2

您可以使用:

tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT) 
+0

但它顯示爲horizantal滾動條,我想它作爲垂直滾動條 – srinivas

+0

@srinivas,然後切換到對製表符位置正確的。閱讀API以瞭解如何使用該組件。 – camickr

相關問題