• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How create a JComboBox with the border round

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

I'm doing developing a new look and feel for swing and now I want to create a new style of a combo box with the border round.

I have implemented new Border and this is the code

and this is the effect


But my problem is when I add the panel black and the JComboBox background white the effect is wrong and it is equal this



My component MaterialComboBoxUI is this



My problem is how remove the rectangular border to JComboBox?

Solution
I rewrite the update method, this is the code


This is the effect
 
Sheriff
Posts: 28394
100
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi vincenzo, welcome to the Ranch!

To me it looks like you're setting the JComboBox's border at line 32 of your code. You say you don't want that border? Then it seems to me you could just remove that line of code.

You also have a method called createArrowButton which does a lot of things with your special border-maker, but I don't see any code which calls that method. Anyway I don't understand why you don't put the special border around the combo box, instead of making a separate button.
 
Vincenzo Palazzo
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Hi vincenzo, welcome to the Ranch!

To me it looks like you're setting the JComboBox's border at line 32 of your code. You say you don't want that border? Then it seems to me you could just remove that line of code.

You also have a method called createArrowButton which does a lot of things with your special border-maker, but I don't see any code which calls that method. Anyway I don't understand why you don't put the special border around the combo box, instead of making a separate button.



Hi Paul, thanks so much.

I'm setting my border round whit this code but the line of the border is round and the border doesn't is round.

To me it looks like you're setting the JComboBox's border at line 32 of your code. You say you don't want that border? Then it seems to me you could just remove that line of code.



Because this method is the method for setting a button od the JComboBox and I inherited all to BasicComboBoxUI

You also have a method called createArrowButton which does a lot of things with your special border-maker, but I don't see any code which calls that method. Anyway I don't understand why you don't put the special border around the combo box, instead of making a separate button




I found the problem and I edited the question with the solution, thanks so much
 
Paul Clapham
Sheriff
Posts: 28394
100
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, you're ahead of me in working with Swing look and feels. Good to hear you have the solution now.
 
Vincenzo Palazzo
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Okay, you're ahead of me in working with Swing look and feels. Good to hear you have the solution now.



Thanks so much for your answer and for you beautiful words
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic