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)

// layouter: voidfunc(Container) or func(Container) -> Dimension
// (return value is preferred size)
static JPanel customLayoutPanel_trackWidth(fO layouter) {
  class P extends JPanel implements Scrollable {
    *() { super(layoutManagerFromFunction(layouter)); }
    
    @Override
    public Dimension getPreferredScrollableViewportSize() { ret getPreferredSize(); }
    @Override
    public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { return 20; }

    @Override
    public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
      ret (direction == SwingConstants.HORIZONTAL ? visibleRect.width : visibleRect.height)*5/6;
    }

    @Override
    public bool getScrollableTracksViewportWidth() { true; }

    @Override
    public boolean getScrollableTracksViewportHeight() { false; }
  }
  ret new P;
}

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: 456 / 466
Version history: 4 change(s)
Referenced in: [show references]