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

13
LINES

< > BotCompany Repo | #1015363 // jWiderScrollPane - includes space for vertical scrollbar on pack()

JavaX fragment (include)

static JScrollPane jWiderScrollPane(final JComponent c) {
  ret swing(func -> JScrollPane { ret new JScrollPane(c) {
    public Dimension getPreferredSize() {
      Component view = getViewport().getView();
      if (view == null) ret super.getPreferredSize();
      int pref_height = view.getPreferredSize().height;
      setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
      Dimension dim = new(super.getPreferredSize().width + getHorizontalScrollBar().getSize().width, pref_height);
      setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
      ret dim;
    }
  }; });
}

Author comment

Began life as a copy of #1015089

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: #1015363
Snippet name: jWiderScrollPane - includes space for vertical scrollbar on pack()
Eternal ID of this version: #1015363/1
Text MD5: c60888706ca36f0f8d16b77946df25c1
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-13 13:21:41
Source code size: 624 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 348 / 393
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)