A DESCRIPTION OF THE REQUEST :
I often write the following long and finger-tiring piece of code:
myLabel.setFont(myLabel.getFont().deriveFont(Font.BOLD));
but would like to write
myLabel.changeFont(BOLD);
This report is essential two related feature requests aiming at reducing unnecessarily verbose code:
(1) Where a method such as deriveFont(int) takes a constant from class Font, we shouldn't need to have to write
font.deriveFont(Font.BOLD)
but instead just
font.deriveFont(BOLD)
since it can only take constants from the Font class so "Font." can be assumed. This applies to any method parameter that takes a fixed constant value.
(2) Shortcut method on Component to replace the
setFont(getFont().deriveFont())
with
changeFont(size, and/or style, and or family)
This is just a specific example of simplifying user code at little cost
JUSTIFICATION :
It would make code shorter and closer to what the brain understands is the intended behaviour.
component.changeFont(BOLD)
is easy to understand at a glance and is unambiguous from the compiler's standpoint because the changeFont() method parameter would be tied to the Font.BOLD / ITALIC / NORMAL constants.
###@###.### 2004-11-12 17:44:39 GMT