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)

1  
srecord noeq JG22NetworkElement(JG22Network parent, G22NetworkElement element) is Swingable {
2  
  cachedVisualize {
3  
    var box = jMinSize(400, 300, jcenteredlabel("Drag or resize me!"));
4  
    setOpaqueBackground(Color.white, box);
5  
    setBorder(box, BorderFactory.createLineBorder(Color.green, 10);
6  
    onMouseDown(box, event -> {
7  
      if (!mouseEventIsInBorder(event))
8  
        new ComponentDragger(box, event);
9  
    });
10  
    
11  
    new ComponentResizeDragger(box, box);
12  
    var bounds = or(element.bounds, rect(50, 50, 400, 300));
13  
    setBounds(box, bounds);
14  
    
15  
    onBoundsChange(box, r {
16  
      element.bounds(toRect(getBounds(box)));
17  
      element.network.change();
18  
      parent.mainPanel.revalidateMe();
19  
    });
20  
    
21  
    ret box;
22  
  }
23  
}

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