• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help on reading textfield on 1 class from another class and using it to create a file

 
henry kay
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
[See Beginning Java thread]
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

[See Beginning Java thread]
 
Rob Spoor
Sheriff
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[See Beginning Java thread]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you spent more time cross-posting than you did trying to solve the problem
(google has 7 listings of your post)

this indicates to me it's not even your code

I know what the problem is, but I don't help cross-posters.
 
henry kay
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[See Beginning Java thread]
michael , i did post on multiple forum to get the maximum reply to my problem. how sure are you that it is not my code? if its not my code, why would i post code that is not working to get it working? it fine if you do not wish to help , but please to do not generalize people posting on multi forum asking for help. although i thank you for your input even though it is useless.
 
Peter Taucher
Ranch Hand
Posts: 174
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's pretty awful code. Maybe you should consider reading a good book on java swing programming, or at least some of the useful tutorials out there:
http://java.sun.com/docs/books/tutorial/uiswing/
http://faq.javaranch.com/java/SwingFaq

There're several 'problems' in your code. The specific one you're asking for is located in your ActionListener implementation 'submitNewEnroll' (you should consider following the Naming Conventions).

When you instantiate the class and add it as ActionListener for the submit button, the textfield has the default content (preallocated). You create a file on construction time of 'submitNewEnroll' and do nothing on a button click (method actionPerformed() is empty). You should read the content of your textfield in your 'actionPerfomed()' method and also create the file there. That's the whole point of using an ActionListener ... do do something in the actionPerformed() method, don't you think?
 
Rob Spoor
Sheriff
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
henry kay wrote:rob, what does SSCCE mean?

Do you see these little dots below SSCCE? That means you can click on it and a new page opens that will explain what it means.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[See Beginning Java thread]. It is discourteous to ask several people when they are unaware of one another being asked for help.

[See Beginning Java thread]

Michael Dunn may have been abrupt with you, but his complain is justified, and I think your answer to him is verging on rudeness.
 
henry kay
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter, rob and campbell

thanks for pointing and guiding me on how to go about asking and posting portion of the area that requires aid. appreciate the help given.

as for my reply to michael dunn, i do not wish to argue my reply if its appropriate or not. Just because i post my entire code out, he speculate that the code i made is not my own code? different people are good at different things. what would he feel if he encounter a problem in other field and he dun even know how to ask for help so he just post everything and someone comment at him that what he done is not his work.

if my reply to him is on the verge of rudeness, his reply "I know what the problem is, but I don't help cross-posters." sound arrogant to me with factor of mocking in it.
to me his reply sound like "you copy some code from internet and post it in so many places, rather then posting , why dun you go do your research? i know the answer to your problem but i dun help people like you."
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> "I know what the problem is, but I don't help cross-posters." sound arrogant to me with factor of mocking in it.

this is the reason why I won't post the solution:

let's say I do post the fix, what are you going to do?
you'll run the fixed code, see it works, then move on to your next problem.

what about all the other posts, people will be reading those, and some will
spend a bit of their time trying to help, which will be wasted time as
the problem had already resolved.

you can say you'd revisit all those posts with a follow-up that it had been resolved,
but I wouldn't believe that as it rarely, if ever, happens.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think at this point, I shall be obliged to transfer this thread; I shall duplicate it to the Ranch Office forum, where discussion about posting in several places should continue, please.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Original thread here, where discussion about the file-writing should continue, please.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I earlier wrote:Original thread here, where discussion about the file-writing should continue, please.
I shall delete what is relevant to file-writing; that remains in the "Beginning Java" thread.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic