| Author |
passine event from one form to other gui form
|
Sun Il Kumar
Greenhorn
Joined: Mar 02, 2011
Posts: 5
|
|
if( yes == can we pass or call an event of one form from another form) {
can you give me an examole to call a button_click event of the one gui form from another form;
}
else {
any other logic to same;
}
i am just a beginner.............please help me out
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
Welcome to the Ranch!
It sounds like you might be talking about JavaScript rather than Java. Can you give us more details about exactly what you want to do?
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
Sun Il Kumar
Greenhorn
Joined: Mar 02, 2011
Posts: 5
|
|
yes
like........We have a buttton ButttonMain in parent form and ButtonChild in child form. I want to call the event ButtonChild_click of ButtonChild from ButtonMain of main form In java not in java script
can it is possible..........if yes then give me an example...........if not can we perform this functionality from any other way to call a form event from other form in java
SKM
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3791
|
|
There are a few ways you could manage this.
1. If you can make the JButton (I assume you're using JButtons) on one form available to the other form you can call the doClick() method of that button to simulate it being clicked.
2. You could add the same ActionListener to both buttons.
3. You could define a method on one of the forms, and have the actionPerformed method of the two ActionListeners call it.
So the first approach makes one button fake a button click on the other, and the other two make the two buttons have the same effect. Either way, one of the forms will need a reference to the other. Here's a simplified example (using option 1):
|
 |
Sun Il Kumar
Greenhorn
Joined: Mar 02, 2011
Posts: 5
|
|
thanks sir, Matthew Browns
I was making a project .............and need this functionality .......thanks so much sir.
|
 |
 |
|
|
subject: passine event from one form to other gui form
|
|
|