Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1032091 // dynamicallyPaintedComponent2 - overrides paintComponent(), not paint()

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3594L/20K).

1  
// paint: graphics/component width/component height
2  
// called in AWT thread
3  
static JComponent dynamicallyPaintedComponent2(final VF3<Graphics2D, Int, Int> paint) {
4  
  ret swing(() -> new JComponent {
5  
    public void paintComponent(Graphics g) {
6  
      callF(paint, (Graphics2D) g, getWidth(), getHeight());
7  
    }
8  
  });
9  
}
10  
11  
static JComponent dynamicallyPaintedComponent2(IVF3<Graphics2D, Int, Int> paint) {
12  
  ret dynamicallyPaintedComponent2(toVF3(paint));
13  
}

Author comment

Began life as a copy of #1019509

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032091
Snippet name: dynamicallyPaintedComponent2 - overrides paintComponent(), not paint()
Eternal ID of this version: #1032091/1
Text MD5: e8bb3fa5725964ce5edbb13528b1881f
Transpilation MD5: 5536fef6bb9a3b4b788c77b45e112908
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-11 14:10:35
Source code size: 468 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 156 / 216
Referenced in: [show references]