| Author |
RadioButtons used to display unique images..images are not showing.
|
Heath Ward
Greenhorn
Joined: Jun 01, 2012
Posts: 3
|
|
Hi I have been having some trouble getting my images to display. I decided to try and create a java program that used radio buttons to display an image ..problem is the images will not display. I am using Eclipse and there are no red tag errors in my code ..so I am not sure what I am doing wrong.
I hope you can make sense of this ..I have been studying through RMIT open learning..I live in the country ..and I have been doing some New Boston Tutorials as well.
|
please help me I'm a grasshopper in CodeWorld
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8435
|
|
Welcome to the Ranch.
In future, while posting code, please UseCodeTags I have added them for you this time. As you can see they make the code much more easier to read and understand
What do you think this line does. Where does it add the pic?
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4164
|
|
In addition to what Maneesh said, what two values do you think this conditional compares?
Heath Ward wrote:
|
luck, db
There are no new questions, but there may be new answers.
|
 |
Heath Ward
Greenhorn
Joined: Jun 01, 2012
Posts: 3
|
|
honestly I'm not to sure..I was just kind of trying a bunch of different things to see if they worked ..I was hoping someone could explain the best way to get the images to show. I am overwhelmed by the overall amount of different classes you can use in Java
and I have probably used the wrong kind of class to make the radio buttons active ..I guess I thought that if the action performed on the button means it is selected then show the appropriate image. It was a stab in the dark.
|
 |
Heath Ward
Greenhorn
Joined: Jun 01, 2012
Posts: 3
|
|
I figured it out .. I needed to create a JLabel object when I did this it worked.
I also removed the if action statement stuff and simplified it
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32660
|
|
|
It might be worth going back to your ActionHandler and other classes, and writing on a piece of paper which image objects they are related to. You appear to be giving the ActionHandler an image as a field, which is good. So are you using that field to update the display?
|
 |
Ashish Agre
Ranch Hand
Joined: Jan 22, 2011
Posts: 73
|
|
This is inner class modified
use this code in the constructor and remember after adding component to the panel do validate else add first then manipulate component using setter methods
|
| B.E IT | SCJP 6.0 98 % |
|
 |
 |
|
|
subject: RadioButtons used to display unique images..images are not showing.
|
|
|