• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SetRowSelecionInterval doesn't swing into action

 
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what happens instead?

Is PatientParticularsDialog modal?
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic