PDA

View Full Version : Java/Swing Issues




Wes
Aug 4, 2004, 02:43 PM
A little background before I get to the point.

I'm in the IB (International Baccalaureate) which is like the AP system in American, or A-levels in England.

Each student is required to write one 3,500-4000 word essay to get their diploma. Periodically throughout the year the administration want to see the progress made on this essay. What follows is usually mass confusion and it's a pain to get your essay back. They often got lost, including my two last submission.

In my computer class I set out to fix this issue by making all the submissions online. It'll be great when it's done and it's almost there. What you're seeing now is the administration's side of the program. Included in a Pre-compiled double-clickable jar and the source code. The program allows the administration to see the student's essays and leave comments. There will be two ways of going through the students, the forward/back button and the drop down menu, both currently in the program. Here is where you guys come in. Independently these work, but when when using the forward and back buttons the drop down menu does not update. I have spent much of today working on this. If you could do this you'd be FIRST on my list to get a gmail invite (when I next get the option) or you would atleast have my eternal gratitude.

Thanks! Any questions, post 'em here!

http://wesley.wsgurus.com/JavaIssues.zip



slughead
Aug 4, 2004, 02:49 PM
oh pre-compiled version eh? and you want your school to use this to grade your paper with?

hrm... ;)

Wes
Aug 4, 2004, 02:55 PM
Don't worry, security will be upped as soon as it is all functional ;). And it's not grading AT all, just leaving comments on progress.

King Cobra
Aug 4, 2004, 03:01 PM
I can't get passed testDriver() because of the exception (caught) java.lang.ClassNotFoundException. Am I missing something?

Wes
Aug 4, 2004, 03:19 PM
You need to define mysql.jar (or mysql-connector-java-3.0.14-production-bin.jar same file, just renamed) in the classpath. Thanks for trying it out!

EDIT: I hope you're compiling that yourself, the pre-compiled jar shouldn't have those issues.

slughead
Aug 4, 2004, 03:21 PM
Uh.

In java, you have to re-run the constructor after you update something in the UI

I *think* this will work.. I can't get XCode to compile so just replace the back and forward action listeners with this:

public class Forward implements ActionListener {
public void actionPerformed(ActionEvent event) {
collectguidata();

try {
Statement s = conn.createStatement();
ResultSet rs = s
.executeQuery("select min(student_id) as next_student_id from essays where student_id >"
+ student_id);
// rs.next();
if (!rs.next() || rs.getInt("next_student_id") == 0) {
rs = s
.executeQuery("select min(student_id) as min from essays");
rs.next();
student_id = rs.getInt("min");
} else {
student_id = rs.getInt("next_student_id");
}

} catch (SQLException e) {
System.err.println(e.getMessage());
System.out.println("Error Increasing Student ID");

}
collectdbdata();

updatenameloader();
ComboBox.setSelectedItem(nameloader);
Viewer();

}

}


public class Back implements ActionListener {
public void actionPerformed(ActionEvent event) {
collectguidata();
try {
Statement s = conn.createStatement();
ResultSet rs = s
.executeQuery("select min(student_id) as previous_student_id from essays where student_id <"
+ student_id);
// rs.next();
if (!rs.next() || rs.getInt("previous_student_id") == 0) {
rs = s
.executeQuery("select max(student_id) as max from essays");
rs.next();
student_id = rs.getInt("max");
} else {
student_id = rs.getInt("previous_student_id");
}

} catch (SQLException e) {
System.err.println(e.getMessage());
System.out.println("Error Decreasing Student ID");

}
collectdbdata();
updatenameloader();
ComboBox.setSelectedItem(nameloader);
Viewer();


}

}

Wes
Aug 4, 2004, 03:26 PM
Not working:


The method Viewer() is undefined for the type Viewer.Back
The method Viewer() is undefined for the type Viewer.Forward

slughead
Aug 4, 2004, 03:30 PM
Not working:


The method Viewer() is undefined for the type Viewer.Back
The method Viewer() is undefined for the type Viewer.Forward

oh right, right right


replace Viewer with Super.Viewer() .. (is that right?)

I know you have to run the display parts again, I'm not sure if viewer will override the existing settings or not...

slughead
Aug 4, 2004, 03:31 PM
and by the way, how the hell do you get xcode to compile java??

The build menu is all disabled

hariprasad787
Oct 23, 2008, 06:05 AM
Hi,

I have developed an application using netbeans(Swing) on windows platform.
It is working fine. But when I try to run the same application on macintosh platform. But the application window doesn't appear properly. Menus and other parts are not visible. Only when the mouse cursor is moved over the menus, thumbnails viewer etc.... these things starts to appear on the application window.

Can anyone sugggest me the reason for this issue and things to be done to fix this issue?


Regards,
Hariprasad