Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to clear text box in Multi Screen JFrame GUI Application

 
harsh rocking
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am working with a Swing GUI project where I want to accept user input in a
text field
I have used singleton pattern which will create only one instance of object
due to this when i move from one scree to another the input of textfield
doesnt updated I have used setText method to clear the JTextField but it wont
works
I have attached the code here which consists of two files
Program one -- 1st screen



program 2 - 2nd screen


In this application the status of TextField input remain same means it shows
the earlier input in the textfield wnen I come to earlier or next screen.
what is the solution to clear the TextField input while moving from 1st
scrren to 2nd screen.
 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch,

Please UseCodeTags to make your code easier to read.
 
Maneesh Godbole
Saloon Keeper
Posts: 11196
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are adding an action listener to the button inside one action listener.
So who calls the first action listener? If the action listener is never called, do you think the setText("") would ever be executed?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is the only thing the current crop of greenhorns know how to do well is to cross-post?
is it part of the training?

http://forums.sun.com/thread.jspa?threadID=5437051&tstart=0

recently, just about every first-time poster posts all over the place.

very frustrating, getting close to being a total waste of time trying to help these people

[edit]

but wait, there's more

http://www.java-forums.org/awt-swing/28193-unable-clear-text-field-multi-screen-jframe-gui-application.html
 
Maneesh Godbole
Saloon Keeper
Posts: 11196
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
harsh rocking
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Michael I Think These site managed separately by different groups.
I am really sorry for cross posting.
Please help in the above situation.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Please help in the above situation.

posting everywhere indicates my time is unimportant to you,
therefore you getting a solution is equally unimportant to me.
 
harsh rocking
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> Please help in the above situation.

posting everywhere indicates my time is unimportant to you,
therefore you getting a solution is equally unimportant to me.


I am sorry I am new to all these forums I don't know about the multiple posting
I will follow the code of conducts here on Michael.
Please share your knowledge with me. I am working on this code on last few
days but I am unable to solve this. Please help me your time is very important for me.
I am sorry..
 
Maneesh Godbole
Saloon Keeper
Posts: 11196
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you read my previous reply?
 
harsh rocking
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Did you read my previous reply?

Please help me I am novice to the Swing
the application might needs to use observer design pattern I think
I am also tried it but it wont work. I had worj on above code lot.
Please help me
 
Maneesh Godbole
Saloon Keeper
Posts: 11196
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are not willing to answer even simple questions like "did you read my previous reply" I do not see how else to further help you.
 
harsh rocking
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Since you are not willing to answer even simple questions like "did you read my previous reply" I do not see how else to further help you.


Yes I have read your earlier post and go through the link you have posted their.

As you say setText("") is executing properly but it is unable to clear the TextField in the GUI
The above application is working properly and is response to the button action very well
the problem is that I have used singleton design pattern which create only one object
of the Class if I doesn't use singleton then it works properly but that is bad coding as it create new object
each time. So in singleton approach their is single object which is unable to update the state next time
when i call setText("") function to clear the textField
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic