A JLabel is to be given focus and then a JButton is to be pressed to perform some changes on the JLabel...how should i proceed??
should i try giving the focuslost event on the label or the button??
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
if you have multiple labels, perhaps a better option might be to instead use JRadioButtons (added to a ButtonGroup),
then when the button is clicked, it changes what it has to change of the selected radiobutton.
luck, db
There are no new questions, but there may be new answers.
Prachi Vallecha
Greenhorn
Joined: Sep 16, 2010
Posts: 4
posted
0
noo..sorry for the last one...
that was a similar issue..its resolved now...my fault
actually i have to use labels because i am using an image as icon
now i have to change the image at runtime pressing a button...but there are many labels
so focus needs to be given to the label to be changed...but there is no focus for a label right??
so is there some other way to use images other than label-icons???
or some way to give focus to the label?
What Darryl means is that, even if your problem was resolved, the ranchers here appreciate it if you let them know.
Anyway, you can listen for focus on all the labels, and have a variable somewhere in which you save which of the labels was the last one to receive focus. Then when you press the button, receive the appropriate label from the variable.
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
> actually i have to use labels because i am using an image as icon
several other components also display images
Prachi Vallecha
Greenhorn
Joined: Sep 16, 2010
Posts: 4
posted
0
Thanks for the replies...
though i found the solution...i had completely forgotten about the mouseclicked event...
thanks everyone..