/[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 116 by alfonx, Wed May 13 17:37:11 2009 UTC revision 122 by alfonx, Tue May 19 17:16:13 2009 UTC
# Line 13  import java.util.Locale; Line 13  import java.util.Locale;
13    
14  import javax.swing.AbstractAction;  import javax.swing.AbstractAction;
15  import javax.swing.Action;  import javax.swing.Action;
16    import javax.swing.BorderFactory;
17  import javax.swing.Box;  import javax.swing.Box;
18    import javax.swing.JButton;
19  import javax.swing.JComponent;  import javax.swing.JComponent;
20  import javax.swing.JDialog;  import javax.swing.JDialog;
21  import javax.swing.JOptionPane;  import javax.swing.JOptionPane;
# Line 49  public class TranslationAskJDialog exten Line 51  public class TranslationAskJDialog exten
51    
52          private boolean hasBeenCanceled;          private boolean hasBeenCanceled;
53    
54            private JButton[] optionalButtons;
55    
56          /**          /**
57           * Since the registerKeyboardAction() method is part of the JComponent class           * Since the registerKeyboardAction() method is part of the JComponent class
58           * definition, you must define the Escape keystroke and register the           * definition, you must define the Escape keystroke and register the
# Line 152  public class TranslationAskJDialog exten Line 156  public class TranslationAskJDialog exten
156                  SwingUtil.centerFrameOnScreen(this);                  SwingUtil.centerFrameOnScreen(this);
157                  Box box = Box.createVerticalBox();                  Box box = Box.createVerticalBox();
158                  for (JComponent panel : translationEditJPanelsOrJustComponents) {                  for (JComponent panel : translationEditJPanelsOrJustComponents) {
159                            panel.setAlignmentX(java.awt.Component.LEFT_ALIGNMENT);
160                            panel.setBorder( BorderFactory.createEmptyBorder(5, 6, 5, 6));
161                          box.add(panel);                          box.add(panel);
162                            
163                  }                  }
164                  JPanel cp = new JPanel(new BorderLayout());                  JPanel cp = new JPanel(new BorderLayout());
165                  cp.add(box, BorderLayout.CENTER);                  cp.add(box, BorderLayout.WEST);
166                  cp.add(getButtons(), BorderLayout.SOUTH);                  cp.add(getButtons(), BorderLayout.SOUTH);
167                  setContentPane(cp);                  setContentPane(cp);
168                    
169                  setTitle(RESOURCE.getString("translation_dialog_title")); // i8n                  setTitle(RESOURCE.getString("translation_dialog_title")); // i8n
170                  setModal(true);                  setModal(true);
171                  pack();                  pack();
172          }          }
173    
174            public void setButtons(JButton... optionalButtons) {
175                    this.optionalButtons = optionalButtons;
176                    init();
177            }
178    
179          protected void cancel() {          protected void cancel() {
180                  firePropertyChange(PROPERTY_CANCEL_AND_CLOSE, null, null);                  firePropertyChange(PROPERTY_CANCEL_AND_CLOSE, null, null);
181                  restore();                  restore();
# Line 183  public class TranslationAskJDialog exten Line 195  public class TranslationAskJDialog exten
195    
196          private JComponent getButtons() {          private JComponent getButtons() {
197                  JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));                  JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
198    
199                    if (optionalButtons != null)
200                            for (JButton b : optionalButtons) {
201                                    jPanel.add(b);
202                            }
203    
204                  if (okButton == null) {                  if (okButton == null) {
205                          okButton = new OkButton(new AbstractAction() {                          okButton = new OkButton(new AbstractAction() {
206                                  {                                  {

Legend:
Removed from v.116  
changed lines
  Added in v.122

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26