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

17
LINES

< > BotCompany Repo | #1035243 // JDraggableBoxDemo

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (11133L/64K).

1  
sclass JDraggableBoxDemo is Swingable {
2  
  cachedVisualize {
3  
    var parent = jpanelWithoutLayoutManager();
4  
    var box = jMinSize(400, 300, jcenteredlabel("Drag or resize me!"));
5  
    setBorder(box, BorderFactory.createLineBorder(Color.green, 10);
6  
    onMouseDown(box, event -> {
7  
      if (!mouseEventIsInBorder(event)) {
8  
        printVars("ComponentDragger start");
9  
        new ComponentDragger(box, event).debug(true).start();
10  
      }
11  
    });
12  
    new ComponentResizeDragger(box, box).debug(true);
13  
    setBounds(box, 50, 50, 400, 300);
14  
    addToContainer(parent, box);
15  
    ret parent;
16  
  }
17  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 5 computer(s): bhatertpkbcr, ekrmjmnbrukm, iveijnkanddl, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035243
Snippet name: JDraggableBoxDemo
Eternal ID of this version: #1035243/5
Text MD5: 3841c7b16c00ea18aa3d6d26132fde9d
Transpilation MD5: 049992f38078e18ae1d991d13fb4185f
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-14 03:17:49
Source code size: 606 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 168 / 279
Version history: 4 change(s)
Referenced in: [show references]