Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes problem while creating sliding panel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "problem while creating sliding panel" Watch "problem while creating sliding panel" New topic
Author

problem while creating sliding panel

Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 928
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

Joined: Jun 09, 2003
Posts: 4632
> 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

Joined: Aug 20, 2011
Posts: 928
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

Joined: Jun 09, 2003
Posts: 4632
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

Joined: May 03, 2008
Posts: 4522
    
    5

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.


luck, db
There are no new questions, but there may be new answers.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 928
you mean i have to create one method that returns imageicon, i did like this but not working:

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
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
 
subject: problem while creating sliding panel
 
Similar Threads
Displaying an image in a set location in an applet
Advice on how to implement this GUI ?
Add image to JPanel
weird and unwanted duplicate component is being painted, moving a component(Simple animation)
Component's showing issues!