Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Making components look the way you want them to

 
Ashish Hareet
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to write code that will make the components look the way I want them to eg, button's would be round & that sorta stuff. I know I gotta make my own LnF class , etc but the problem is I don't know how to start. I somehow managed to change the default colors by subclassing the DefaultMetalTheme class, but how do I go about & use/subclass other classes to get the kind of behaviour I want. Is there an online resource to help me get started with this ?
Thanx
Ashish Hareet
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ashish,
IMHO - Don't mess with the L&F so much or subclass a bunch of classes. Especially if you are like me and don't know how.
If it is primarily Buttons that you would like to change, the easiest way is to use ImageIcons. You can apply ImageIcons for several different JButton states.
Normal State
Pressed State
Rolloever State
Disables State
Also, removing the border (button.setBorderPainted(false) allows you to lose the square border around the button and it will appear to be the shape of your ImageIcon that you choose.
Anyway, that is what I do. Saves me a lot of time messing with UI stuff.
 
Ashish Hareet
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Gregg,
I saw these bunch of skins for your java app's & it just blew me off big time. I know it'll be pretty much a waste of time trying to make your app look like a work of art when functionality matters, but at times it does matter to the end user & well, I just gotta know how it works.
So any one with an online resource or maybe some source code , I'd really appreciate it !
Ashish Hareet
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's an article on Sun's site... Here's a chat transcript on look-and-feel on Sun's site... Here's a look-and-feel called SLAF... and Here's one called SkinLF that is a modifiable look-and-feel.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic