java - Creating a popup window on button click using JPanel from another JPanel -


i using netbeans create gui tool working on. tools contents contained in class extends jpanel , has button. when click button, want window pop have additional buttons , options, contents of defined in class extends jpanel. how can accomplish this?

simplified code of main class. removed code not important problem:

public class firstpanel extends jpanel {      private jbutton mybutton;      public firstpanel() {          mybutton = new jbutton("button");         mybutton.addactionlistener(new actionlistener() {              @override             public void actionperformed(actionevent ae) {                  //              }         });     } } 

and second class similar, , in charge of handling of buttons , such. how can accomplish this?

see how use menus: bringing popup menu correct way handle in cross-platform mouselistener. more simply, use setcomponentpopupmenu(), shown here. in either case, note use of action encapsulate desired functionality.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -