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

SwingComponents in a CustomNode malfunction after resize

XMLWordPrintable

      If you wrap a SwingComponent with a CustomNode and then change the size of the SwingComponent the bounds detection doesn't work correctly. All mouse events including rollover, click, etc. only work in the area the SwingComponent occupied prior to resize. In the case of certain components, such as SwingLists, this makes them inoperable. Also, there is no equivalent control for a list yet, which makes a workaround difficult.

      Here is a code sample:
      var list = SwingList {
          items: for (i in [0..200]) SwingListItem {
              text: "{i}"
          }
      }

      class CustomNodeWrapper extends CustomNode {
          override function create() {
              list
          }
      }

      Stage {
          scene: Scene {
              width: 500
              height: 500
              content: CustomNodeWrapper {}
          }
      }

      list.width = 500;
      list.height = 500;

      It will display a 500x500 pixel list, but if you try to use the scrollbar, none of the mouse events will register.

      A working example is attached. This applies to all SwingComponents (uncomment the SwingButton line to try that instead).

            amfowler Anne Fowler (Inactive)
            schin Stephen Chin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: