Changeset 1288 in josm
- Timestamp:
- 2009-01-17T23:32:45+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r1237 r1288 55 55 if (e != null && !(e.getSource() instanceof AbstractButton)) 56 56 button.setSelected(!button.isSelected()); 57 setVisible(button.isSelected()); 58 Main.pref.put(prefname+".visible", button.isSelected()); 57 Boolean selected = button.isSelected(); 58 setVisible(selected); 59 Main.pref.put(prefname+".visible", selected); 60 if(!selected && winadapter != null) 61 winadapter.windowClosing(null); 59 62 } 60 63 } … … 67 70 68 71 public JPanel parent; 72 WindowAdapter winadapter; 69 73 private final JPanel titleBar = new JPanel(new GridBagLayout()); 70 74 public JLabel label = new JLabel(); … … 120 124 minimize.setIcon(ImageProvider.get("misc", "minimized")); 121 125 } 122 // doLayout() - workaround 123 parent.setVisible(false); 124 parent.setVisible(true); 126 if(parent != null) 127 { 128 // doLayout() - workaround 129 parent.setVisible(false); 130 parent.setVisible(true); 131 } 125 132 } 126 133 }; … … 134 141 public void mouseExited(MouseEvent e) {} 135 142 public void mousePressed(MouseEvent e) {} 136 public void mouseReleased(MouseEvent e) {}143 public void mouseReleased(MouseEvent e) {} 137 144 }; 138 145 titleBar.addMouseListener(titleMouseListener); … … 157 164 parent.remove(ToggleDialog.this); 158 165 f.getContentPane().add(ToggleDialog.this); 159 f.addWindowListener( new WindowAdapter(){166 f.addWindowListener((winadapter = new WindowAdapter(){ 160 167 @Override public void windowClosing(WindowEvent e) { 161 titleBar.setVisible(true);162 168 f.getContentPane().removeAll(); 163 parent.add(ToggleDialog.this);164 169 f.dispose(); 170 winadapter = null; 165 171 166 172 // doLayout() - workaround 167 173 setVisible(false); 168 setVisible(true); 169 174 parent.add(ToggleDialog.this); 175 if(Main.pref.getBoolean(action.prefname+".visible")) 176 setVisible(true); 177 titleBar.setVisible(true); 170 178 Main.pref.put(action.prefname+".docked", true); 171 179 } 172 }) ;180 })); 173 181 f.addComponentListener(new ComponentAdapter(){ 174 182 @Override public void componentMoved(ComponentEvent e) {
Note:
See TracChangeset
for help on using the changeset viewer.