• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RadioButtons used to display unique images..images are not showing.

 
Heath Ward
Greenhorn
Posts: 3
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maneesh Godbole
Saloon Keeper
Posts: 11165
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In addition to what Maneesh said, what two values do you think this conditional compares?
Heath Ward wrote:
 
Heath Ward
Greenhorn
Posts: 3
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 50171
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic