It's not a secret anymore!
The moose likes Swing / AWT / SWT and the fly likes A sort of drop down-menu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "A sort of drop down-menu" Watch "A sort of drop down-menu" New topic

A sort of drop down-menu

Gabriella Hakansson

Joined: Apr 19, 2010
Posts: 6
I have built some java-apps but i have never done it without my teatcher nearby. Til now. So i am going to build an app where you can click on some text and then get other text underneath. Like having simple FAQ's and the user can only see the questions and when he/she clicks on a question the answer slides down underneath. Somehow i should do this so it looks nice. I have no idea how to even start, so any help, tutoral or anything is helpful.

Also: I know how to make the visual background. I will use a JFrame. The thing that i cant do is the "click-on-text-and-other-text-appears-underneath". Should I use HTML? How do i do that ? Or is a simple JLable enough?

And i just have to add that i'm not in school, i am out of ideas to search on google and i don't know how to start.

Just trying to be a good programmer.
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1789

Welcome to JavaRanch!

I think this question may fare better in the GUI forum

I'll move it there.

When you do things right, people won't be sure you've done anything at all.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10825

JLabel supports HTML and has a convenient setText() method.
You can use a mouse listener to trap the user clicks, on which you can display the hidden text.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Gabriella Hakansson

Joined: Apr 19, 2010
Posts: 6
Thank you Is there any way you can do it nicely so the answer don't just pops out but slides down?
I agree. Here's the link:
subject: A sort of drop down-menu
It's not a secret anymore!