Exemplo n.º 1
0
 /**
  * @param parent parent component
  * @param properties properties that will get displayed
  * @param buttonOptions button options. They will be displayed in a row on the bottom
  * @return pressed button
  */
 public static Object getButton(
     final JComponent parent,
     final String title,
     final List<IEditableProperty> properties,
     final Object... buttonOptions) {
   if (!SwingUtilities.isEventDispatchThread()) {
     // throw new IllegalStateException("Must run from EventDispatchThread");
     final AtomicReference<Object> rVal = new AtomicReference<>();
     SwingAction.invokeAndWait(
         () -> rVal.set(showDialog(parent, title, properties, buttonOptions)));
     return rVal.get();
   } else {
     return showDialog(parent, title, properties, buttonOptions);
   }
 }
Exemplo n.º 2
0
 /**
  * Blocks until all Swing event thread actions have completed.
  *
  * <p>Task is accomplished by adding a do-nothing event with SwingUtilities to the event thread
  * and then blocking until the do-nothing event is done.
  */
 public static void waitForSwingThreads() {
   // add a no-op action to the end of the swing event queue, and then wait for it
   SwingAction.invokeAndWait(() -> {});
 }