File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion 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

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

Joined: Feb 05, 2001
Posts: 17276

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.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: code for adding a message to message board
jQuery in Action, 3rd edition