public YesNoDialog(Frame parent, String title, String message, String yes_label, String no_label, String cancel_label)
// Create the window.
super(parent, title, true);
// Specify a LayoutManager for it
this.setLayout(new BorderLayout(15, 15));
// Put the message label in the middle of the window.
label = new MultiLineLabel(message, 20, 20);
this.add("Center", label);
// Create a panel of buttons, center the row of buttons in
// the panel, and put the pane at the bottom of the window.
Panel p = new Panel();
p.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 15));
if (yes_label != null) p.add(yes = new Button(yes_label));
if (no_label != null) p.add(no = new Button(no_label));
if (cancel_label != null) p.add(cancel = new Button(cancel_label));
this.add("South", p);
// Set the window to its preferred size.
this.pack();
|