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).

// paint: graphics/component width/component height
// called in AWT thread
static JComponent dynamicallyPaintedComponent2(final VF3<Graphics2D, Int, Int> paint) {
  ret swing(() -> new JComponent {
    public void paintComponent(Graphics g) {
      callF(paint, (Graphics2D) g, getWidth(), getHeight());
    }
  });
}

static JComponent dynamicallyPaintedComponent2(IVF3<Graphics2D, Int, Int> paint) {
  ret dynamicallyPaintedComponent2(toVF3(paint));
}

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: 82 / 120
Referenced in: [show references]