Libraryless. Click here for Pure Java version (7540L/43K).
1 | sclass DefaultButtonBorder extends JPanel { |
2 | JButton button; |
3 | |
4 | *(JButton *button) { |
5 | super(new BorderLayout); |
6 | setBorder(makeBorder()); |
7 | add(button); |
8 | onEnabledChanged(button, -> setBorder(makeBorder())); |
9 | } |
10 | |
11 | Border makeBorder() { |
12 | ret BorderFactory.createLineBorder(main isEnabled(button) ? Color.black : Color.lightGray); |
13 | } |
14 | } |
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: | 180 / 252 |
Version history: | 5 change(s) |
Referenced in: | [show references] |