aspose file tools*
The moose likes Ranch Office and the fly likes help on reading textfield on 1 class from another class and using it to create a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "help on reading textfield on 1 class from another class and using it to create a file" Watch "help on reading textfield on 1 class from another class and using it to create a file" New topic
Author

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

henry kay
Greenhorn

Joined: Jun 15, 2010
Posts: 3
hi all,
[See Beginning Java thread]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to the Ranch!

[See Beginning Java thread]


"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
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

[See Beginning Java thread]


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
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

Joined: Jun 15, 2010
Posts: 3
[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

Joined: Nov 18, 2006
Posts: 174
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?


Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

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

Joined: Oct 13, 2005
Posts: 38353
    
  23
[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

Joined: Jun 15, 2010
Posts: 3
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

Joined: Jun 09, 2003
Posts: 4632
> "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

Joined: Oct 13, 2005
Posts: 38353
    
  23
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

Joined: Oct 13, 2005
Posts: 38353
    
  23
Original thread here, where discussion about the file-writing should continue, please.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38353
    
  23
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help on reading textfield on 1 class from another class and using it to create a file