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).

static JScrollPane jHigherScrollPane(final JComponent c) {
  ret swing(-> new JScrollPane(c) {
    public Dimension getPreferredSize() {
      Component view = getViewport().getView();
      if (view == null) ret super.getPreferredSize();
      int pref_width = view.getPreferredSize().width;
      setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
      Dimension dim = new(pref_width, super.getPreferredSize().height + getHorizontalScrollBar().getSize().height);
      setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      ret dim;
    }
  });
}

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: 449 / 541
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1015363 - jWiderScrollPane - includes space for vertical scrollbar on pack()
#1034090 - jBorderlessHigherScrollPane
#1035954 - jHigherScrollPane_borderless_center - includes space for horizontal scrollbar on pack()