Hi there,
I'm kinda stuck on a problem involving a whiteboard project. The project has a class named PaintableShape which wraps Shape objects. When I select a Shape object on the Whiteboard I can drag it to another location, and while doing so, provide the user with a painted preview of the shape as the mouse moves the shape across the whiteboard by calling the method paintDragPreview(Graphics2D g).
I've recently introduced the ability to also wrap components into PaintableShape as is evident by the additional constructor you see in the code below. The only difference is that components are actually set on the WhiteBoard (which extends JPanel) via an XYLayoutManager. There will potentially be only two types of components, both of which are rectangularly shaped. So I created a static instance variable for now to represent any component that may be on the whiteboard. Since the code in the method for paintDragPreview(...) works great for Shape objects, for some reason, I'm not getting the rectangle being drawn when I attempt to drag a component across the whiteboard.
Can someone lend there vast experience on this problem and help me to get this method working for components?
Thanks,
Alan