Java/Swing Issues

Discussion in 'Mac Apps and Mac App Store' started by Wes, Aug 4, 2004.

  1. Wes macrumors 68020

    Wes

    Joined:
    Jun 22, 2001
    Location:
    London
    #1
    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
     
  2. slughead macrumors 68030

    slughead

    Joined:
    Apr 28, 2004
    #2
    oh pre-compiled version eh? and you want your school to use this to grade your paper with?

    hrm... ;)
     
  3. Wes thread starter macrumors 68020

    Wes

    Joined:
    Jun 22, 2001
    Location:
    London
    #3
    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.
     
  4. King Cobra macrumors 603

    Joined:
    Mar 2, 2002
    #4
    I can't get passed testDriver() because of the exception (caught) java.lang.ClassNotFoundException. Am I missing something?
     
  5. Wes thread starter macrumors 68020

    Wes

    Joined:
    Jun 22, 2001
    Location:
    London
    #5
    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.
     
  6. slughead macrumors 68030

    slughead

    Joined:
    Apr 28, 2004
    #6
    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:

    Code:
    	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();
    
    
    		}
    
    	}
     
  7. Wes thread starter macrumors 68020

    Wes

    Joined:
    Jun 22, 2001
    Location:
    London
    #7
    Not working:


    The method Viewer() is undefined for the type Viewer.Back
    The method Viewer() is undefined for the type Viewer.Forward
     
  8. slughead macrumors 68030

    slughead

    Joined:
    Apr 28, 2004
    #8
    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...
     
  9. slughead macrumors 68030

    slughead

    Joined:
    Apr 28, 2004
    #9
    and by the way, how the hell do you get xcode to compile java??

    The build menu is all disabled
     
  10. hariprasad787 macrumors newbie

    Joined:
    Oct 23, 2008
    #10
    Problem with java swing

    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
     

Share This Page