Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #24194

Re: Code Included: Freeze column

From "John B. Matthews" <nospam@nospam.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Code Included: Freeze column
Date 2013-05-29 16:29 -0400
Organization The Wasteland
Message-ID <nospam-D730B4.16293729052013@news.aioe.org> (permalink)
References <566ff119-faa8-4116-9761-65002a3c1cb3@w8g2000yqf.googlegroups.com>

Show all headers | View raw


In article 
<566ff119-faa8-4116-9761-65002a3c1cb3@w8g2000yqf.googlegroups.com>,
 Haircuts Are Important <clusardi2k@aol.com> wrote:

> Basically, I have been unable to get the the 2 tables to scroll 
> vertically together etc.

Your example using a shared model seems to do exactly this.

> Second below, if I change the dimension of either JScrollPane it 
> changes the second one. So, the result is I either get a large left 
> JScrollPane or a small right JScrollPane.

JTable implements Scrollable; you can override the method
getPreferredScrollableViewportSize() to make table A narrower:

final JTable table = new JTable(model) {
    @Override
    public Dimension getPreferredScrollableViewportSize() {
        Dimension d = super.getPreferredScrollableViewportSize();
        return new Dimension(d.width / 2, d.height);
    }
};

> I'd also like to remove any spacing between these 2 tables.

The space comes from the default FlowLayout; try this:

JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));

> Third, I also tried to put each table into a separate JPanel and put 
> all this into a JScrollPane, but it (appeared to) yield the same 
> results as the second thing I tried.

I don't understand.

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-05-29 12:55 -0700
  Re: Code Included: Freeze column "John B. Matthews" <nospam@nospam.invalid> - 2013-05-29 16:29 -0400
    Re: Code Included: Freeze column clusardi2k@aol.com - 2013-05-29 23:53 -0700
      Re: Code Included: Freeze column "John B. Matthews" <nospam@nospam.invalid> - 2013-05-30 21:40 -0400
        Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-05-31 11:19 -0700
          Re: Code Included: Freeze column "John B. Matthews" <nospam@nospam.invalid> - 2013-05-31 23:59 -0400
            Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-06-03 10:18 -0700
              Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-06-03 12:48 -0700
              Re: Code Included: Freeze column "John B. Matthews" <nospam@nospam.invalid> - 2013-06-03 23:03 -0400
                Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-06-04 05:05 -0700
                Re: Code Included: Freeze column "John B. Matthews" <nospam@nospam.invalid> - 2013-06-04 23:04 -0400
                Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-06-05 11:53 -0700
                Re: Code Included: Freeze column "John B. Matthews" <nospam@nospam.invalid> - 2013-06-05 16:02 -0400
                Re: Code Included: Freeze column Lew <lewbloch@gmail.com> - 2013-06-05 13:09 -0700
                Re: Code Included: Freeze column clusardi2k@aol.com - 2013-06-05 16:27 -0700
                Re: Code Included: Freeze column Lew <lewbloch@gmail.com> - 2013-06-05 17:35 -0700
                Re: Code Included: Freeze column "John B. Matthews" <nospam@nospam.invalid> - 2013-06-06 21:42 -0400
                Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-06-10 09:34 -0700
                Re: Code Included: Freeze column "John B. Matthews" <nospam@nospam.invalid> - 2013-06-10 13:49 -0400
                Re: Code Included: Freeze column Lew <lewbloch@gmail.com> - 2013-06-04 12:17 -0700
                Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-06-04 12:54 -0700
                Re: Code Included: Freeze column Lew <lewbloch@gmail.com> - 2013-06-04 14:17 -0700
                Re: Code Included: Freeze column Joerg Meier <joergmmeier@arcor.de> - 2013-06-05 00:12 +0200
                Re: Code Included: Freeze column "John B. Matthews" <nospam@nospam.invalid> - 2013-06-04 21:39 -0400
                Re: Code Included: Freeze column Lew <lewbloch@gmail.com> - 2013-06-04 19:48 -0700
                Re: Code Included: Freeze column Joerg Meier <joergmmeier@arcor.de> - 2013-06-05 07:36 +0200
                Re: Code Included: Freeze column Lew <lewbloch@gmail.com> - 2013-06-04 22:46 -0700
        Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-05-31 11:35 -0700
          Re: Code Included: Freeze column Lew <lewbloch@gmail.com> - 2013-05-31 11:43 -0700
            Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-05-31 11:50 -0700
              Re: Code Included: Freeze column Lew <lewbloch@gmail.com> - 2013-05-31 12:37 -0700
                Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-05-31 12:44 -0700
          Re: Code Included: Freeze column Haircuts Are Important <clusardi2k@aol.com> - 2013-05-31 12:30 -0700

csiph-web