Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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: 3284
30
  • 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".
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic