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)

set flag AllPublic.
set flag HaveProcessing.

ifdef Processing2  lib 1400094 endifdef
ifndef Processing2 lib 1013739 endifndef

import processing.core.*;

static <A extends PApplet> A pMain(final Class<A> c) {
  ret first(pMainWithFrame(c));
}

static <A extends PApplet> Pair<A, Frame> pMainWithFrame(final Class<A> c) {
  ret swing(func -> Pair<A, Frame> {
    fixContextClassLoader();
    A a = nuInstance(c);
    //Set<Frame> frames = asSet(listAWTFrames());
    PApplet.runSketch(new S[] { c.getName() }, a);
    //Frame frame = first(listWithoutSet(listAWTFrames(), frames));
    ifdef Processing2
      Frame frame = a.frame;
    endifdef
    ifndef Processing2
      Frame frame = cast getOpt(a.getSurface(), 'frame);
    endifndef
    ret pair(a, frame);
  });
}

static PApplet2 pMain() {
  ret pMain(mc());
}

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: 523 / 555
Version history: 21 change(s)
Referenced in: [show references]