问题
I have a JPanel and I want it so that whenever a user clicks on it, a sliding window appears just below the panel and giving more information to what is already in the JPanel. How can I do this?
回答1:
To put something on something, you can use a JLayeredPane or the zorder thing.
回答2:
Try this http://java-sl.com/tip_slider.html
回答3:
The requirements of your question are terrible so we can't give much detail.
If you want to to animation then use a Swing Timer. Each time the timer fires you change the height of the component to make it look likes its sliding.
回答4:
Perhaps add a mouselistener to the jpanel, then upon mousepressed add an inner panel, or pull up a different card, or do whatever it is that works for your particular swing layout.
来源:https://stackoverflow.com/questions/4218117/sliding-window-under-a-jpanel