| You are here: DEVPPL ‹ Forum ‹ Programming ‹ Java Forum |
NOTIFICATIONS
|
|
|||||||||||||||
Login |
TextFields related question
3 posts
• Page 1 of 1
0
TextFields related question
Hello
I m new to java world. I have a problem with GUI.
I have two classes class Main and class winframe .WinFrame class extends JFRAME and there are two instance variable in winframe class with two textfields.
i instanciate the winframe class in Main class. and call show() method of winframe class.
Can anybody please explain how can i get the value of textfields of WINFRAME class in Main class.
Thank you
I m new to java world. I have a problem with GUI.
I have two classes class Main and class winframe .WinFrame class extends JFRAME and there are two instance variable in winframe class with two textfields.
i instanciate the winframe class in Main class. and call show() method of winframe class.
Can anybody please explain how can i get the value of textfields of WINFRAME class in Main class.
Thank you
- Newcomer
- Reputation: 0
- Posts: 2
- Joined: Mon May 14, 2007 5:53 am
- Highscores: 0
- Arcade winning challenges: 0
0
if you have the instance in Main class, you can put some usefull methods in the winframe class so you can use it in Main class.
something like setTextFielValue(Object o)
something like setTextFielValue(Object o)
- Ggomez
- Reputation: 0
- Posts: 45
- Joined: Tue Apr 17, 2007 4:30 am
- Location: !!!!!MéXiCo¡¡¡¡¡¡
- Highscores: 0
- Arcade winning challenges: 0
0
I tried this but problem is where should i use that method. I tried this as below
// method in Main class to instanciate WinFrame class
public void showWin()
{
WinFrame wn = new WinFrame()
wn.setVisible(true) ;
wn.setTextFielValue( this )
println( first text ) ;
println( second text) ;
}
but the problem is program pointer immediately call setTextFieldValue after calling setVisible method. so the both the text variable remain null when i try to print them. It should wait untill i put some texts into both the textfield of WinFrame class and any OK button then Main should call the setText method so that it can return some value.
Can anybody please help me with this
// method in Main class to instanciate WinFrame class
public void showWin()
{
WinFrame wn = new WinFrame()
wn.setVisible(true) ;
wn.setTextFielValue( this )
println( first text ) ;
println( second text) ;
}
but the problem is program pointer immediately call setTextFieldValue after calling setVisible method. so the both the text variable remain null when i try to print them. It should wait untill i put some texts into both the textfield of WinFrame class and any OK button then Main should call the setText method so that it can return some value.
Can anybody please help me with this
- Newcomer
- Reputation: 0
- Posts: 2
- Joined: Mon May 14, 2007 5:53 am
- Highscores: 0
- Arcade winning challenges: 0
|
|