• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mr. Gray

 
aadhi agathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when would i be graying a GUI widget.i can think of the following:
1) when a search/ book action is processed i may need the controll
to be grayed out. but what is the need i don't know, once the user
pressed the book/search button he will simply wait.(means can't
activate the button).

2)if the user doesnt select a record, then the reserver seats text
box can be grayed out. but what if i am making there will be always
a record selected using ListSelectionModel.SINGLE_SELECTION. it takes
a default as first row and remains with a single selected row, always!!

3) when the reserve seats textbox is empty , then the book button
needs to be graqyed out/disabled.


what will be the best approach for all these . does it press for a
mediator pattern. if i am taking some approach of graying out things.
then a lot of events needs to be captured and say a key press event
in the textbox, then figure it is not empty and activate the corresponding
widget. in simple, is it worth doing this graying thing.

all comments appreciated. please help!
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ListSelectionListener and FocusListeners can be added to find out when a record is selected in the JTable, and when focus leaves the JTextField for seats.
Then in your controller you handle enabling and disabling them accordingly.
Mark
 
aadhi agathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh Thanks Mark, i believe the Controller acts as the Mediator too.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic