Libraryless. Click here for Pure Java version (7540L/43K).
sclass DefaultButtonBorder extends JPanel { JButton button; *(JButton *button) { super(new BorderLayout); setBorder(makeBorder()); add(button); onEnabledChanged(button, -> setBorder(makeBorder())); } Border makeBorder() { ret BorderFactory.createLineBorder(main isEnabled(button) ? Color.black : Color.lightGray); } }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035139 |
| Snippet name: | DefaultButtonBorder - visually indicate button is the default button |
| Eternal ID of this version: | #1035139/6 |
| Text MD5: | 7896e968876dc5d01646c63356104c0a |
| Transpilation MD5: | b958d5a90182492949473703d623aaf7 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-31 17:34:28 |
| Source code size: | 366 bytes / 14 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 611 / 737 |
| Version history: | 5 change(s) |
| Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) |