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

30
LINES

< > BotCompany Repo | #1014107 // jTiledBackground_trackWidth

JavaX fragment (include)

static JPanel jTiledBackground_trackWidth(S imageID) {
  ret jTiledBackground_trackWidth(loadImage2(imageID));
}

static JPanel jTiledBackground_trackWidth(final BufferedImage tileImage) {
  ret swing(func -> JPanel { ret new JPanel {
    protected void paintComponent(Graphics g) {  
      paintTiledBackground(this, g, tileImage);
    }
    
    public Dimension getPreferredScrollableViewportSize() { ret getPreferredSize(); }
    public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { return 20; }
    public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
      ret (direction == SwingConstants.HORIZONTAL ? visibleRect.width : visibleRect.height)*5/6;
    }
    public bool getScrollableTracksViewportWidth() { true; }
    public bool getScrollableTracksViewportHeight() { false; }
  }; });
}
  
static JPanel jTiledBackground_trackWidth(S imageID, Component contents) {
  ret jTiledBackground_trackWidth(loadImage2(imageID), contents);
}
  
static JPanel jTiledBackground_trackWidth(BufferedImage tileImage, Component contents) {
  JPanel panel = jTiledBackground_trackWidth(tileImage);
  panel.setLayout(new BorderLayout);
  panel.add(BorderLayout.CENTER, jtransparent_recursive(contents));
  ret panel;
}

Author comment

Began life as a copy of #1006894

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: #1014107
Snippet name: jTiledBackground_trackWidth
Eternal ID of this version: #1014107/1
Text MD5: 4225803979e5850e9080258db205a6c1
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-07 15:34:05
Source code size: 1323 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 339 / 365
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)