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

24
LINES

< > BotCompany Repo | #1008609 // customLayoutPanel_trackWidth - customLayoutPanel with width = enclosing width

JavaX fragment (include)

1  
// layouter: voidfunc(Container) or func(Container) -> Dimension
2  
// (return value is preferred size)
3  
static JPanel customLayoutPanel_trackWidth(fO layouter) {
4  
  class P extends JPanel implements Scrollable {
5  
    *() { super(layoutManagerFromFunction(layouter)); }
6  
    
7  
    @Override
8  
    public Dimension getPreferredScrollableViewportSize() { ret getPreferredSize(); }
9  
    @Override
10  
    public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { return 20; }
11  
12  
    @Override
13  
    public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
14  
      ret (direction == SwingConstants.HORIZONTAL ? visibleRect.width : visibleRect.height)*5/6;
15  
    }
16  
17  
    @Override
18  
    public bool getScrollableTracksViewportWidth() { true; }
19  
20  
    @Override
21  
    public boolean getScrollableTracksViewportHeight() { false; }
22  
  }
23  
  ret new P;
24  
}

Author comment

Began life as a copy of #1008604

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: #1008609
Snippet name: customLayoutPanel_trackWidth - customLayoutPanel with width = enclosing width
Eternal ID of this version: #1008609/5
Text MD5: 65d28eb2b7a325f928f04777d3480fba
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-25 19:14:43
Source code size: 911 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 459 / 470
Version history: 4 change(s)
Referenced in: [show references]