Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4121153

Docking JToolBar causes IllegalArgumentException if GridBagLayout is being used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.2.0
    • client-libs
    • None


      Dragging a toolbar out and then closing the toolbar window (to set
      the toolbar back in its original place) causes an IllegalArgumentException
      if GridBagLayout is being used for the toolbar's container:

      Exception occurred during event dispatching:
      java.lang.IllegalArgumentException: cannot add to layout: constraint must be a GridBagConstraint
              at java.awt.GridBagLayout.addLayoutComponent(GridBagLayout.java:450)
              at java.awt.Container.addImpl(Container.java:313)
              at java.awt.Container.add(Container.java:183)
              at java.awt.swing.plaf.basic.BasicToolBarUI.setFloating(BasicToolBarUI.java:226)
              at java.awt.swing.plaf.basic.BasicToolBarUI$FrameListener.windowClosing(BasicToolBarUI.java:424)
              at java.awt.Window.processWindowEvent(Window.java:413)
              at java.awt.swing.JFrame.processWindowEvent(JFrame.java:140)
              at java.awt.Window.processEvent(Window.java:389)
              at java.awt.Component.dispatchEventImpl(Component.java:2041)
              at java.awt.Container.dispatchEventImpl(Container.java:912)
              at java.awt.Window.dispatchEventImpl(Window.java:527)
              at java.awt.Component.dispatchEvent(Component.java:1951)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:167)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:45)



      To recreate, bring up the attached app.
      This displays a JToolBar in a JFrame that uses a GridBagLayout.
      Drag the toolbar out of the frame.
      Close the toolbar window to set it back in its original place in the frame.
      This causes an IllegalArgumentException to occur.

            gsaab Georges Saab
            gaurisha Gauri Sharma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: