This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Swings - Remove the jscrollpane of enclosed jtabbedpane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Swings - Remove the jscrollpane of enclosed jtabbedpane" Watch "Swings - Remove the jscrollpane of enclosed jtabbedpane" New topic
Author

Swings - Remove the jscrollpane of enclosed jtabbedpane

ash neet
Ranch Hand

Joined: Dec 21, 2010
Posts: 33
Hi,

I have created a swing application where i have used jtabbedpane. Since the jtabbed pane was too big and required scrolling, i enclosed the jtabbed pane with jscroll pane by right clicking jtabbed pane, ->Enclose in -> jscrollpane. Now, the problem is, i want to remove this jscrollpane. how do i do this?
please help!
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Ash!

Champ, before posting a new question, please CarefullyChooseOneForum, in order to help us keep the forums well organized.

Let's slide this over to the Swing / AWT / SWT / JFace forum.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
ash neet
Ranch Hand

Joined: Dec 21, 2010
Posts: 33
Oops! Sorry. Actualy I am new to this Forum and did'nt know how to use. I will take care hereafter to post threads in respective forums.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Short answer: dump the visual design tool that forces you into such corners.

Longer answer: learn Swing coding. http://download.oracle.com/javase/tutorial/uiswing/index.html

Note: short / long in terms of how long it takes to follow the advice


luck, db
There are no new questions, but there may be new answers.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

And SwingIsAProperNoun.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Rob Prime wrote:And SwingIsAProperNoun.


Yes, otherwise, people may be confused with something else
B Mayes
Ranch Hand

Joined: Apr 28, 2010
Posts: 47

Darryl Burke wrote:Short answer: dump the visual design tool that forces you into such corners.

Longer answer: learn Swing coding. http://download.oracle.com/javase/tutorial/uiswing/index.html

Note: short / long in terms of how long it takes to follow the advice


This is probably the real answer -- it sounds like you're using a visual editor so it's difficult to tell you how to remove it (especially since we don't know which editor you are using). Most likely, the editor is creating a JTabbedPane object and then passing the object to a JScrollPane. The easiest thing to do is to switch your editor to allow you to manually modify the code and remove the JScrollPane.

I have pasted an example below of some code that I wrote to embed a JTextArea into a JScrollPane. Without it, the text area cannot be scrolled. The line that embeds the JTextArea object (named textArea) is just below the comment...should be pretty obvious. The object is passed to the constructor of JScrollPane. After that it's just a bunch of options being configured. You might be able to locate the point in your generated code where the JTabbedPane object gets embedded into a JScrollPane and just remove it manually. In my code below this would mean that I remove the JScrollPane named areaScrollPane (and all associated lines where I'm invoking methods of it).


Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

it sounds like you're using a visual editor

NetBeans Matisse, if I'm not mistaken.

I dislike the use of visual designers for creating a trivial GUI (the only kind I've ever created ) and I don't use Matisse, but I opened up a project I have stashed away (aptly named throwaway) and it tool me less than 10 minutes to figure out how to do this, in the Inspector pane.

No, I'm not saying more. This forum is for Swing, not Matisse.
ash neet
Ranch Hand

Joined: Dec 21, 2010
Posts: 33
Actually I am in hurry and can't go through the tutorial right now. As I have to submit this project soon, i want to fix this problem without manually coding. Please, suggest a way to do this using swing gui editor.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Since you want / need to do this with the GUI editor this no longer becomes a Swing problem but an IDE problem. I'm moving this thread to our IDE forum.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Since the question is now in the correct place -- in the Inspector window, drag the node for the JTextArea and drop it where it is no longer a child node of the JScrollPane.

But. Just remember that a visual designer like Matiss is most emphatically not a beginner's tool. You can learn Swing from online resources, but if you haven't a clue about Swing, you cannot learn to use a visual designer effectively.

Actually I am in hurry and can't go through the tutorial right now.

You can't afford not to. As you've experienced with this problem, you'll waste more time using a sophisticated tool that is several times more difficult to learn than Swing coding.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Swings - Remove the jscrollpane of enclosed jtabbedpane
 
Similar Threads
about JTabbed Pane
Help With JTabbed Pane
Jtabbed pane hiding a tab...?
Problem with JTabbed pane focus
JTabbed Pane