aspose file tools*
The moose likes Beginning Java and the fly likes code for adding a message to message board Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "code for adding a message to message board" Watch "code for adding a message to message board" New topic
Author

code for adding a message to message board

Chris Lavery
Ranch Hand

Joined: Nov 30, 2004
Posts: 54
hi everybody,
so far i have created a GUI that shows a message board and beside it has textfields and areas for the user to enter their name, title of their message and the message itself. i also have functional quit buttons to exit the GUI and a clear button to reset all textfields and areas to having no text. my problem now is that i am trying to make an "add message" button so that once clicked the message will be displayed on the message board. as yet, i have had zero luck with this.
can anybody please suggest some code to help me out.
thanks in advance
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
Have you tried something like this?


This of course is not an entire working example. Just some lines to give you an idea. And without seeing your code it's hard to say what you need. This may be to basic for your needs.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Hentay's code is assuming the class that it is in implements the ActionListener interface. Also you would need to check the ActionEvent passed in to make sure the action that fired is from the "Add" Button.

You also want to seperate the ActionListener from the View, this is coupling the business logic to the view. But that is another discussion. The basics of what Hentay posted is what you want.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: code for adding a message to message board