aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes SetRowSelecionInterval doesn't swing into action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SetRowSelecionInterval doesn Watch "SetRowSelecionInterval doesn New topic
Author

SetRowSelecionInterval doesn't swing into action

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
[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

Joined: Oct 31, 2011
Posts: 498

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?


PM Me If You Want to get Urgent Help on Java Programming
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
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

Joined: May 03, 2008
Posts: 4638
    
    5

And what happens instead?

Is PatientParticularsDialog modal?


luck, db
There are no new questions, but there may be new answers.
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
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

Joined: Oct 16, 2003
Posts: 1085
    
  10

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.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
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

Joined: May 03, 2008
Posts: 4638
    
    5

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

Joined: Aug 02, 2012
Posts: 601
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

Joined: May 03, 2008
Posts: 4638
    
    5

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

Joined: Aug 02, 2012
Posts: 601
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SetRowSelecionInterval doesn't swing into action