38 |
|
|
39 |
package javax.swing.plaf.basic; |
package javax.swing.plaf.basic; |
40 |
|
|
41 |
|
import java.awt.Color; |
42 |
import java.awt.Dimension; |
import java.awt.Dimension; |
43 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
44 |
import java.beans.PropertyVetoException; |
import java.beans.PropertyVetoException; |
50 |
import javax.swing.JDesktopPane; |
import javax.swing.JDesktopPane; |
51 |
import javax.swing.JInternalFrame; |
import javax.swing.JInternalFrame; |
52 |
import javax.swing.KeyStroke; |
import javax.swing.KeyStroke; |
|
import javax.swing.UIDefaults; |
|
53 |
import javax.swing.UIManager; |
import javax.swing.UIManager; |
54 |
import javax.swing.plaf.ComponentUI; |
import javax.swing.plaf.ComponentUI; |
55 |
import javax.swing.plaf.DesktopPaneUI; |
import javax.swing.plaf.DesktopPaneUI; |
56 |
|
import javax.swing.plaf.UIResource; |
57 |
|
|
58 |
/** |
/** |
59 |
* This class is the UI delegate for JDesktopPane for the Basic look and feel. |
* This class is the UI delegate for JDesktopPane for the Basic look and feel. |
75 |
{ |
{ |
76 |
if (desktop.getSelectedFrame() != null) |
if (desktop.getSelectedFrame() != null) |
77 |
{ |
{ |
78 |
try |
try |
79 |
{ |
{ |
80 |
desktop.getSelectedFrame().setClosed(true); |
desktop.getSelectedFrame().setClosed(true); |
81 |
} |
} |
82 |
catch (PropertyVetoException pve) |
catch (PropertyVetoException pve) |
83 |
{ |
{ |
84 |
} |
// We do nothing if the attempts has been vetoed. |
85 |
|
} |
86 |
} |
} |
87 |
} |
} |
88 |
|
|
114 |
{ |
{ |
115 |
if (desktop.getSelectedFrame() != null) |
if (desktop.getSelectedFrame() != null) |
116 |
{ |
{ |
117 |
try |
try |
118 |
{ |
{ |
119 |
desktop.getSelectedFrame().setMaximum(true); |
desktop.getSelectedFrame().setMaximum(true); |
120 |
} |
} |
121 |
catch (PropertyVetoException pve) |
catch (PropertyVetoException pve) |
122 |
{ |
{ |
123 |
} |
// We do nothing if the attempts has been vetoed. |
124 |
|
} |
125 |
} |
} |
126 |
} |
} |
127 |
|
|
153 |
{ |
{ |
154 |
if (desktop.getSelectedFrame() != null) |
if (desktop.getSelectedFrame() != null) |
155 |
{ |
{ |
156 |
try |
try |
157 |
{ |
{ |
158 |
desktop.getSelectedFrame().setIcon(true); |
desktop.getSelectedFrame().setIcon(true); |
159 |
} |
} |
160 |
catch (PropertyVetoException pve) |
catch (PropertyVetoException pve) |
161 |
{ |
{ |
162 |
} |
// We do nothing if the attempt has been vetoed. |
163 |
|
} |
164 |
} |
} |
165 |
} |
} |
166 |
|
|
240 |
JInternalFrame frame = desktop.getSelectedFrame(); |
JInternalFrame frame = desktop.getSelectedFrame(); |
241 |
if (frame != null) |
if (frame != null) |
242 |
{ |
{ |
243 |
try |
try |
244 |
{ |
{ |
245 |
if (frame.isIcon()) |
if (frame.isIcon()) |
246 |
frame.setIcon(false); |
frame.setIcon(false); |
247 |
else if (frame.isMaximum()) |
else if (frame.isMaximum()) |
248 |
frame.setMaximum(false); |
frame.setMaximum(false); |
249 |
} |
} |
250 |
catch (PropertyVetoException pve) |
catch (PropertyVetoException pve) |
251 |
{ |
{ |
252 |
} |
// We do nothing if the attempt has been vetoed. |
253 |
|
} |
254 |
} |
} |
255 |
} |
} |
256 |
|
|
309 |
*/ |
*/ |
310 |
public BasicDesktopPaneUI() |
public BasicDesktopPaneUI() |
311 |
{ |
{ |
312 |
|
// Nothing to do here. |
313 |
} |
} |
314 |
|
|
315 |
/** |
/** |
367 |
*/ |
*/ |
368 |
protected void installDefaults() |
protected void installDefaults() |
369 |
{ |
{ |
370 |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
Color bg = desktop.getBackground(); |
371 |
|
if (bg == null || bg instanceof UIResource) |
372 |
desktop.setBackground(defaults.getColor("desktop")); |
desktop.setBackground(UIManager.getColor("desktop")); |
373 |
} |
} |
374 |
|
|
375 |
/** |
/** |
387 |
protected void installKeyboardActions() |
protected void installKeyboardActions() |
388 |
{ |
{ |
389 |
// FIXME: create actions and keystrokes. |
// FIXME: create actions and keystrokes. |
390 |
registerKeyboardAction(); |
registerKeyboardActions(); |
391 |
} |
} |
392 |
|
|
393 |
/** |
/** |
411 |
* This method registers the actions to the appropriate Action and Input |
* This method registers the actions to the appropriate Action and Input |
412 |
* maps. |
* maps. |
413 |
*/ |
*/ |
414 |
protected void registerKeyboardAction() |
protected void registerKeyboardActions() |
415 |
{ |
{ |
416 |
// FIXME: Do the binding. |
// FIXME: Do the binding. |
417 |
// XXX: the gtk windows tend to intercept a lot of the |
// XXX: the gtk windows tend to intercept a lot of the |