aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes help with placing another JPanel inside a JScrollPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "help with placing another JPanel inside a JScrollPane" Watch "help with placing another JPanel inside a JScrollPane" New topic
Author

help with placing another JPanel inside a JScrollPane

Nirmit Dalal
Greenhorn

Joined: Mar 12, 2013
Posts: 22





















I HAVE TWO JPANELS named "UI" and "OUTPUTPAGE1" and one JScrollPane in which UI Jpanel is already present ....i want to replace UI Jpanel by OUTPUTPAGE1 JPanel by a mouseclick event
HELP!!
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
Way too much code to post. In the future post a proper SSCCE when yo uask a question.

i want to replace UI Jpanel by OUTPUTPAGE1


Nirmit Dalal
Greenhorn

Joined: Mar 12, 2013
Posts: 22
Rob Camick wrote:Way too much code to post. In the future post a proper SSCCE when yo uask a question.

i want to replace UI Jpanel by OUTPUTPAGE1







hey Rob ,
i know i have posted way too much code .... in learning phase ....
i have already tried this
....but not success



anywhere else i could be going wrong....maybe adding of mouselistener or anywhere else??
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
in learning phase ....


And that is way I suggested you need to start with an SSCCE.

Create a simple program that does what you need. Prove to yourself that it indeed is only a single line of code that is required to replace a component in a scrollpane.

Then once you get it working in a simple program you look to what is different in your real program. Like I said we don't have time to read through all that code.

maybe adding of mouselistener


Thats easy to check. Just add a println(..) statement in the listener to see if the code is executed.

or anywhere else??


A common problem is having two variable reference different scrollpanes. So maybe you have a class variable and an instance variable of the same name. Get rid of the instance variable.
Nirmit Dalal
Greenhorn

Joined: Mar 12, 2013
Posts: 22
i tried your trick of writing the minimal possible code which does what i want it to ....and it has worked ....would be posting a solution asap of my original problem so that i can contribute to this forum cheers
Nirmit Dalal
Greenhorn

Joined: Mar 12, 2013
Posts: 22
This is the FINAL SOLUTION THANK YOU ROB



Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
There is no need to revalidate() the viewport.
Nirmit Dalal
Greenhorn

Joined: Mar 12, 2013
Posts: 22
Rob Camick wrote:There is no need to revalidate() the viewport.




Ya you are right !!! good catch :P
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help with placing another JPanel inside a JScrollPane