/[schmitzm]/trunk/src/skrueger/swing/TranslationAskJDialog.java
ViewVC logotype

Diff of /trunk/src/skrueger/swing/TranslationAskJDialog.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 119 by alfonx, Wed May 13 17:37:11 2009 UTC revision 120 by alfonx, Sat May 16 21:25:44 2009 UTC
# Line 14  import java.util.Locale; Line 14  import java.util.Locale;
14  import javax.swing.AbstractAction;  import javax.swing.AbstractAction;
15  import javax.swing.Action;  import javax.swing.Action;
16  import javax.swing.Box;  import javax.swing.Box;
17    import javax.swing.JButton;
18  import javax.swing.JComponent;  import javax.swing.JComponent;
19  import javax.swing.JDialog;  import javax.swing.JDialog;
20  import javax.swing.JOptionPane;  import javax.swing.JOptionPane;
# Line 49  public class TranslationAskJDialog exten Line 50  public class TranslationAskJDialog exten
50    
51          private boolean hasBeenCanceled;          private boolean hasBeenCanceled;
52    
53            private JButton[] optionalButtons;
54    
55          /**          /**
56           * Since the registerKeyboardAction() method is part of the JComponent class           * Since the registerKeyboardAction() method is part of the JComponent class
57           * definition, you must define the Escape keystroke and register the           * definition, you must define the Escape keystroke and register the
# Line 164  public class TranslationAskJDialog exten Line 167  public class TranslationAskJDialog exten
167                  pack();                  pack();
168          }          }
169    
170            public void setButtons(JButton... optionalButtons) {
171                    this.optionalButtons = optionalButtons;
172                    init();
173            }
174    
175          protected void cancel() {          protected void cancel() {
176                  firePropertyChange(PROPERTY_CANCEL_AND_CLOSE, null, null);                  firePropertyChange(PROPERTY_CANCEL_AND_CLOSE, null, null);
177                  restore();                  restore();
# Line 183  public class TranslationAskJDialog exten Line 191  public class TranslationAskJDialog exten
191    
192          private JComponent getButtons() {          private JComponent getButtons() {
193                  JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));                  JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
194    
195                    if (optionalButtons != null)
196                            for (JButton b : optionalButtons) {
197                                    jPanel.add(b);
198                            }
199    
200                  if (okButton == null) {                  if (okButton == null) {
201                          okButton = new OkButton(new AbstractAction() {                          okButton = new OkButton(new AbstractAction() {
202                                  {                                  {

Legend:
Removed from v.119  
changed lines
  Added in v.120

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26