help with placing another JPanel inside a JScrollPane
Nirmit Dalal
Greenhorn
Joined: Mar 12, 2013
Posts: 9
posted
0
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: 1787
2
posted
0
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: 9
posted
0
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: 1787
2
posted
0
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: 9
posted
0
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: 9
posted
1
This is the FINAL SOLUTION THANK YOU ROB
Rob Camick
Ranch Hand
Joined: Jun 13, 2009
Posts: 1787
2
posted
0
There is no need to revalidate() the viewport.
Nirmit Dalal
Greenhorn
Joined: Mar 12, 2013
Posts: 9
posted
0
Rob Camick wrote:There is no need to revalidate() the viewport.