Open a custom dialog

Documents for the development of and with JVx.

Open a custom dialog

Postby Development@SIB » Wed Oct 02, 2013 12:38 pm

Sometimes you want to show dialogues instead of work-screens because a dialog is a simple popup that shows details about a selected record or requests input from the user. Another reason could be, that a work-screen shows different dialogues on button clicks.

It's very easy to show a dialog in your application or work-screen. Use the Dialog class and use it as follows:

Syntax: [ Download ] [ Hide ]
//dialog content
UIFormLayout folContent = new UIFormLayout();
               
UIPanel panContent = new UIPanel(folContent);
panContent.add(new UILabel("Name"));
panContent.add(new UITextField(), folContent.getConstraints(1, 0, -1, 0));
panContent.add(new UILabel("Value"));
panContent.add(new UITextField(), folContent.getConstraints(1, 1, -1, 1));

//dialog with Ok button
Dialog dlg = new Dialog(panContent);
//show dialog as frame
Dialog.openInternalFrame(this, "Dialog test", true, dlg);

The Dialog itself is a Content and can be used without internal frames as well. It depends on your IApplication implementation if you use an internal frame or the content itself.

The class supports OK, Cancel buttons and allows user-defined buttons instead of default buttons.

The title is an optional attribute. If you don't set the title, the name of the dialog will be used. The dialog itself has a default preferred size. You should change the default setting if you need a different size.

Above dialog looks like this:

dialog.png
dialog.png (3.88 KiB) Viewed 5426 times

With Ok and Cancel:

dialog_ok_cancel.png
dialog_ok_cancel.png (4.27 KiB) Viewed 5426 times
User avatar
Development@SIB
 
Posts: 311
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation