简体   繁体   中英

Need help creating a drop down button with Java

I am fairly new to programming in Java. Currently I am trying to create a button that when clicked will produce a drop down. For example, you have a user input field that does a google type rolling search and separate from that is a button that when clicked will display a window to the right of it that brings up all available options.

Here is my button:

<input id = "mainContainer" type = "button" value = " + ";>

Is there a way to create a drop down menu after clicking the button with html or css? Or does this need to be in javascript?

It does not seem that difficult theoretically but I do not know much about java so I don't really have to much of a starting point. I would believe that I would just need an onClick() event that will create a new menu. I just don't know how to write this out in java. I Also need to complete this project in the next 2 weeks so any help will be greatly appreciated.

If you could provide code with an explanation of how it works I would be probably the happiest dude in the world. Any reference would be appreciated.

您可以使用javascript编写自己的代码,也可以使用一些UI组件,例如: jQuery AutoComplete

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM