This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

scrollbar for JTabbedPane

 
vaka suresh
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
iam suresh. iam developing an simple java Swing application in which i have a main GUI which holds 6 tabs . is it possible to drag any of the tabs main GUI frame and view it seperately .
i tried setting a JScrollPane for the tabs but not visible .
could u pls help me out how to do this .
 
Pauline McNamara
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Suresh.
There's a little rule around here about what your display name has to look like: 2 names, preferably your real name or one that looks real (the name rule).
Could you please take a minute to change your display name? Thanks, and hope you visit the ranch often.
Pauline
 
Bill Liteplo
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you saying that you want to drag a tab out of a tabbed pane and show the contents of that tab in a separate frame/window? Should the tab be removed from the original window? Should the contents of that tab be removed from the tab or should they be duplicated?
Or am I misunderstanding you?
Bill
 
vaka suresh
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi liteplo
thanks for ur kind reply for the question i have asked in javaranch.
what u have asked is right .
when i drag a new window or panel should come and the one in the main tab should dissappear.

i want to drag a tab out of a tabbed pane and show the contents of that tab in a separate frame/window. the tab should be removed from the original window. The contents of that tab be removed from the tab
could u pls tell me how to add a scroll bar for the tabs , i have added the jscrollpane but the scroll bar is not visible.
 
Bill Liteplo
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try This post from, like, yesterday regarding making scrollbars appear.
API Javadocs are our friends
Regarding the DND issues... well, I'm not really an expert on that. I don't know how much, if at all, you have already attacked this problem. It helps if you are familiar with the Java drag and drop API (which I am not, really).
What I do know is that you should make the tab a drag source. That will let you pick it up. Then when you drag out of the window you can have your listener tell the tabbed pane to remove that tab. Since you don't really have a drop target other than thin air (i.e. the space on your screen not utilized by your Java program's windows), I'm not totally sure how to drop onto something, but I'm sure you can figure it out with some painstaking effort, sweat and significant profanity directed at Sun.
Sorry I can't give you much more than that.
Good luck!
Bill
 
vaka suresh
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
thanks for ur sujestion.
how can i add a scroll bar for the JTabbs. i have 6 tabs in a frame . i have added the tabs for a scrollpane but still iam not getting the scrollbars. couldu pls help me out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic