1 | static JComponent jVerticalGreenBar(final LiveValue<? extends Number> lv, fO... _) { |
2 | final JComponent c = dynamicallyPaintedComponent(voidfunc(Graphics2D g, int w, int h) { |
3 | float value = toFloat(lv!); |
4 | float max = toFloat(optParam(_, 'max, (Number) 1f)); |
5 | int height = iround(doubleRatio(value, max)*h); |
6 | main.fillRect(g, 0, 0, w, h-height, Color.black); |
7 | main.fillRect(g, 0, h-height, w, height, Color.green); |
8 | }); |
9 | bindLiveValueListenerToComponent(c, lv, r { c.repaint() }); |
10 | ret c; |
11 | } |
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019516 |
Snippet name: | jVerticalGreenBar - dynamic green bar based on LiveValue |
Eternal ID of this version: | #1019516/2 |
Text MD5: | e29c71b0b926de1a5fda2dd1fb060d9e |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-11 18:49:14 |
Source code size: | 517 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 274 / 319 |
Version history: | 1 change(s) |
Referenced in: | [show references] |