• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in alignment of its text in JButton with its image

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,


In my application, I would like to use the format in my application like as follows

User1
:User2
User3

I want simple code for either using JButton or JLabel. I 've used JLabel due to its aligment properties which looks good but JLabel doesn't have action listeners to perform some operations. If i use JButton then I m not able to align the same i've mention above user left side image then afterwards user_name. Using button, there is gap between image and user_name which looks bad.

Is't there any other components which is very easy to implement except JTree.

It is very urgent. Please let me know quickly
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Using button, there is gap between image and user_name which looks bad.



Personally, I think it looks good. White spaces exists for a reason. Take a look at the browser you are using. I bet all the menu items or toolbar buttons have a gap between the icon and the text. The UI designers of IE have more experience than you do.

But if you really want to proceed, then read the JButton API you will find a method that allows you to control the icon/text "gap".
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic