/[schmitzm]/branches/2.4.x/src/skrueger/swing/CancellableTabbedDialogAdapter.java
ViewVC logotype

Diff of /branches/2.4.x/src/skrueger/swing/CancellableTabbedDialogAdapter.java

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

branches/1.0-gt2-2.6/src/skrueger/swing/CancellableTabbedDialogAdapter.java revision 497 by alfonx, Fri Oct 23 18:43:58 2009 UTC trunk/src/skrueger/swing/CancellableTabbedDialogAdapter.java revision 1370 by alfonx, Mon Jan 17 15:18:04 2011 UTC
# Line 10  import javax.swing.JTabbedPane; Line 10  import javax.swing.JTabbedPane;
10    
11  import net.miginfocom.swing.MigLayout;  import net.miginfocom.swing.MigLayout;
12  import schmitzm.swing.JPanel;  import schmitzm.swing.JPanel;
 import schmitzm.swing.SwingUtil;  
13    
14  public abstract class CancellableTabbedDialogAdapter extends  public abstract class CancellableTabbedDialogAdapter extends
15                  CancellableDialogAdapter {                  CancellableDialogAdapter {
16    
17          private final JTabbedPane tabbedPane;          private final JTabbedPane tabbedPane;
18    
19          public CancellableTabbedDialogAdapter(Component owner) {          public CancellableTabbedDialogAdapter(Component owner, String title) {
20                  super(owner);                  super(owner, title);
21    
22                  /**                  /**
23                   * Prepare buttons                   * Prepare buttons
# Line 26  public abstract class CancellableTabbedD Line 25  public abstract class CancellableTabbedD
25                  final JPanel buttons = createButtons();                  final JPanel buttons = createButtons();
26    
27                  /*** Build GUI ***/                  /*** Build GUI ***/
28                  tabbedPane = new JTabbedPane(){                  tabbedPane = new JTabbedPane() {
29                          @Override                          @Override
30                          public void insertTab(String title, Icon icon, Component component,                          public void insertTab(String title, Icon icon, Component component,
31                                          String tip, int index) {                                          String tip, int index) {
# Line 46  public abstract class CancellableTabbedD Line 45  public abstract class CancellableTabbedD
45    
46          }          }
47    
48            public CancellableTabbedDialogAdapter(Component parentWindow) {
49                    this(parentWindow, null);
50            }
51    
52          /**          /**
53           * Is only called once! Doesn't use lazy initialization. Use           * Is only called once! Doesn't use lazy initialization. Use
54           * <code>super.createButtons.add( newButton )</code> to add buttons.           * <code>super.createButtons.add( newButton )</code> to add buttons.
# Line 67  public abstract class CancellableTabbedD Line 70  public abstract class CancellableTabbedD
70    
71                                  // Set tool tip text                                  // Set tool tip text
72                                  putValue(Action.SHORT_DESCRIPTION,                                  putValue(Action.SHORT_DESCRIPTION,
73                                                  "Accept the changes made in this dialog."); // i8n                                                  "Accept the changes made in this dialog."); // i8n i8n
74                                                                                                                                            // i8n
75                          }                          }
76    
77                          //                          //
# Line 78  public abstract class CancellableTabbedD Line 81  public abstract class CancellableTabbedD
81    
82                  });                  });
83    
84                  buttonsJPanel.add(okButton);                  buttonsJPanel.add(okButton, "tag ok");
85    
86                  final CancelButton cancelButton = new CancelButton(new AbstractAction(                  final CancelButton cancelButton = new CancelButton(new AbstractAction(
87                                  "") {                                  "") {
# Line 86  public abstract class CancellableTabbedD Line 89  public abstract class CancellableTabbedD
89                                  cancelClose();                                  cancelClose();
90                          }                          }
91                  });                  });
92                  buttonsJPanel.add(cancelButton);                  buttonsJPanel.add(cancelButton, "tag cancel");
93    
94                  return buttonsJPanel;                  return buttonsJPanel;
95          }          }
# Line 94  public abstract class CancellableTabbedD Line 97  public abstract class CancellableTabbedD
97          public JTabbedPane getTabbedPane() {          public JTabbedPane getTabbedPane() {
98                  return tabbedPane;                  return tabbedPane;
99          }          }
100            
101          /**          /**
102           * Calling cancel() will call cancel to all {@link Cancellable} children in the tabbedPane.           * Calling cancel() will call cancel to all {@link Cancellable} children in
103             * the tabbedPane.
104           */           */
105          @Override          @Override
106          public void cancel() {          public void cancel() {
# Line 110  public abstract class CancellableTabbedD Line 114  public abstract class CancellableTabbedD
114                  }                  }
115          }          }
116    
   
117          @Override          @Override
118          public boolean okClose() {          public boolean okClose() {
119                  // TranslationAskJDialog.this.firePropertyChange(                  // TranslationAskJDialog.this.firePropertyChange(

Legend:
Removed from v.497  
changed lines
  Added in v.1370

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26