I've been working on this on and off for a while and have quite a bit of the back end mechanics working but I'm still struggling with this hurdle.
I want to display a background image (an old scroll) in my j frame. Then add text over the top to display the character's stats. The frame includes a text box to display descriptive text as each area loads and a j panel which will hopefully display a simple 2d image of the current area too. (that is a whole 'nother issue for later)
I've tried to use a couple of methods to paint the image and my code has become a bit messy now...
One method I used actually painted the image on the frame but it covered up all the labels and text fields i'd put in. The other method threw no errors but didn't paint.
So any advice about how I should be doing this would be very welcome. And if any of my other code would help I can post it.
In pseudo code
1) Have a custom panel with the background image
2) Set it as your jframe's content pane
3) Ensure all other child containers (read panels) you add to the content pane are transparent. Check out JPanel.setOpaque()
I've just tried to implement that code you linked but it's got errors here (lines 1 and 2): Line 1 errors say "modifier protected not allowed here" and "annotation type not applicable to this kind of declaration"
Line 2 error says " ';' expected", which usually means I haven't closed something properly earlier but i'm pretty sure I got this verbatim.
So when I get that sorted out, then I make sure my main frame includes it's own background object and when it initialises it should paint in the background. Right?
Might take a while to get that sorted. Like maybe tomorrow.
Should this example actually open a gui window when run or just have all the code i'm using? I've mostly been using the "design" tab of NetBeans to set the parameters of the components and the code enters the uneditable section.
I've been working through the stuff in the link and have fixed most of my issues. It seems the opaqueness issue was cause by the generated code form the Netbeans drag and drop components. I've used setLayout(null) and will manually add and position my labels and other components. The Frame is setResizable(false) so it wont get messed up later.
Unfortunately I can't get my textArea to display and function the scrollPane properly now. I'll just spend a while longer trying to figure it out and I'll post a new thread to get some ideas how to run the MVC.