Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Implementing event listeners
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
crazy1010




PostPosted: Fri May 28, 2010 9:14 pm   Post subject: Implementing event listeners

Hi, I'm creating a database program with a GUI front-end, required for project.
Was wondering how I would get event listeners to work in the program, for button, scroll bar, and list-selection input.
Already have the UI and back-end set up.

Oh, on side note, is my read/write methods alright? Have a predefined file to write to.

Java:
public void read () throws IOException
        {
                RandomAccessFile input = new RandomAccessFile (storage, "r");
                int reps = input.readInt ();
                for (int i = 0; i < reps; i++)
                {
                        byte names[] = new byte[35];
                        input.read (names);
                        name[i] = new String (names);
                        number[i] = input.readDouble ();
                }
                input.close ();
        }

public void write () throws IOException
        {
                RandomAccessFile output = new RandomAccessFile (storage, "w");
                output.writeInt (pos);
                for (int i = 0; i < pos; i++)
                {
                        byte names[] = new byte[35];
                        names = name[i].getBytes ();
                        output.write (names);
                        output.writeDouble (number[i]);
                }
                output.close();
        }
Sponsor
Sponsor
Sponsor
sponsor
crazy1010




PostPosted: Sun May 30, 2010 9:46 am   Post subject: Re: Implementing event listeners

Just bumping this, and describing the problem a bit more.
I've looked at the Javadoc explanation of Event/Action Listeners, and it isn't very helpful at all.
Just need a working example of their use, and I'm pretty sure I could figure the rest out myself.
[Gandalf]




PostPosted: Tue Jun 01, 2010 10:23 pm   Post subject: RE:Implementing event listeners

Two important notes:
1. If you're having trouble understanding or getting the information you need from JavaDocs, the issue is often with a lack of understanding for more fundamental Java concepts (interfaces, etc.)
2. Have you tried looking for action listener examples on Google? That's about as specific help as you can get, given that you haven't shown us your GUI code or described any issues.

Your I/O code looks right.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: