 |
July 2006 Archives
Reading Swing code and learning Java
Posted by kirillcool on July 20, 2006 at 06:14 PM | Permalink
| Comments (7)
Browsing the code for BasicScrollBarUI (yes, i don't have a life), i was puzzled by the following lines:
(ltr ? decrButton : incrButton).setBounds(leftButtonX,
itemY, leftButtonW, itemH);
(ltr ? incrButton : decrButton).setBounds(rightButtonX,
itemY, rightButtonW, itemH);
Say what? I had no idea that the ternary conditional operator can appear as a primary expression (JLS 15.8) followed by the method invocation. Well - it can (according to the 15.25 of JLS). Finally I have something to impress my wife. "So, honey, how was your day?", "You wouldn't believe!!! Did you know that the ternary conditional operator can appear as a primary expr... Hey, don't fall asleep!!!"
|