Implementing event listeners
Author |
Message |
crazy1010
|
Posted: 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();
}
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
crazy1010
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
|
|