Results 1 to 1 of 1
- 03-21-2011, 02:42 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 1
- Rep Power
- 0
JScrollPane and GridBagLayout combination
Hi,
I'm developing a planner-like application, and on the road to make it comply with the requirements given, I've been stuck on a problem for a while.
I need to make a UI that has the weekdays on top, the hours to the left and columns under each day in the middle. I need to be able to insert events into these columns that can stretch several hours and also be able to show events that happen at the same hour.
I was thinking I could use GridBagLayout with the hours to the left downwards, with gridx=0 and y incrementing from 1, column headers along the top with y=0 and x incrementing from 1 with each column with events stretching underneath to the bottom (see screenshot).

I would like the weekdays to stay stationary when I scroll. Is it possible?
I've tried JTable to mimic this behaviour, but straight off the bat with JTable, I can't add several events next to each other on the same hour and day. I've also tried JTable with a JPanel as a custom TableCellRenderer, so that I can add items to this and thus have several events, but that solution won't be able to stretch across cells, which I need if an event is longer than 1 hour.
When I tried to have the column headers as a separate JPanel and have it as a ColumnHeaderView in a JScrollPane, I was unable to align the columns below the headers with the headers, and also the hours were not aligned correctly to the left.
So, do you have any ideas on how to solve this in another way or any tips on how to either a): set the headers stationary when I scroll or b): align the headers with the columns, so that I can use them as a ColumnHeaderView?
Regards,
Lars
Similar Threads
-
how creat linear combination of object
By ahmed80 in forum New To JavaReplies: 2Last Post: 01-07-2011, 11:29 AM -
random linear combination of packet
By bhatti in forum NetworkingReplies: 0Last Post: 12-22-2010, 03:46 PM -
JWindow closes after a particular key combination
By chyrl in forum AWT / SwingReplies: 9Last Post: 05-05-2010, 04:33 PM -
Key combination
By dejos456 in forum New To JavaReplies: 9Last Post: 11-30-2009, 07:11 AM -
COMBINATION TEXT..help me..urgent
By conv_bay in forum New To JavaReplies: 10Last Post: 04-27-2009, 11:34 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks