Re: Horizontally scrolling JTable



On Mar 28, 7:17 pm, RedGrittyBrick <redgrittybr...@xxxxxxxxxxxxx>
wrote:
I am unable to make my JTable/JScrollPane so that it gains horizontal
scrollbars when container width < JTable min width.

Any suggestions?

SSCCE
-----------------------------------8<---------------------------------
import java.awt.BorderLayout;
....
public class HorizScrollTable extends JPanel {

HorizScrollTable() {

column.setPreferredWidth(width);
column.setMinWidth(width); // [2]
}

JPanel p = new JPanel(new BorderLayout());
p.add(table, BorderLayout.CENTER); // [3]
// new ..
p.setPreferredSize( table.getPreferredSize() );
JScrollPane scrollPane = new JScrollPane( p );
.....

Andrew T.

.



Relevant Pages

  • Resizing window with Jslider, JScrollPane, JPanel and BufferedImage
    ... I have a subclass of JPanel added to the ... and if I size the window smaller than ... the image I get scrollbars. ... private ImagePanel imagePanel; ...
    (comp.lang.java.gui)
  • Re: Horizontally scrolling JTable
    ... crollbars when container width < JTable min width. ... JPanel p = new JPanel); ... JScrollPane scrollPane = new JScrollPane; ... Is it impossible to have horizontal scrolling AND headings? ...
    (comp.lang.java.gui)
  • Re: forms containers & scroll
    ... >> are added to the container. ... >> use scrollbars and define a scrollable portion of the form, ... >> will be scrolled in the 'scrollable' portion. ... > scrollbars will move this inner container as necessary. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Scrollbar sanity
    ... refresh to behave correctly during runtime. ... Okay, I'm trying to add a GUI to a program that a client specifically ... I'm trying to get the scrollbars to cooperate, ... if I put a container class on the form (with scrollbars ...
    (microsoft.public.fox.vfp.forms)
  • Scrollbar madness
    ... if I put a container class on the form (with scrollbars ... enabled) and then put a command button in the container, ... container the button is in to properly refresh after it goes offscreen, ...
    (microsoft.public.fox.vfp.forms)