java - Show small window after button click -
i looking way display small window beside button
when clicked. using jface
dialog
not looking for, rather kind of window can positioned beside button
tool tip.
you can use second shell
, position next button
:
public static void main(string[] args) { final display display = new display(); shell shell = new shell(display); shell.setlayout(new gridlayout(1, false)); button button = new button(shell, swt.push); button.settext("button"); final shell popup = new shell(shell, swt.none); popup.setlayout(new filllayout()); text input = new text(popup, swt.border); button.addlistener(swt.selection, new listener() { @override public void handleevent(event event) { if(popup != null && !popup.isdisposed()) popup.close(); } }); shell.pack(); shell.open(); popup.pack(); popup.open(); popup.setlocation(button.todisplay(button.getbounds().width, 1)); while (!shell.isdisposed()) { if (!display.readanddispatch()) { display.sleep(); } } display.dispose(); }
looks this:
of course you'd need handle resize , move events of original shell keep in place.
Comments
Post a Comment