• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Got it working !!!

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about the other one... multi line button
 
Meghna ks
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Swamy Vatti
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did u try using
label.setAlignmentX(JLabel.CENTER_ALIGNMENT);
label.setAlignmentY(JLabel.CENTER_ALIGNMENT);
when the layout is BoxLayout
 
Meghna ks
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
He's giving us the slip! Quick! Grab this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic