• Post Reply Bookmark Topic Watch Topic
  • New Topic

How To increase JToolBar, make JTabbedPanes scrollable

 
hema narayan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the JToolBar that runs across the JFrame i have added with borderlayout to the north of the frame..after having buttons over it from the left tp the right end of the frame...now no further buttons added are being displayed on the JToolBAr.
i want if they are not coming in one line then they must come on the next line..which is not happening
my question is how to make the size of the JToolBar increase so that the icons in it come on the next line as we usually observe for instance in Microsoft Word...plz help me out to solve my problem..
my other problem is how to m ake the JTabbed Panes scrollable the Layout option that is SCROLL_TABLAYOUT is not working...
plz tell me where i am wrong...
i am here giving u my code for u..
public static final int SCROLL_TAB_LAYOUT = 1;
jtp = new JTabbedPane(JTabbedPane.TOP);
jtp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
plz solve my problem...
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as the JToolBar goes...What you are seeing in MS Word is actually 2 Toolbars. So that's what would be the easiest to do is create a second JToolBar.
Now, about the Scrolling JTabbedPane, here is how I do it
JTabbedPane tab = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
You don't need to set the INT value of SCROLL_TAB_LAYOUT.
Hope that helps a little.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!