• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JTable problem

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I posted this on the JFC/Swing board as well, but wanted to see if you folks on the "Advanced" board could lend some expertise. Any help is GREATLY appreciated.
I have a JTable that is the central part of a reservations program. It lists dates across the column header (each individual cell corresponds to a date), and items that can be reserved down the row header. Items can be reserved for one or more days.
This is what I am currently doing: The column header cells are populated with a custom date class that corresponds to each individual date, the row header is populated with a single-column table of item objects. When someone selects a range of cells (dates) for a specific object and clicks a "reserve" button I create a single reservation object and add it to each of the selected cells (dates).
My current problem is this: For a reservation that is more than one day long, each cell can be selected individually. I would like to have it so that any mouse click any of the cells (dates) that make up a single reservation results in all of the cells being selected. Ideally the cells would all become one cell, i.e. a seven day long reservation would result in the seven individual date cells becoming one single cell that is seven days long. I've tried this but haven't had too much luck. Any suggestions are welcome, from simple tips to suggestions of a better architecture for the entire table. Thanks.
Kevin
kevinallenbennett@yahoo.com
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You've come to the right place
Take a look at http://www2.gol.com/users/tame/swing/examples/JTableExamples4.html
It has Multi-Span cell example. Hope that solves your problem.
regards,
Raj
----------
Now will someone reply for
https://coderanch.com/t/323816/java/java/graph-editing-toolkits
 
Would anybody like some fudge? I made it an hour ago. And it goes well with a tiny ad ...
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic