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

23
LINES

< > BotCompany Repo | #1035451 // JG22NetworkElement (backup of dummy version)

JavaX fragment (include)

srecord noeq JG22NetworkElement(JG22Network parent, G22NetworkElement element) is Swingable {
  cachedVisualize {
    var box = jMinSize(400, 300, jcenteredlabel("Drag or resize me!"));
    setOpaqueBackground(Color.white, box);
    setBorder(box, BorderFactory.createLineBorder(Color.green, 10);
    onMouseDown(box, event -> {
      if (!mouseEventIsInBorder(event))
        new ComponentDragger(box, event);
    });
    
    new ComponentResizeDragger(box, box);
    var bounds = or(element.bounds, rect(50, 50, 400, 300));
    setBounds(box, bounds);
    
    onBoundsChange(box, r {
      element.bounds(toRect(getBounds(box)));
      element.network.change();
      parent.mainPanel.revalidateMe();
    });
    
    ret box;
  }
}

Author comment

Began life as a copy of #1035449

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035451
Snippet name: JG22NetworkElement (backup of dummy version)
Eternal ID of this version: #1035451/1
Text MD5: f2a9f694904c15fc9b8238b3cc2007a8
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-13 17:52:10
Source code size: 758 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 113 / 122
Referenced in: [show references]