Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-09-2009, 04:09 AM
Member
 
Join Date: Dec 2008
Posts: 11
Rep Power: 0
simo_mon is on a distinguished road
Default [SOLVED] event handling :backend and front end seperation
hi there i have a conceptual question...

i have a gui, which reads keystroke events attached to a textfield

ie
Code:
  class Myclass extends JFrame implements ActionListener,KeyListener {

   constructor....

   public void keyPressed(KeyEvent e) 
   {
	System.out.println(" a key has been pressed ");
	System.out.println(" a key code "+e.getKeyCode());
	System.out.println(" a key char  "+e.getKeyChar());
   }

}
no i am trying to keep a seperation between the gui and the backend... so the backend will store and adjust the data ...

ie
Code:
    class back{
    
    private int total =;

    constructor...

    get/set total();
my question is can i link the adjustment of the total in the back class, everytime a keystroke is fired in the gui...?

is it that i add a listener to the back class???

the whole idea being here to keep a logical and functional seperation between the gui and the data manipulation part....

thanks
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 01-09-2009, 04:18 AM
Fubarable's Avatar
Moderator
 
Join Date: Jun 2008
Posts: 3,195
Rep Power: 5
Fubarable is on a distinguished road
Default
Listeners could work great here. Perhaps you need a 3-part program: View and Model as you have, and also a Control to handle the actions.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 02-04-2009, 02:11 AM
Member
 
Join Date: Dec 2008
Posts: 11
Rep Power: 0
simo_mon is on a distinguished road
Default
wow.... thanks Fubarable ..... that was some code explosion !!!!!!
the listeners were the missing link !!!!!!! Went off and added the keylisteners to the backend, passed a ref to the front and viola !!!!

awesome prompt !!!!!! thanks vry much
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
seperation of file contents Ms.Ranjan New To Java 5 07-11-2008 09:17 PM
SWT Event Handling Java Tip Java Tips 0 12-30-2007 12:21 PM
Combo Box Event handling smajidali26 AWT / Swing 1 11-29-2007 05:57 PM
problem with event handling!!! ahdus Java Applets 1 11-17-2007 06:24 PM
Event Handling luisarca Sun Java Wireless Toolkit 5 05-07-2007 06:05 PM


All times are GMT +2. The time now is 03:50 AM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org