java - calling a swing from a menu item not working -
i'm having menu item
displayed part of windows icon
item = new menuitem("update options"); item.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { login("update"); } }); popup.add(item); trayicon.setpopupmenu(popup);
if click
on menu item
, supposed call login method below , show me jframe panel added
public void login(string operation){ final jframe frame=new jframe(); jpanel panel = new jpanel(); jbutton blogin = new jbutton("start"); blogin.setbounds(110,150,80,20); panel.add(blogin); panel.setsize(300,220); panel.setlocation(500,280); panel.setlayout (null); frame.setsize(300,220); frame.setlocation(500,280); frame.setlayout(new borderlayout()); frame.add(panel, borderlayout.center); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setvisible(true); blogin.addactionlistener(new actionlistener() { public void actionperformed(actionevent ae) { system.out.println("entering action"); flag=false; frame.dispose(); }}); while(flag) { //system.out.println("waiting flag"); } }
this not working , showing frame , no panel or button inside.but, if call same login method main method, populating contents.
please me solve this.
Comments
Post a Comment