KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > SOptionPane


1 /*
2  * $Id: SOptionPane.java,v 1.12 2005/05/26 13:18:08 neurolabs Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings;
15
16 import org.apache.commons.logging.Log;
17 import org.apache.commons.logging.LogFactory;
18 import org.wings.border.SBorder;
19 import org.wings.border.SEmptyBorder;
20 import org.wings.plaf.OptionPaneCG;
21 import org.wings.session.SessionManager;
22
23 import javax.swing.*;
24 import java.awt.*;
25 import java.awt.event.ActionEvent JavaDoc;
26 import java.awt.event.ActionListener JavaDoc;
27 import java.util.StringTokenizer JavaDoc;
28
29 /**
30  * @author <a HREF="mailto:haaf@mercatis.de">Armin Haaf</a>
31  * @version $Revision: 1.12 $
32  */

33 public class SOptionPane
34         extends SDialog
35         implements ActionListener JavaDoc {
36     private final transient static Log log = LogFactory.getLog(SOptionPane.class);
37
38     /**
39      * Actionb Performed Value if Yes is Choosen
40      */

41     public static final String JavaDoc YES_ACTION = "YES";
42
43     /**
44      * Action Performed Value if No is choosen
45      */

46     public static final String JavaDoc NO_ACTION = "NO";
47
48     /**
49      * Action Performed Value if Ok is choosen
50      */

51     public static final String JavaDoc OK_ACTION = "OK";
52
53     /**
54      * Action Performed Value if Cancel is choosen
55      */

56     public static final String JavaDoc CANCEL_ACTION = "CANCEL";
57
58     /**
59      * Action Performed Value Unknow
60      */

61     public static final String JavaDoc UNKNOWN_ACTION = "UNKNOWN";
62
63     /**
64      * Return value if Ok is choosen
65      */

66     public static final int OK_OPTION = JOptionPane.OK_OPTION;
67
68     /**
69      * Return value if Cancel is choosen
70      */

71     public static final int CANCEL_OPTION = JOptionPane.CANCEL_OPTION;
72
73     /**
74      * Return Value if Yes is choosen
75      */

76     public static final int YES_OPTION = JOptionPane.YES_OPTION;
77
78     /**
79      * Return value if no is choosen
80      */

81     public static final int NO_OPTION = JOptionPane.NO_OPTION;
82
83     public static final int RESET_OPTION = 999;
84
85     /**
86      * Type meaning look and feel should not supply any options -- only
87      * use the options from the JOptionPane.
88      */

89     public static final int DEFAULT_OPTION = JOptionPane.DEFAULT_OPTION;
90
91     /**
92      * Used for showConfirmDialog.
93      */

94     public static final int OK_CANCEL_OPTION = JOptionPane.OK_CANCEL_OPTION;
95
96     /**
97      * Used for showConfirmDialog.
98      */

99     public static final int OK_CANCEL_RESET_OPTION = OK_CANCEL_OPTION + 1000;
100
101     /**
102      * Used for showConfirmDialog.
103      */

104     public static final int YES_NO_OPTION = JOptionPane.YES_NO_OPTION;
105
106     /**
107      * Used for showConfirmDialog.
108      */

109     public static final int YES_NO_RESET_OPTION = YES_NO_OPTION + 1000;
110
111     /**
112      * Used for showConfirmDialog.
113      */

114     public static final int YES_NO_CANCEL_OPTION = JOptionPane.YES_NO_CANCEL_OPTION;
115
116     /**
117      * Used for showConfirmDialog.
118      */

119     public static final int YES_NO_CANCEL_RESET_OPTION = YES_NO_CANCEL_OPTION + 1000;
120
121     //
122
// Message types. Used UI to determine the kind of icon to display,
123
// and possibly what behavior to give based on the type.
124
//
125
/*
126      * Error messages.
127      */

128     public static final int ERROR_MESSAGE = javax.swing.JOptionPane.ERROR_MESSAGE;
129     /*
130      * Information messages.
131      */

132     public static final int INFORMATION_MESSAGE = javax.swing.JOptionPane.INFORMATION_MESSAGE;
133     /*
134      * Warning messages.
135      */

136     public static final int WARNING_MESSAGE = javax.swing.JOptionPane.WARNING_MESSAGE;
137     /*
138      * Questions.
139      */

140     public static final int QUESTION_MESSAGE = javax.swing.JOptionPane.QUESTION_MESSAGE;
141     /*
142      * No icon.
143      */

144     public static final int PLAIN_MESSAGE = javax.swing.JOptionPane.PLAIN_MESSAGE;
145
146     /**
147      * ContentPane with border layout.
148      */

149     private final SContainer contents = new SPanel(new SBorderLayout());
150
151     /**
152      * Die Message des OptionPanes wird hier rein getan.
153      */

154     private final SContainer optionData = new SPanel(new SFlowDownLayout());
155
156     /**
157      * Die Message des OptionPanes wird hier rein getan.
158      */

159     private final SContainer images = new SPanel();
160
161     /**
162      * Panel with Option Buttons
163      */

164     protected final SContainer optionButtons = new SPanel(new SFlowLayout(SConstants.RIGHT));
165
166     /**
167      * OK Button
168      */

169     protected final SButton optionOK = createButton("OK");
170
171     /**
172      * Cancel Button
173      */

174     protected final SButton optionCancel = createButton("Cancel");
175
176     /**
177      * Yes Button
178      */

179     protected final SButton optionYes = createButton("Yes");
180
181     /**
182      * No Button
183      */

184     protected final SButton optionNo = createButton("No");
185
186     final SBorder empty = new SEmptyBorder(new Insets(6, 24, 6, 24));
187
188     /**
189      * Icon for Inform Dialog
190      */

191     private static final SIcon messageImage = (SIcon) SessionManager.getSession()
192     .getCGManager().getObject("SOptionPane.messageIcon", SIcon.class);
193
194     /**
195      * Icon for Input Dialog
196      */

197     private static final SIcon questionImage = (SIcon) SessionManager.getSession()
198     .getCGManager().getObject("SOptionPane.questionIcon", SIcon.class);
199
200     /**
201      * Icon for Show Confirm Dialog
202      */

203     private static final SIcon yesnoImage = (SIcon) SessionManager.getSession()
204     .getCGManager().getObject("SOptionPane.yesnoIcon", SIcon.class);
205
206     /**
207      * Icon for Error Dialog
208      */

209     private static final SIcon errorImage = (SIcon) SessionManager.getSession()
210     .getCGManager().getObject("SOptionPane.errorIcon", SIcon.class);
211
212     // protected final SLabel messageLabel = new SLabel(messageImage);
213
// protected final SLabel questionLabel = new SLabel(questionImage);
214
// protected final SLabel yesnoLabel = new SLabel(yesnoImage);
215
protected final SLabel imageLabel = new SLabel();
216
217     /**
218      * The chosen option
219      *
220      * @see #OK_OPTION
221      * @see #YES_OPTION
222      * @see #CANCEL_OPTION
223      * @see #NO_OPTION
224      */

225     protected Object JavaDoc selected = null;
226
227     /*
228      * Icon used in pane.
229      */

230     protected SIcon icon;
231
232     /*
233      * Message to display.
234      */

235     protected Object JavaDoc message;
236
237     /*
238      * Options to display to the user.
239      */

240     protected Object JavaDoc[] options;
241
242     /*
243      * Value that should be initialy selected in options.
244      */

245     protected Object JavaDoc initialValue;
246
247     /*
248      * Message type.
249      */

250     protected int messageType;
251     private Object JavaDoc inputValue;
252
253     /**
254      * Default Constructor for <code>SOptionPane</code>
255      * Against the Standard Swing Implementation there is no Standard Message
256      */

257     public SOptionPane() {
258         this(null);
259     }
260
261     /*
262      * Creates a instance of <code>SOptionPane</code> with a message
263      *
264      * @param message the <code>Object</code> to display
265      */

266     public SOptionPane(Object JavaDoc message) {
267         this(message, PLAIN_MESSAGE);
268     }
269
270     /*
271      * Creates an instance of <code>SOptionPane</code> to display a message
272      * with the specified message and the default options,
273      *
274      * @param message the <code>Object</code> to display
275      * @param messageType the type of message to be displayed:
276      * ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE,
277      * QUESTION_MESSAGE, or PLAIN_MESSAGE
278      */

279     public SOptionPane(Object JavaDoc message, int messageType) {
280         this(message, messageType, DEFAULT_OPTION);
281     }
282
283     /**
284      * Creates an instance of <code>JOptionPane</code> to display a message
285      * with the specified message type and options.
286      *
287      * @param message the <code>Object</code> to display
288      * @param messageType the type of message to be displayed:
289      * ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE,
290      * QUESTION_MESSAGE, or PLAIN_MESSAGE
291      * @param optionType the options to display in the pane:
292      * DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION
293      * OK_CANCEL_OPTION
294      */

295     public SOptionPane(Object JavaDoc message, int messageType, int optionType) {
296         this(message, messageType, optionType, null);
297     }
298
299     /**
300      * Creates an instance of <code>JOptionPane</code> to display a message
301      * with the specified message type, options, and icon.
302      *
303      * @param message the <code>Object</code> to display
304      * @param messageType the type of message to be displayed:
305      * ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE,
306      * QUESTION_MESSAGE, or PLAIN_MESSAGE
307      * @param optionType the options to display in the pane:
308      * DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION
309      * OK_CANCEL_OPTION
310      * @param icon the <code>Icon</code> image to display
311      */

312     public SOptionPane(Object JavaDoc message, int messageType, int optionType, SIcon icon) {
313         this(message, messageType, optionType, icon, null);
314     }
315
316     /**
317      * Creates an instance of JOptionPane to display a message
318      * with the specified message type, icon, and options.
319      * None of the options is initially selected.
320      * <p/>
321      * The options objects should contain either instances of
322      * <code>Component</code>s, (which are added directly) or
323      * <code>Strings</code> (which are wrapped in a <code>JButton</code>).
324      * If you provide <code>Component</code>s, you must ensure that when the
325      * <code>Component</code> is clicked it messages <code>setValue</code>
326      * in the created <code>JOptionPane</code>.
327      *
328      * @param message the <code>Object</code> to display
329      * @param messageType the type of message to be displayed:
330      * ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE,
331      * QUESTION_MESSAGE, or PLAIN_MESSAGE
332      * @param optionType the options to display in the pane:
333      * DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION
334      * OK_CANCEL_OPTION; only meaningful if the
335      * <code>options</code> parameter is <code>null</code>
336      * @param icon the <code>Icon</code> image to display
337      * @param options the choices the user can select
338      */

339     public SOptionPane(Object JavaDoc message, int messageType, int optionType,
340                        SIcon icon, Object JavaDoc[] options) {
341         this(message, messageType, optionType, icon, options, null);
342     }
343
344     /**
345      * Creates an instance of <code>JOptionPane</code> to display a message
346      * with the specified message type, icon, and options, with the
347      * initially-selected option specified.
348      *
349      * @param message the <code>Object</code> to display
350      * @param messageType the type of message to be displayed:
351      * ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE,
352      * QUESTION_MESSAGE, or PLAIN_MESSAGE
353      * @param optionType the options to display in the pane:
354      * DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION
355      * OK_CANCEL_OPTION; only meaningful if the
356      * <code>options</code> parameter is <code>null</code>
357      * @param icon the Icon image to display
358      * @param options the choices the user can select
359      * @param initialValue the choice that is initially selected
360      */

361     public SOptionPane(Object JavaDoc message, int messageType, int optionType,
362                        SIcon icon, Object JavaDoc[] options, Object JavaDoc initialValue) {
363         this.message = message;
364         this.options = options;
365         this.initialValue = initialValue;
366         this.icon = icon;
367         SGridLayout layout = new SGridLayout(1);
368         layout.setBorder(1);
369         setLayout(layout);
370         initPanel();
371         setOptionType(optionType);
372         setMessageType(messageType);
373         // value = UNINITIALIZED_VALUE;
374
// inputValue = UNINITIALIZED_VALUE;
375
}
376
377     /*
378      * The chosen option.
379      * @see #OK_OPTIONhttp://localhost:8080/RLSAdmin/Admin/mP1
380      * @see #YES_OPTION
381      * @see #CANCEL_OPTION
382      * @see #NO_OPTION
383      */

384     public final Object JavaDoc getValue() {
385         return selected;
386     }
387
388     public Object JavaDoc getInputValue() {
389         return inputValue;
390     }
391
392     private final void initPanel() {
393         optionButtons.add(optionOK, "OK");
394         optionButtons.add(optionYes, "YES");
395         optionButtons.add(optionCancel, "CANCEL");
396         optionButtons.add(optionNo, "NO");
397
398         /* images.add(messageLabel);
399               messageLabel.setToolTipText("info");
400               images.add(questionLabel);
401               questionLabel.setToolTipText("question");
402               images.add(yesnoLabel);
403               yesnoLabel.setToolTipText("question");
404         */

405         images.add(imageLabel);
406         imageLabel.setToolTipText(null);
407
408         optionData.setBorder(empty);
409         contents.add(optionData, SBorderLayout.CENTER);
410         contents.add(images, SBorderLayout.WEST);
411         add(contents);
412
413         add(optionButtons);
414     }
415
416     /**
417      * Generic Button creation
418      *
419      * @param label the <code>String</code> to display on the button
420      */

421     protected final SButton createButton(String JavaDoc label) {
422         SButton b = new SButton(label);
423         b.setName(getName() + label);
424         b.addActionListener(this);
425         return b;
426     }
427
428     public void actionPerformed(ActionEvent JavaDoc e) {
429         log.debug("action " + e);
430         hide();
431         selected = e.getSource();
432
433         if (e.getSource() == optionOK) {
434             fireActionPerformed(OK_ACTION);
435         } else if (e.getSource() == optionYes) {
436             fireActionPerformed(YES_ACTION);
437         } else if (e.getSource() == optionCancel) {
438             fireActionPerformed(CANCEL_ACTION);
439         } else if (e.getSource() == optionNo) {
440             fireActionPerformed(NO_ACTION);
441         } else {
442             fireActionPerformed(UNKNOWN_ACTION);
443         }
444     }
445
446     protected void resetOptions() {
447         optionOK.setVisible(false);
448         optionYes.setVisible(false);
449         optionCancel.setVisible(false);
450         optionNo.setVisible(false);
451
452         // messageLabel.setVisible(false);
453
// questionLabel.setVisible(false);
454
// yesnoLabel.setVisible(false);
455
imageLabel.setVisible(false);
456     }
457
458     SContainer customButtons = null;
459
460     public void setOptions(Object JavaDoc[] options) {
461         resetOptions();
462
463         if (customButtons == null)
464             customButtons = new SPanel();
465
466         for (int i = 0; i < options.length; i++) {
467             if (options[i] instanceof SComponent) {
468                 if (options[i] instanceof SAbstractButton)
469                     ((SAbstractButton) options[i]).addActionListener(this);
470                 customButtons.add((SComponent) options[i]);
471             } else {
472                 SButton b = new SButton(options[i].toString());
473                 b.addActionListener(this);
474                 customButtons.add(b);
475             }
476         }
477
478         add(customButtons);
479     }
480
481     /**
482      * Sets the option pane's message type.
483      * Dependent to the MessageType there wil be displayed a different Message Label
484      *
485      * @param newType an integer specifying the kind of message to display:
486      * ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE,
487      * QUESTION_MESSAGE, or PLAIN_MESSAGE
488      * <p/>
489      * description: The option pane's message type.
490      */

491     public void setMessageType(int newType) {
492         switch (newType) {
493             case ERROR_MESSAGE:
494                 {
495                     imageLabel.setIcon(errorImage);
496                     imageLabel.setToolTipText("Error");
497                     break;
498                 }
499             case INFORMATION_MESSAGE:
500                 {
501                     //informationLabel.setVisible(true);
502
imageLabel.setIcon(messageImage);
503                     imageLabel.setToolTipText("Information");
504                     break;
505                 }
506             case WARNING_MESSAGE:
507                 {
508                     imageLabel.setIcon(yesnoImage);
509                     imageLabel.setToolTipText("Warning");
510                     //warningLabel.setVisble(true);
511
break;
512                 }
513             case QUESTION_MESSAGE:
514                 {
515                     //questionLabel.setVisible(true);
516
imageLabel.setIcon(questionImage);
517                     imageLabel.setToolTipText("Question");
518                     break;
519                 }
520             case PLAIN_MESSAGE:
521             default:
522                 {
523                     imageLabel.setIcon(null);
524                     imageLabel.setToolTipText(null);
525                     //questionLabel.setIcon(null);
526
}
527         }
528
529         messageType = newType;
530     }
531
532     /**
533      * Returns the message type.
534      *
535      * @return an integer specifying the message type
536      * @see #setMessageType
537      */

538     public int getMessageType() {
539         return messageType;
540     }
541
542     public void setOptionType(int newType) {
543         resetOptions();
544
545         switch (newType) {
546             case DEFAULT_OPTION:
547                 optionOK.setVisible(true);
548                 break;
549
550             case OK_CANCEL_OPTION:
551                 optionOK.setVisible(true);
552                 optionCancel.setVisible(true);
553                 break;
554
555             case OK_CANCEL_RESET_OPTION:
556                 optionOK.setVisible(true);
557                 optionCancel.setVisible(true);
558                 break;
559
560             case YES_NO_OPTION:
561                 optionYes.setVisible(true);
562                 optionNo.setVisible(true);
563                 break;
564
565             case YES_NO_RESET_OPTION:
566                 optionYes.setVisible(true);
567                 optionNo.setVisible(true);
568                 break;
569
570             case YES_NO_CANCEL_OPTION:
571                 optionYes.setVisible(true);
572                 optionNo.setVisible(true);
573                 optionCancel.setVisible(true);
574                 break;
575
576             case YES_NO_CANCEL_RESET_OPTION:
577                 optionYes.setVisible(true);
578                 optionNo.setVisible(true);
579                 optionCancel.setVisible(true);
580                 break;
581         }
582     }
583
584     public void showOption(SComponent c, String JavaDoc title, Object JavaDoc message) {
585         if (title != null)
586             setTitle(title);
587
588         optionData.removeAll();
589         if (message instanceof SComponent) {
590             optionData.add((SComponent) message);
591         } else {
592             StringTokenizer JavaDoc stt = new StringTokenizer JavaDoc(message.toString(), "\n");
593             while (stt.hasMoreElements()) {
594                 optionData.add(new SLabel(stt.nextElement().toString()));
595             }
596         }
597         show(c);
598     }
599
600     public static void showMessageDialog(SComponent parent, Object JavaDoc message,
601                                          ActionListener JavaDoc al) {
602         showMessageDialog(parent, message, null, 0, al);
603     }
604
605     public static void showMessageDialog(SComponent parent, Object JavaDoc message) {
606         showMessageDialog(parent, message, null, 0, null);
607     }
608
609     public static void showMessageDialog(SComponent parent, Object JavaDoc message, String JavaDoc title) {
610         showMessageDialog(parent, message, title, 0, null);
611     }
612
613     public static void showMessageDialog(SComponent parent, Object JavaDoc message,
614                                          String JavaDoc title, int messageType, ActionListener JavaDoc al) {
615         SOptionPane p = new SOptionPane();
616
617         p.showPlainMessage(parent, message, title);
618         p.addActionListener(al);
619     }
620
621     public static void showPlainMessageDialog(SComponent parent, Object JavaDoc message,
622                                               String JavaDoc title) {
623         showPlainMessageDialog(parent, message, title, 0, null);
624     }
625
626
627     public static void showPlainMessageDialog(SComponent parent, Object JavaDoc message,
628                                               String JavaDoc title, int messageType,
629                                               ActionListener JavaDoc al) {
630         SOptionPane p = new SOptionPane();
631
632         p.showPlainMessage(parent, message, title);
633         p.addActionListener(al);
634         p.setMessageType(PLAIN_MESSAGE);
635         // p.messageLabel.setVisible(false);
636
}
637
638     public void showPlainMessage(SComponent parent, Object JavaDoc message, String JavaDoc title) {
639         showOption(parent, title, message);
640
641         setOptionType(DEFAULT_OPTION);
642         setMessageType(PLAIN_MESSAGE);
643         // messageLabel.setVisible(true);
644
}
645
646     public void showQuestion(SComponent parent, Object JavaDoc message, String JavaDoc title) {
647         showOption(parent, title, message);
648
649         setOptionType(OK_CANCEL_OPTION);
650         setMessageType(QUESTION_MESSAGE);
651         // questionLabel.setVisible(true);
652
}
653
654     public void showInput(SComponent parent, Object JavaDoc message,
655                           SComponent inputElement, String JavaDoc title) {
656         showOption(parent, title, message);
657         optionData.add(inputElement);
658         inputValue = inputElement;
659
660         setOptionType(OK_CANCEL_OPTION);
661         setMessageType(QUESTION_MESSAGE);
662         // questionLabel.setVisible(true);
663
}
664
665     // protected String getSimpleInput(Object message) {
666
// return JOptionPane.showInputDialog(this, message);
667
// }
668

669
670     public static void showInputDialog(SComponent parent, Object JavaDoc question,
671                                        String JavaDoc title, SComponent inputElement,
672                                        ActionListener JavaDoc al) {
673         SOptionPane p = new SOptionPane();
674
675         p.showInput(parent, question, inputElement, title);
676         p.addActionListener(al);
677     }
678
679     public static void showQuestionDialog(SComponent parent, Object JavaDoc question,
680                                           String JavaDoc title, ActionListener JavaDoc al) {
681         SOptionPane p = new SOptionPane();
682
683         p.showQuestion(parent, question, title);
684         p.addActionListener(al);
685     }
686
687     public static void showPlainQuestionDialog(SComponent parent, Object JavaDoc question,
688                                                String JavaDoc title, ActionListener JavaDoc al) {
689         SOptionPane p = new SOptionPane();
690
691         p.showQuestion(parent, question, title);
692         p.addActionListener(al);
693         p.setMessageType(PLAIN_MESSAGE);
694         // p.questionLabel.setVisible(false);
695
}
696
697
698     public static void showConfirmDialog(SComponent parent, Object JavaDoc message,
699                                          String JavaDoc title) {
700         showConfirmDialog(parent, message, title, 0, null);
701     }
702
703     public static void showConfirmDialog(SComponent parent, Object JavaDoc message,
704                                          String JavaDoc title, ActionListener JavaDoc al) {
705         showConfirmDialog(parent, message, title, 0, al);
706     }
707
708     public static void showConfirmDialog(SComponent parent, Object JavaDoc message,
709                                          String JavaDoc title, int type) {
710         showConfirmDialog(parent, message, title, type, null);
711     }
712
713     public static void showConfirmDialog(SComponent parent, Object JavaDoc message,
714                                          String JavaDoc title, int type, ActionListener JavaDoc al) {
715         showConfirmDialog(parent, message, title, type, al, null);
716     }
717
718     public static void showConfirmDialog(SComponent parent, Object JavaDoc message,
719                                          String JavaDoc title, int type, ActionListener JavaDoc al,
720                                          SLayoutManager layout) {
721         SOptionPane p = new SOptionPane();
722         if (layout != null) {
723             p.optionButtons.setLayout(layout);
724         } // end of if ()
725

726         p.addActionListener(al);
727         p.showQuestion(parent, message, title, type);
728     }
729
730     public void showYesNo(SComponent parent, Object JavaDoc question, String JavaDoc title) {
731         showOption(parent, title, question);
732         setOptionType(YES_NO_OPTION);
733         setMessageType(INFORMATION_MESSAGE);
734         // yesnoLabel.setVisible(true);
735
}
736
737     public void showQuestion(SComponent parent, Object JavaDoc question, String JavaDoc title, int type) {
738         showOption(parent, title, question);
739         setOptionType(type);
740         setMessageType(QUESTION_MESSAGE);
741     }
742
743     public static void showYesNoDialog(SComponent parent, Object JavaDoc question,
744                                        String JavaDoc title, ActionListener JavaDoc al) {
745         SOptionPane p = new SOptionPane();
746         p.addActionListener(al);
747
748         p.showYesNo(parent, question, title);
749     }
750
751     public void setCG(OptionPaneCG cg) {
752         super.setCG(cg);
753     }
754 }
755
Popular Tags