228 public void mouseReleased(MouseEvent e) {
229 forwardEventToParent(e);
230 }
231 public void mouseEntered(MouseEvent e) {
232 forwardEventToParent(e);
233 }
234 public void mouseExited(MouseEvent e) {
235 forwardEventToParent(e);
236 }
237 });
238 }
239
240 void forwardEventToParent(MouseEvent e) {
241 getParent().dispatchEvent(new MouseEvent(
242 getParent(), e.getID(), e.getWhen(), e.getModifiers(),
243 e.getX(), e.getY(), e.getXOnScreen(),
244 e.getYOnScreen(), e.getClickCount(),
245 e.isPopupTrigger(), MouseEvent.NOBUTTON));
246 }
247
248 public boolean isFocusTraversable() {
249 return false;
250 }
251
252 public Dimension getMinimumSize() {
253 return new Dimension(defaultIcon.getIconWidth() + 1,
254 LABEL_HEIGHT + LABEL_DIVIDER);
255 }
256
257 public Dimension getPreferredSize() {
258 String title = frame.getTitle();
259 FontMetrics fm = frame.getFontMetrics(defaultTitleFont);
260 int w = 4;
261 if (title != null) {
262 w += SwingUtilities2.stringWidth(frame, fm, title);
263 }
264 return new Dimension(w, LABEL_HEIGHT + LABEL_DIVIDER);
265 }
266
267 public void paint(Graphics g) {
319 if (!systemMenu.isShowing()) {
320 forwardEventToParent(e);
321 }
322 }
323 public void mouseEntered(MouseEvent e) {
324 forwardEventToParent(e);
325 }
326 public void mouseExited(MouseEvent e) {
327 forwardEventToParent(e);
328 }
329 });
330 }
331
332 void forwardEventToParent(MouseEvent e) {
333 getParent().dispatchEvent(new MouseEvent(
334 getParent(), e.getID(), e.getWhen(), e.getModifiers(),
335 e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(),
336 e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON ));
337 }
338
339 public boolean isFocusTraversable() {
340 return false;
341 }
342 }
343
344
345 protected class DesktopIconActionListener implements ActionListener {
346 public void actionPerformed(ActionEvent e){
347 systemMenu.show(iconButton, 0, getDesktopIcon().getHeight());
348 }
349 }
350
351 protected class DesktopIconMouseListener extends MouseAdapter {
352 // if we drag or move we should deengage the popup
353 public void mousePressed(MouseEvent e){
354 if (e.getClickCount() > 1) {
355 try {
356 getFrame().setIcon(false);
357 } catch (PropertyVetoException e2){ }
358 systemMenu.setVisible(false);
|
228 public void mouseReleased(MouseEvent e) {
229 forwardEventToParent(e);
230 }
231 public void mouseEntered(MouseEvent e) {
232 forwardEventToParent(e);
233 }
234 public void mouseExited(MouseEvent e) {
235 forwardEventToParent(e);
236 }
237 });
238 }
239
240 void forwardEventToParent(MouseEvent e) {
241 getParent().dispatchEvent(new MouseEvent(
242 getParent(), e.getID(), e.getWhen(), e.getModifiers(),
243 e.getX(), e.getY(), e.getXOnScreen(),
244 e.getYOnScreen(), e.getClickCount(),
245 e.isPopupTrigger(), MouseEvent.NOBUTTON));
246 }
247
248 @SuppressWarnings("deprecation")
249 public boolean isFocusTraversable() {
250 return false;
251 }
252
253 public Dimension getMinimumSize() {
254 return new Dimension(defaultIcon.getIconWidth() + 1,
255 LABEL_HEIGHT + LABEL_DIVIDER);
256 }
257
258 public Dimension getPreferredSize() {
259 String title = frame.getTitle();
260 FontMetrics fm = frame.getFontMetrics(defaultTitleFont);
261 int w = 4;
262 if (title != null) {
263 w += SwingUtilities2.stringWidth(frame, fm, title);
264 }
265 return new Dimension(w, LABEL_HEIGHT + LABEL_DIVIDER);
266 }
267
268 public void paint(Graphics g) {
320 if (!systemMenu.isShowing()) {
321 forwardEventToParent(e);
322 }
323 }
324 public void mouseEntered(MouseEvent e) {
325 forwardEventToParent(e);
326 }
327 public void mouseExited(MouseEvent e) {
328 forwardEventToParent(e);
329 }
330 });
331 }
332
333 void forwardEventToParent(MouseEvent e) {
334 getParent().dispatchEvent(new MouseEvent(
335 getParent(), e.getID(), e.getWhen(), e.getModifiers(),
336 e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(),
337 e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON ));
338 }
339
340 @SuppressWarnings("deprecation")
341 public boolean isFocusTraversable() {
342 return false;
343 }
344 }
345
346
347 protected class DesktopIconActionListener implements ActionListener {
348 public void actionPerformed(ActionEvent e){
349 systemMenu.show(iconButton, 0, getDesktopIcon().getHeight());
350 }
351 }
352
353 protected class DesktopIconMouseListener extends MouseAdapter {
354 // if we drag or move we should deengage the popup
355 public void mousePressed(MouseEvent e){
356 if (e.getClickCount() > 1) {
357 try {
358 getFrame().setIcon(false);
359 } catch (PropertyVetoException e2){ }
360 systemMenu.setVisible(false);
|