Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue regarding Glass Pane

 
Chandrashekhar Nathile
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends ,
I have an outer panel which includes panel & scrollpane ( scrollpane contains text area) what i want is whenever user click on that outer panel, i need to draw a vertical line on that outer panel & when user again click on that same line , that line will be deleted but along with this , scrolling of that scroll pane is also possible.

so what i think is to set glass pane on that outer panel & trap mouse event , so it works fine but in this case i don't have any controll on the scrolling of the scroll pane .

so what i need to do to handle both things (drawing a line & handeling scrolling) .


so please help me out , Thanks in advance .
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the second code snippet in The Glass Pane section of How to Use Root Panes for the technique of re–dispatching events to the component below the glass pane.
 
Chandrashekhar Nathile
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Craig for your quick reply ,

But i want to ask you is it possible to set glasspane on panel ?
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to set glasspane on panel
Strictly speaking, no. A glass pane is set on a JRootPane - see api.
There is another way. You can set a non–opaque JPanel over another JPanel with an OverlayLayout.
 
Chandrashekhar Nathile
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Craig ,
According to your suggestion i have added another panel on same location with Opaque as False but now i want trap & dispatch event on JScrollpane when ever user click on scroll bar of JScrollpane so i used Dispatch Event Method but it is working ,
so please help me out .
 
Chandrashekhar Nathile
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry , Dispatch event method is not working (means i can't dispatch event to scrollbar) .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic