• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem while creating sliding panel

 
Punit Jain
Ranch Hand
Posts: 1012
2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m trying to add Sliding Panel, it works for me, but i have few problems in that:
when i am hovering over frame, it showing me the sliding panel, and when i am hovering out to the frame it disappears, but when i am hovering over my sliding panel, my sliding panel blinking and sometimes gets disappears.
the second problem is i want it to be transparent, and i used setOpaque(false), but it's not working.
the third problem is i want when i hover over frame, my sliding panel should appear with some effects, (like the SlideToggle effect of jQuery, SlideToggle).
how can i do this??
here is my code:
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> my sliding panel blinking and sometimes gets disappears.

you've added the listener to the panel.
you've added 4 sliders to the panel.
there are borders/gaps between each slider.
as the pointer enters the space of a slider, it 'exits' the panel,
as the pointer moves around, it might leave a slider and 're-enter' the panel

> i want it to be transparent, and i used setOpaque(false), but it's not working.

can't see any setOpaque(false) in your code. if you want that whole area transparent,
you'd have to make the sliders transparent, and they could have a number of
components in their makeup, also needing to be transparent.

> my sliding panel should appear with some effects, (like the SlideToggle effect of jQuery, SlideToggle).

several examples in this thread, try them all
http://www.coderanch.com/t/341737/GUI/java/Expand-Collapse-Panels
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but i want borders in all the slider, and how do i remove the gaps?
transparency is working now..
but still blinking, and they gets disappear mainly when i m clicking on the slider and sliding it.
here is what i am doing now:

 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here's one way to fix it, unless 'panelSlider' is going to be a move-able panel

note the indicated line in paintComponent, if 'imageicon' is null, the program will crash,
so do not have it like this, the fix is easy, think about it

 
Darryl Burke
Bartender
Posts: 5116
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resources shouldn't be loaded in a painting method override.

Additionally, since the ImageIcon constructor loads its image asynchronously via Toolkit, that code is open to the possibility that the image might not be fully loaded when it is to be painted.
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you mean i have to create one method that returns imageicon, i did like this but not working:

 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the Swing FAQ, forum main page,
for an example of how it should be done.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic