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


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

Re: How do you link JTables?

From j4n bur53 <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject Re: How do you link JTables?
Date 2017-08-23 15:24 +0200
Organization albasani.net
Message-ID <onjvmi$a7i$1@news.albasani.net> (permalink)
References <9b053ac9-d1c4-4b66-a2b5-a88602256909@googlegroups.com>

Show all headers | View raw


Aren there two models, the data model and the selection model?

Eric Douglas schrieb:
> I wrote a standalone sample (can we attach files here? it's 400+ lines).
> It's 2 JTables which share the same data model.  One shows the first few rows, the other shows the rest of the rows.
> Now I'm having some trouble figuring out how to share the selection model.
> I'd like to be able to set them as one table, so I can set single row selection, if you select a row in one table it deselects the other table.
> I'd like to have them as connected tables, so you can arrow up from the top row of the second table to select the bottom row of the first, and arrow down from the first to select the second.
> I do this through the row selection model?  Each table has it's own selection model linked to the other, or they somehow share one?
> They can't use the same selection model without some customization, or selecting the first row in one automatically highlights the first row in the other.
> From what I can tell I need to override moveLeadSelectionIndex, and possibly setLeadSelectionIndex.
>

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


Thread

How do you link JTables? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-22 11:30 -0700
  Re: How do you link JTables? j4n bur53 <janburse@fastmail.fm> - 2017-08-23 15:24 +0200
    Re: How do you link JTables? Eric Douglas <e.d.programmer@gmail.com> - 2017-08-23 06:43 -0700

csiph-web