Swing - Drop down Panel

≯℡__Kan透↙ 提交于 2019-12-12 06:37:27

问题


I am working on Java Swing, making an UI. I have a Panel (Panel 1) with information, and I want to create a dropdown menu, but not like de comboBox. Is hard to explain.

I see the panel, and in the bottom, I have a button. When I press this button, I want to make appear another panel (transparent) on Panel 1.

I dont know how can I do that.I wait for yoir help, if I have explained it well.

I dont want the typical dropdown list, is like a dropdown panel.

EDIT: for example, in the main page of google, when you hit a button above, appears a new menu, but not a list. I see that is not a good example, i am searching another better example for it.

EDIT 2: I need that the thing that appear when I press the button will be a Panel, because I need to add some JOGL on it.


回答1:


You can use PopupFactory for this .

PopupFactory factory = PopupFactory.getSharedInstance();
Popup popup = factory.getPopup(myButton, myPanel, x, y);
popup.show();

x and y are screen coordinates.



来源:https://stackoverflow.com/questions/34855469/swing-drop-down-panel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!