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

12
LINES

< > BotCompany Repo | #1011065 // defaultNewFrameBounds

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

Libraryless. Click here for Pure Java version (5124L/28K).

static Rectangle defaultNewFrameBounds_r = new Rectangle(300, 100, 500, 400);

static Rectangle defaultNewFrameBounds() {
  ret swing(func -> Rectangle {
    defaultNewFrameBounds_r.translate(60, 20);
    var bounds = preferredScreenBounds();
    if (!bounds.contains(defaultNewFrameBounds_r))
      //defaultNewFrameBounds_r.setLocation(bounds.x+30+random(30), bounds.y+20+random(20));
      defaultNewFrameBounds_r.setLocation(centerX(bounds)+random_incl(-30, 30), centerY(bounds)+random_incl(-20, 20));
    ret new Rectangle(defaultNewFrameBounds_r);
  });
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011065
Snippet name: defaultNewFrameBounds
Eternal ID of this version: #1011065/6
Text MD5: 3e4f4b109eb61535b9030b9107e47e9b
Transpilation MD5: 8fae0a6f30cbaef9ace7d7844da9ed56
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-09 18:08:48
Source code size: 572 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 510 / 619
Version history: 5 change(s)
Referenced in: [show references]