1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
468 * No longer used, use BasicToolBarUI.createFloatingWindow(JToolBar) |
468 * No longer used, use BasicToolBarUI.createFloatingWindow(JToolBar) |
469 * @see #createFloatingWindow |
469 * @see #createFloatingWindow |
470 */ |
470 */ |
471 protected JFrame createFloatingFrame(JToolBar toolbar) { |
471 protected JFrame createFloatingFrame(JToolBar toolbar) { |
472 Window window = SwingUtilities.getWindowAncestor(toolbar); |
472 Window window = SwingUtilities.getWindowAncestor(toolbar); |
|
473 @SuppressWarnings("serial") // anonymous class |
473 JFrame frame = new JFrame(toolbar.getName(), |
474 JFrame frame = new JFrame(toolbar.getName(), |
474 (window != null) ? window.getGraphicsConfiguration() : null) { |
475 (window != null) ? window.getGraphicsConfiguration() : null) { |
475 // Override createRootPane() to automatically resize |
476 // Override createRootPane() to automatically resize |
476 // the frame when contents change |
477 // the frame when contents change |
477 protected JRootPane createRootPane() { |
478 protected JRootPane createRootPane() { |
|
479 @SuppressWarnings("serial") // anonymous class |
478 JRootPane rootPane = new JRootPane() { |
480 JRootPane rootPane = new JRootPane() { |
479 private boolean packing = false; |
481 private boolean packing = false; |
480 |
482 |
481 public void validate() { |
483 public void validate() { |
482 super.validate(); |
484 super.validate(); |
503 * dragged out from its container |
505 * dragged out from its container |
504 * @return a <code>RootPaneContainer</code> object, containing the toolbar. |
506 * @return a <code>RootPaneContainer</code> object, containing the toolbar. |
505 * @since 1.4 |
507 * @since 1.4 |
506 */ |
508 */ |
507 protected RootPaneContainer createFloatingWindow(JToolBar toolbar) { |
509 protected RootPaneContainer createFloatingWindow(JToolBar toolbar) { |
|
510 @SuppressWarnings("serial") // Superclass is not serializable across versions |
508 class ToolBarDialog extends JDialog { |
511 class ToolBarDialog extends JDialog { |
509 public ToolBarDialog(Frame owner, String title, boolean modal) { |
512 public ToolBarDialog(Frame owner, String title, boolean modal) { |
510 super(owner, title, modal); |
513 super(owner, title, modal); |
511 } |
514 } |
512 |
515 |
515 } |
518 } |
516 |
519 |
517 // Override createRootPane() to automatically resize |
520 // Override createRootPane() to automatically resize |
518 // the frame when contents change |
521 // the frame when contents change |
519 protected JRootPane createRootPane() { |
522 protected JRootPane createRootPane() { |
|
523 @SuppressWarnings("serial") // anonymous class |
520 JRootPane rootPane = new JRootPane() { |
524 JRootPane rootPane = new JRootPane() { |
521 private boolean packing = false; |
525 private boolean packing = false; |
522 |
526 |
523 public void validate() { |
527 public void validate() { |
524 super.validate(); |
528 super.validate(); |
1368 public void mouseMoved(MouseEvent e) { |
1372 public void mouseMoved(MouseEvent e) { |
1369 getHandler().mouseMoved(e); |
1373 getHandler().mouseMoved(e); |
1370 } |
1374 } |
1371 } |
1375 } |
1372 |
1376 |
|
1377 @SuppressWarnings("serial") // Same-version serialization only |
1373 protected class DragWindow extends Window |
1378 protected class DragWindow extends Window |
1374 { |
1379 { |
1375 Color borderColor = Color.gray; |
1380 Color borderColor = Color.gray; |
1376 int orientation = toolBar.getOrientation(); |
1381 int orientation = toolBar.getOrientation(); |
1377 Point offset; // offset of the mouse cursor inside the DragWindow |
1382 Point offset; // offset of the mouse cursor inside the DragWindow |