This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Thanks to Swami & Nathan with my problem regardint putting the background images in a button, I was able to make it work. All I did was to add an imagePanel directly to the button & add a mouseclicked event to the imagepanel to do the same job as that of the button's mouseclicked event. I used the SCALE_TO_FIT property of the imagepanel to scale the image inside the button & then added it as a component itself to the button. Thanks again Meghna
Yeah, I'm still having some problems with multiline button. I'm using a delimiter "\n" and then wrapping the text to the next line. But, I'm setting the button's/ Imagepanel's layout to Borderlayout & then adding the labels to it. In Boxlayout, the problem is that the text is starting from the left most corner of the button, which does'nt look good since the text needs to be centered, alto' the alignment of the label is set to CENTER. Any suggestions are welcome ! Thanks Meghna
Joined: May 02, 2001
Did u try using label.setAlignmentX(JLabel.CENTER_ALIGNMENT); label.setAlignmentY(JLabel.CENTER_ALIGNMENT); when the layout is BoxLayout
Joined: Mar 15, 2001
It kinda worked except for the fact that the text is placed at the topmost level of the button, but it is centered now. I'm tryint to work on that right now. Let's hope it works Thanks Meghna