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

30
LINES

< > BotCompany Repo | #1014107 // jTiledBackground_trackWidth

JavaX fragment (include)

1  
static JPanel jTiledBackground_trackWidth(S imageID) {
2  
  ret jTiledBackground_trackWidth(loadImage2(imageID));
3  
}
4  
5  
static JPanel jTiledBackground_trackWidth(final BufferedImage tileImage) {
6  
  ret swing(func -> JPanel { ret new JPanel {
7  
    protected void paintComponent(Graphics g) {  
8  
      paintTiledBackground(this, g, tileImage);
9  
    }
10  
    
11  
    public Dimension getPreferredScrollableViewportSize() { ret getPreferredSize(); }
12  
    public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { return 20; }
13  
    public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
14  
      ret (direction == SwingConstants.HORIZONTAL ? visibleRect.width : visibleRect.height)*5/6;
15  
    }
16  
    public bool getScrollableTracksViewportWidth() { true; }
17  
    public bool getScrollableTracksViewportHeight() { false; }
18  
  }; });
19  
}
20  
  
21  
static JPanel jTiledBackground_trackWidth(S imageID, Component contents) {
22  
  ret jTiledBackground_trackWidth(loadImage2(imageID), contents);
23  
}
24  
  
25  
static JPanel jTiledBackground_trackWidth(BufferedImage tileImage, Component contents) {
26  
  JPanel panel = jTiledBackground_trackWidth(tileImage);
27  
  panel.setLayout(new BorderLayout);
28  
  panel.add(BorderLayout.CENTER, jtransparent_recursive(contents));
29  
  ret panel;
30  
}

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