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:

enter image description here


of course you'd need handle resize , move events of original shell keep in place.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -