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

17
LINES

< > BotCompany Repo | #1020092 // scrollable_trackHeight

JavaX fragment (include)

static JPanel scrollable_trackHeight(final Component component) {
  class P extends SingleComponentPanel implements Scrollable {
    *() { super(component); }
    
    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() { false; }
    public boolean getScrollableTracksViewportHeight() { true; }
  }
  ret swing(func -> P { new P });
}

Author comment

Began life as a copy of #1014106

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020092
Snippet name: scrollable_trackHeight
Eternal ID of this version: #1020092/1
Text MD5: 46774a54f3984f361112a55350a43fcc
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-07 01:23:33
Source code size: 754 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 237 / 267
Referenced in: [show references]