|
It depends. If you are absolutely never going to use more than
one look and feel, overriding paint() is adequate (although I would prefer to
assign a custom UI delegate to a subclass of JButton).
If your application requires the ability to support multiple
look and feels, you have three choices:
1. Implement a custom UI delegate for each supported look and
feel. This allows the behaviour to vary with the look and feel.
2. Do as above (override paint() or provide a single custom UI
delegate) - this will ensure that some behaviours of your components do not vary
with the look and feel, but is less time-consuming to implement - especially if
the number of look and feels you need to support is large.
3. Implement your own look and feel, which provides this new
behaviour for JButtons. This new look and feel could extend another already in
existence, such as Metal.
|
- What is this JComponent? Xiao Wei
- Re: What is this JComponent? Vikram Kumar
- RE: What is this JComponent? Xiao Wei
- Re: What is this JComponent? Vikram Kumar
- Re: What is this JComponent? Greg Munt
- Re: What is this JComponent? Vikram Kumar
- RE: What is this JComponent? Greg Munt
- RE: What is this JComponent? Xiao Wei
- Re: What is this JComponent? Greg Munt
