J
JoeyB
All,
New to Java programming and this one has me stumped. I've got a JTable
that I've defined a DefaultCellEditor for. That works great. If the
user types the wrong thing in the JTable, it gets corrected. The
problem I have is that Ive got a subclass of ActionListener that is
responsible for pasting numbers into the JTable from the clip board.
This class is using JTable's setValueAt method. I'd like to have my
CellEditor review this data before it's allowed to set the value of my
CellEditor's JFormattedTextField but I can't find any way to call my
CellEditor procedurally. I can see that the CellEditor responds to
keyboard events but is there a way to also have it respond to user
defined events? Then, when my ActionListener derived class starts to
write data into the JTable, it could fire the event and the
DefaultCellEditor would respond to the event and verify/allow/disallow
the data. I know I could put some duplicate validation code in the
ActionListener but it seems I shouldn't have to do this (messy). I'm
sure I'm making this problem harder than it is. Any help is
appreciated.
New to Java programming and this one has me stumped. I've got a JTable
that I've defined a DefaultCellEditor for. That works great. If the
user types the wrong thing in the JTable, it gets corrected. The
problem I have is that Ive got a subclass of ActionListener that is
responsible for pasting numbers into the JTable from the clip board.
This class is using JTable's setValueAt method. I'd like to have my
CellEditor review this data before it's allowed to set the value of my
CellEditor's JFormattedTextField but I can't find any way to call my
CellEditor procedurally. I can see that the CellEditor responds to
keyboard events but is there a way to also have it respond to user
defined events? Then, when my ActionListener derived class starts to
write data into the JTable, it could fire the event and the
DefaultCellEditor would respond to the event and verify/allow/disallow
the data. I know I could put some duplicate validation code in the
ActionListener but it seems I shouldn't have to do this (messy). I'm
sure I'm making this problem harder than it is. Any help is
appreciated.