This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
I just wondering how I can add a Graphics object like rectangle to a JPanel?
I have following classes and I can add the Label object into MyPanel but I cant add drawing object (MyRect) into Jpanel.I know that I am not constructing any thing in MyRect() constructor! so it make sence for me that nothing will happen in MyPanel when I call for MyRect constructor but I don't' know how to call the paintComponent with it's parameters in MyPanel class!
Could you please let me know is it possible to add a drawing into a panel?
so what's wrong with this code?
posted 6 years ago
after adding/displaying, print out the panel's size