Painting swing components to an arbitrary position?
Hi, first post, but I'll try to repay the favor by hanging around and helping others if someone solves this problem for me :)
I'm working on a project for a conferenceware program and I now need to know how to draw a JComponent to any spot on the screen. My first lead from Google was the CellRendererPane, which worked fine.... If I had of wanted to draw a rectangle. The paintComponent method didn't do anything, much less tell me if something was wrong. So I went searching again and stumbled across SwingUtilities.paintComponent. This one told me something was wrong, but gave me nothing to fix it. It threw a NullPointerException about a CellRendererPane, which left me wondering if it would have worked anyway.
tl;dr: Anyone have some sample code I can have a look at? This may need to include some initialisation code that would be easy to miss (at this stage I'm just constructing the components and chucking it through the methods). Any help at all would be appreciated, as I really don't want to have to write this thing from scratch :)
Re: Painting swing components to an arbitrary position?
Have you taken a look at this yet?