Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37334 > unrolled thread
| Started by | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| First post | 2017-08-22 11:30 -0700 |
| Last post | 2017-08-23 06:43 -0700 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.java.programmer
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
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2017-08-22 11:30 -0700 |
| Subject | How do you link JTables? |
| Message-ID | <9b053ac9-d1c4-4b66-a2b5-a88602256909@googlegroups.com> |
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.
[toc] | [next] | [standalone]
| From | j4n bur53 <janburse@fastmail.fm> |
|---|---|
| Date | 2017-08-23 15:24 +0200 |
| Message-ID | <onjvmi$a7i$1@news.albasani.net> |
| In reply to | #37334 |
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. >
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2017-08-23 06:43 -0700 |
| Message-ID | <226eed21-33cd-4d22-9893-a95f1b5c1124@googlegroups.com> |
| In reply to | #37338 |
On Wednesday, August 23, 2017 at 9:24:54 AM UTC-4, j4n bur53 wrote: > Aren there two models, the data model and the selection model? > Multiple tables, one data model, each table has it's own row selection model. If tables can share a selection model it would have to know which table for each selection processed. By default if I just assign one selection model to 2 tables they're linked as user clicking row 1 on one table displays row 1 selected on the other. I want them linked to say that table 1 displays 2 rows and pressing down arrow while the second row is selected deselects it and selects the first row on the second table. Assuming that's a no, we can't do attachments on this list, I'll just host one. Here's a link to a runnable sample. https://drive.google.com/open?id=0B2v-yhJD9tS7TS0wNkY2bmpDOVU
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web