Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-30-2008, 03:25 PM
Member
 
Join Date: May 2008
Posts: 49
prabhurangan is on a distinguished road
[SOLVED] How to set insets for JComboBox.......?
Hi Members,
I have to set insets for JCombobox, like we set for textbox and other components. But for JCombobox there is no option of setInsets(); function.
Please help me in this.
But we tried by setting border for JCombobox, however we face some look and feel issues, regards to Windows and Linux.

Looking forward for your reply.

Regards,
Prabhu.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-30-2008, 07:05 PM
Niveditha's Avatar
Senior Member
 
Join Date: May 2008
Posts: 282
Niveditha is on a distinguished road
Send a message via Skype™ to Niveditha
Hello Prabhu,
You will have to override the default ListCellRenderer with your own (or extend the current one) and create an EmptyBorder with the insets you would like..

JComboBox box = new JComboBox(data);
((BasicComboBoxRenderer)box.getRenderer()).setBord er(new EmptyBorder(0,3,0,3));
__________________
To finish sooner, take your own time....
Nivedithaaaa
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-01-2008, 07:14 AM
Member
 
Join Date: May 2008
Posts: 49
prabhurangan is on a distinguished road
Hi Niveditha,

Thank you for sharing your views. I will work on it and let you know the result.

Regards,
Prabhu.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-01-2008, 07:25 AM
Member
 
Join Date: May 2008
Posts: 49
prabhurangan is on a distinguished road
Hello Niveditha,
Thank you very mych, its work fine. The mistake i have made is i dint use that Renderer, I just gave an emptyborder that's it, but now your code works fine.


Thanks and Regards,
Prabhu.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
JComboBox and drop-down list.....HELP!!!!! Anna AWT / Swing 1 06-18-2008 06:16 AM
Problem with JComboBox and Jlist java_fun2007 New To Java 2 05-07-2008 09:58 PM
JComboBox setDisabledTextColor Jack AWT / Swing 2 07-02-2007 06:32 AM
Help with jComboBox Marcus AWT / Swing 2 07-02-2007 12:08 AM
jcombobox Freddie AWT / Swing 4 05-11-2007 01:48 AM


All times are GMT +3. The time now is 01:48 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org