Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SetRowSelecionInterval doesn't swing into action

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[cod

The event handler is triggered after the menu item clicked, it would return the row selected on part.getSelectedRow(); I've tested that. It is okay.
But setRowSeelctionInterval doesn't swing into action. Why is that?
Thanks
Jack
 
Nam Ha Minh
Ranch Hand
Posts: 504
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jacky Luk wrote:
The event handler is triggered after the menu item clicked, it would return the row selected on part.getSelectedRow(); I've tested that. It is okay.
But setRowSeelctionInterval doesn't swing into action. Why is that?
Thanks
Jack


First, what do you expect when using the setRowSelectionInterval() method?
What did the program behave exactly?
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nam Ha Minh wrote:
Jacky Luk wrote:
The event handler is triggered after the menu item clicked, it would return the row selected on part.getSelectedRow(); I've tested that. It is okay.
But setRowSeelctionInterval doesn't swing into action. Why is that?
Thanks
Jack


First, what do you expect when using the setRowSelectionInterval() method?
What did the program behave exactly?


Hi, Nam.
I expect the main screen to select the same row as the one I chose from the "findPatient" Dialog
Thanks
Jack
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what happens instead?

Is PatientParticularsDialog modal?
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:And what happens instead?

Is PatientParticularsDialog modal?


It stays the same as before I enter the screen.
yes, the dialog is modal.
Thanks
Jack
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jacky Luk wrote:yes, the dialog is modal.

In that case, the statement setRowSelectionInterval will be executed only after you close the dialog. Move that statement before you make the dialog visible and see what happens.
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranganathan Kaliyur Mannar wrote:
Jacky Luk wrote:yes, the dialog is modal.

In that case, the statement setRowSelectionInterval will be executed only after you close the dialog. Move that statement before you make the dialog visible and see what happens.



It still doesn't select the row I want.
Thanks
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranganathan Kaliyur Mannar wrote:
Jacky Luk wrote:yes, the dialog is modal.

In that case, the statement setRowSelectionInterval will be executed only after you close the dialog.

Which is the right time for it to be executed.

Jacky, this is going nowhere. To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates the problem. Keep it short and relevant.
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:
Ranganathan Kaliyur Mannar wrote:
Jacky Luk wrote:yes, the dialog is modal.

In that case, the statement setRowSelectionInterval will be executed only after you close the dialog.

Which is the right time for it to be executed.

Jacky, this is going nowhere. To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates the problem. Keep it short and relevant.


I don't know how. But somehow I got it working. Thanks
But One more question for you, is that how do you simulate a mouse click event?
Say my mouse listener is added thru addMouseListener method, I want when the dialog returns, it simulates a click on the mouse so that the
corresponding record is selected for my form. I can't call it by method name since it is not on the same "level" as the JFrame window
Any ideas?
Thanks
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write a method that can be called either from the MouseListener or from elsewhere.

And if your outer class extends JFrame, that's almost certainly a misuse of inheritance (although, unfortunately, that's the style in most tutorials).
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:Write a method that can be called either from the MouseListener or from elsewhere.

And if your outer class extends JFrame, that's almost certainly a misuse of inheritance (although, unfortunately, that's the style in most tutorials).


Okay, I wrapped the the whole bunch of "actions" into a method and call it from 2 places.
Thanks
Jack
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic