Hi everyone! I am a novice in Java and I would really need your help, as I am struggling with the code. I have created an Applet that displays information about a fictitious company but I would like this info to change, depending on which button the user presses. All the components (info) in the Applet are part of a paint method: lines, strings and images mainly. Which kind of procedure would I need to allow this to occur? Could I have two or more paint methods working based on each button that will be pressed? I mean once the Applet is loaded a paint method would be called, if a button is pressed that paint would not be valid anymore and another would be called and so on and so forth. If this is possible, could you give me a hint on how to do it? I would be grateful. Yours, Saulo
Welcome to JavaRanch, Saulo! To better help others here to help you, post some code that you've been working. Explain what it does, or what you wish it did and why. Also explain how you think you might be able to change it to do what you want. Note: When posting code, please be sure to surround the code with the [code] and [/code] UBB Tags. This will help to preserve the formatting of the code, thus making it easier to read and understand.
Following is the code to my Applet. What I intend to do is to make components from the painting method to be painted only if a certain variable is true. In this way I intend display info - images, strings, ect - only if a certain button is clicked, which would allow me to control what is going to be displayed on my Applet. To test it I tried this code but now that I have added the booleans b1, b2, b3, b4 and their parameters the images simply vanished... Would somebody be able to explain me why this is happening and give me a hint of how I can solve this problem? Many thanks! Saulo