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

32
LINES

< > BotCompany Repo | #1013740 // pMain - start Processing applet (PApplet2)

JavaX fragment (include)

1  
set flag AllPublic.
2  
set flag HaveProcessing.
3  
4  
ifdef Processing2  lib 1400094 endifdef
5  
ifndef Processing2 lib 1013739 endifndef
6  
7  
import processing.core.*;
8  
9  
static <A extends PApplet> A pMain(final Class<A> c) {
10  
  ret first(pMainWithFrame(c));
11  
}
12  
13  
static <A extends PApplet> Pair<A, Frame> pMainWithFrame(final Class<A> c) {
14  
  ret swing(func -> Pair<A, Frame> {
15  
    fixContextClassLoader();
16  
    A a = nuInstance(c);
17  
    //Set<Frame> frames = asSet(listAWTFrames());
18  
    PApplet.runSketch(new S[] { c.getName() }, a);
19  
    //Frame frame = first(listWithoutSet(listAWTFrames(), frames));
20  
    ifdef Processing2
21  
      Frame frame = a.frame;
22  
    endifdef
23  
    ifndef Processing2
24  
      Frame frame = cast getOpt(a.getSurface(), 'frame);
25  
    endifndef
26  
    ret pair(a, frame);
27  
  });
28  
}
29  
30  
static PApplet2 pMain() {
31  
  ret pMain(mc());
32  
}

Author comment

Began life as a copy of #1013738

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013740
Snippet name: pMain - start Processing applet (PApplet2)
Eternal ID of this version: #1013740/22
Text MD5: ba73f85bc0ad67c203c2c1fe933642a8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-30 14:46:48
Source code size: 850 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 432 / 473
Version history: 21 change(s)
Referenced in: [show references]