i wrote a simple code that changes the color of the frame when the button is clicked ,the thing is when i run the program i am getting the output of the previous program (a frame that just displays a button) which i wrote .I am using eclipse indigo .Eclipse says there is an error in the project but where the error is it is not showing.
Eclipse should always show you where the error is, with a little red icon with a cross in. Hover your mouse over that and you get more details. What it cannot tell you is whether you are using object‑oriented design or not, and that isn’t even close! In my opinion addActionListener(this) is an abomination against object‑oriented programming, and all the people who write books using it ought to be strung up and beaten with several megabytes of C code
Start here. You will want some sort of class. How about this?There are obviously bits you will have to fill in for yourself. Search for my posts on this forum with “ColourListener” as a keyword, and you will find more. But I don’t think you will find a complete class.
How you are getting Button in frame without adding it to container ?
i should have checked i forgot to add the buttons to the container
Thanks Campbell Ritchie ,Shtilmark Pollo and Hitesh P Patel .I have to go through a lot of topics in GUI i guess,cause i dont know anything about ColourListener.I will refer to your posts Campbell Ritchie.