Main/Clicker.java
// This handles the button actions (Controller)
This handles the button actions (Controller)
This handles the button actions ( Controller )
public void actionPerformed(ActionEvent e){
        if(e.getActionCommand() != null){
            String action = e.getActionCommand();
            System.out.println(action);
            if(action.equals("Quit")){
                System.exit(0);
            }else if(action.equals("Auto")){
                togCount();
            }else if(action.equals("Reset")){
                setCount(0);
                textArea.setText("Text");
            }else if(action.equals("Gain")){
                int i = list.getSelectedIndex();
                if(i==1){
                    setCount(getCount()+10);
                }else if(i==2){
                    setCount(getCount()+100);
                }else if(i==3){
                    setCount(getCount()+1000);
                }else if(i==5){
                    setCount(getCount()-1);
                }else if(i==6){
                    setCount(getCount()-10);
                }else if(i==7){
                    setCount(getCount()-100);
                }else if(i==8){
                    setCount(getCount()-1000);
                }else{
                    setCount(getCount()+1);
                }
            }else if(action.equals("Save File 1")){
                accessFile("save","save1");
            }else if(action.equals("Save File 2")){
                accessFile("save","save2");
            }else if(action.equals("Load File 1")){
                accessFile("load","save1");
            }else if(action.equals("Load File 2")){
                accessFile("load","save2");
            }
        }
        if (autoCounter){
            setCount(getCount()+1);
        }
        update();
    }
public void actionPerformed ( ActionEvent e ) { if ( e . getActionCommand ( ) != null ) { String action = e . getActionCommand ( ) ; System . out . println ( action ) ; if ( action . equals ( "Quit" ) ) { System . exit ( 0 ) ; } else if ( action . equals ( "Auto" ) ) { togCount ( ) ; } else if ( action . equals ( "Reset" ) ) { setCount ( 0 ) ; textArea . setText ( "Text" ) ; } else if ( action . equals ( "Gain" ) ) { int i = list . getSelectedIndex ( ) ; if ( i == 1 ) { setCount ( getCount ( ) + 10 ) ; } else if ( i == 2 ) { setCount ( getCount ( ) + 100 ) ; } else if ( i == 3 ) { setCount ( getCount ( ) + 1000 ) ; } else if ( i == 5 ) { setCount ( getCount ( ) - 1 ) ; } else if ( i == 6 ) { setCount ( getCount ( ) - 10 ) ; } else if ( i == 7 ) { setCount ( getCount ( ) - 100 ) ; } else if ( i == 8 ) { setCount ( getCount ( ) - 1000 ) ; } else { setCount ( getCount ( ) + 1 ) ; } } else if ( action . equals ( "Save File 1" ) ) { accessFile ( "save" , "save1" ) ; } else if ( action . equals ( "Save File 2" ) ) { accessFile ( "save" , "save2" ) ; } else if ( action . equals ( "Load File 1" ) ) { accessFile ( "load" , "save1" ) ; } else if ( action . equals ( "Load File 2" ) ) { accessFile ( "load" , "save2" ) ; } } if ( autoCounter ) { setCount ( getCount ( ) + 1 ) ; } update ( ) ; }
This handles the button actions (Controller)
This handles the button actions ( Controller )