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

13
LINES

< > BotCompany Repo | #1015089 // jHigherScrollPane - includes space for horizontal scrollbar on pack()

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9167L/51K).

1  
static JScrollPane jHigherScrollPane(final JComponent c) {
2  
  ret swing(-> new JScrollPane(c) {
3  
    public Dimension getPreferredSize() {
4  
      Component view = getViewport().getView();
5  
      if (view == null) ret super.getPreferredSize();
6  
      int pref_width = view.getPreferredSize().width;
7  
      setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
8  
      Dimension dim = new(pref_width, super.getPreferredSize().height + getHorizontalScrollBar().getSize().height);
9  
      setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
10  
      ret dim;
11  
    }
12  
  });
13  
}

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: #1015089
Snippet name: jHigherScrollPane - includes space for horizontal scrollbar on pack()
Eternal ID of this version: #1015089/3
Text MD5: fba5337a3a9c98e583df36fd8785f33d
Transpilation MD5: b5c94673a851a4b1fe1b9e89694f3360
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-17 21:53:48
Source code size: 606 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 448 / 540
Version history: 2 change(s)
Referenced in: [show references]