• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
[See Beginning Java thread]
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

[See Beginning Java thread]
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[See Beginning Java thread]
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Original thread here, where discussion about the file-writing should continue, please.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic