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

Pane eventHandler breaks after child is added

    Details

      Description

      I have a class called "MouseHandler" that has all of my MouseEvents. I originally had it nested in another class, and created a new class now. I was having a bunch of errors, and for some reason switching back and forth in my "platforms" on netbeans fixed this(not too sure if this has to do with Netbeans, or what...) but it works now.

      So on to the main issue. For some reason this class that extends Pane is having an issue with mouseHandler.

      here is the class

      public class Display extends Pane
      {
          Box b;
          PhongMaterial pm = new PhongMaterial(Color.GRAY);
          public Display(Double x, Double y,Double width, Double height)
          {
               super();
               b = new Box(width, height,10);
               setPrefSize(width,height);
               relocate(x, y);
               b.setMaterial(pm);
              
               b.addEventFilter(MouseEvent.ANY, new MouseHandler(this));
               getChildren().add(b);
          }
          
      }

      I want to be able to click the "box" that represents the pane and drag it and all of the contents inside, but I want to be able to manipulate the other content as well(which is why I need the box, since if I use the pane it will drag itself around); however when I add an item to it from my listbox and drop it onto my box, the box will NOT react to mouse events at all. The FIRST item will. If I try to add additional items nothing works. If I do just the pane, I can move it around no problem after dropping, but like I said above it only drags itself, and the inside contents are unclickable.

      If I switch to a group, there is no problem, so I'm wondering what the deal is with the Pane?

      I know it's the "Base Class" but I wasn't too sure which layout class to use for this, and Pane seemed to be the best choice...

      Thanks!

      ~KZ

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psafrata Pavel Šafrata
                Reporter:
                jorsawjfx Jay Orsaw (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: