• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swings - Remove the jscrollpane of enclosed jtabbedpane

 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And SwingIsAProperNoun.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:And SwingIsAProperNoun.


Yes, otherwise, people may be confused with something else
 
B Mayes
Ranch Hand
Posts: 47
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic