Menu DEVPPL Search
159.068
MEMBERS
15.941
TOPICS
63.226
POSTS
  562
FLASH GAMES
7.717
TUTORIALS
 

Login

E-mail:
Password:

TextFields related question

0

Loading

TextFields related question

Postby Newcomer » Mon May 14, 2007 8:56 am

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
Newcomer
 
Reputation: 0
Posts: 2
Joined: Mon May 14, 2007 5:53 am
Highscores: 0
Arcade winning challenges: 0

TextFields related question - Sponsored results

Sponsored results

Login to get rid of ads

 

0

Loading

Postby Ggomez » Mon May 21, 2007 5:45 am

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)
Ggomez
 
Reputation: 0
Posts: 45
Joined: Tue Apr 17, 2007 4:30 am
Location: !!!!!MéXiCo¡¡¡¡¡¡
Highscores: 0
Arcade winning challenges: 0
0

Loading

Postby Newcomer » Mon May 21, 2007 9:56 am

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
Newcomer
 
Reputation: 0
Posts: 2
Joined: Mon May 14, 2007 5:53 am
Highscores: 0
Arcade winning challenges: 0
^ Back to Top