Java Usage of MouseListener and MouseMotionListnener #1

It took me forever to understand why I couldn't define simple functions in files on the same subdirectory (obviating classpath problems), and get them to understand each other.
Here is a simple attempt at doing this inside the IDE. I created MC_test as a JFrame as usual, and then created (below) a simple class called Functions. Inside Functions, I created a Max(i,j) function as a test. What you see below is the composite which finally worked.
/*
 * MC_test.java
 *
 * Created on September 5, 2003, 2:23 PM
 */

/**
 *
 * @author  Administrator
 */
public class MC_test extends javax.swing.JFrame {
    
    /** Creates new form MC_test */
    public MC_test() {
        initComponents();
        
        
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });
        
        pack();
    }//GEN-END:initComponents
    
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        System.exit(0);
    }//GEN-LAST:event_exitForm
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        new MC_test().show();
        int t = Functions.Max(3,4);
        System.out.println("t = "+t);
    }
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
    
    
}
Here is Functions, which had to be adjusted after the fact to the line 
public static int Max ... since without the static you get an error.
But, then, finally, it works!
/*
 * Functions.java
 *
 * Created on September 5, 2003, 2:24 PM
 */

/**
 *
 * @author  Administrator
 */
public class Functions {
    
    /** Creates a new instance of Functions */
    public Functions() {
        
    }
    public static int Max(int x, int y){
        if(x>y) return x; else return y;
    }
    
}

Return to the main book TOC.