Ok got a new problem i've started to implement a GUI for my program but for some reason in the actionlistener metho i cannot pass the method i want to display.. I dont know what im doing wrong because i am not familiar with using GUIs... can somebody please help me this is the last problem i got..

This is the JFrame

package Schedule;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class MenuFrame extends JFrame{
 JTextField textField;
 Container contentPane;
 JMenuBar menuBar;
 JMenu fileMenu;
 JMenuItem displaySchedule;
 JMenuItem displayAll;
 JMenuItem displayComedy;
 JMenuItem displayDrama;
 JMenuItem displayRentables;
 JMenuItem addSchedule;
 JMenuItem removeSchedule;
 JMenuItem setTrailer;
 public MenuFrame(String title){
  contentPane = getContentPane();
  textField = new JTextField(20);
  menuBar = new JMenuBar();
  displaySchedule = new JMenuItem("View Schedule");
  displayAll = new JMenuItem("View All Programmes");
  displayComedy = new JMenuItem("View All Comedies");
  displayDrama = new JMenuItem("View All Dramas");
  displayRentables = new JMenuItem("View All Rentables");
  addSchedule = new JMenuItem("Add Programmes To Schedule");
  removeSchedule = new JMenuItem("Remove Programme From Schedule");
  setTrailer = new JMenuItem("Set Trailer Duration");
  displaySchedule.addActionListener(new MenuListener());
  displayAll.addActionListener(new MenuListener());
  displayComedy.addActionListener(new MenuListener());
  displayDrama.addActionListener(new MenuListener());
  displayRentables.addActionListener(new MenuListener());
  addSchedule.addActionListener(new MenuListener());
  removeSchedule.addActionListener(new MenuListener());
  setTrailer.addActionListener(new MenuListener());
  fileMenu = new JMenu("File");
  addWindowListener(new Terminator());
 public static void main(String args[]){
 	Database database= new Database();
  new MenuFrame("Hotel Television Schedule System");
 class MenuListener implements ActionListener{
   public void actionPerformed (ActionEvent e){
     if(e.getSource() == displaySchedule){
      ScheduleMenu.viewAll() ;
     else if(e.getSource() == displayAll){
       textField.setText("Open an existing file");

This is the class from where the method is called

package Schedule;

import java.io.*;
import javax.swing.*;

public class ScheduleMenu
	Programme programme []= new Programme[200];
	int entry = 0;
	int comedysize = 10;
	int filmsize = 10;
	int dramasize = 10;
	Comedy comedy[] = new Comedy[comedysize];
 	Drama drama[] = new Drama[dramasize];
 	Film film[] = new Film[filmsize];
	public static void main(String args[])
	throws IOException
		new ScheduleMenu().mainMenu();
	public void initialiseComedy()
 	 	for (int i=20; i<comedysize;i++)
 			comedy[i] = new Comedy();
 		entry = 0;
    //Hardcoded details
    public void setComedyDetails()
        entry = 1; 
    	comedy[0] = new Comedy ("My Wife & Kids			","Mario Wyans		","Lisa Ray			","","30","No");	
    	comedy[1] = new Comedy ("Friends				","Jennifer Aniston	","Marta Kaufman	","","30","No");	
    	comedy[2] = new Comedy ("Fresh Prince			","Will Smith		","Jazzy J			","","30","No");	
    	comedy[3] = new Comedy ("Joey					","Mat Le Blanc		","Marta Kaufman	","","30","No");	
    	comedy[4] = new Comedy ("My Name Is Earl		","MJames Matheis	","Jimmy Hench		","","30","No");	
    	comedy[5] = new Comedy ("Simpsons				","Bart, Homer		","Dan Castella		","","30","No");	
    	comedy[6] = new Comedy ("Two and A Half Men		","Charlie Sheen	","Brian Forre		","","30","No");	
    	comedy[7] = new Comedy ("Everybody Loves Raymond","Chris Rock		","Vincent Martella	","","30","No");	
    	comedy[8] = new Comedy ("That 70s Show			","Ashton Kutcher	","Topher Grace		","","30","No");	
    	comedy[9] = new Comedy ("Will & Grace			","Debra Messing	","Micheal Angarro	","","30","No");	
public void setFilmDetails()
    	film[0] = new Film ("War Of The Worlds			","Tom Cruise			","Steven Spielberg		","Tripod aliens attack earth					","120		","Yes		");	
    	film[1] = new Film ("Star Wars 3				","Ewan McGregor		","George Lucas			","Prequel to the star wars saga				","120		","Yes		");	
    	film[2] = new Film ("Inside Man					","Denzel Washington	","Spike Lee			","Robbers pull the perfect bank robbery		","120		","Yes		");	
    	film[3] = new Film ("The Sentinel				","Micheal Douglas		","James Lingman		","An agent is accused of killing president		","120		","Yes		");	
    	film[4] = new Film ("Mission Impossible 3		","Tom Cruise			","JJ Abrams			","Ethan Hunt is on another mission				","120		","Yes		");	
    	film[5] = new Film ("Kin Kong					","Jack Black			","Peter jackson		","King Kong hit new york						","180		","Yes		");	
    	film[6] = new Film ("Pirates Of The Caribbean 	","Johnny Depp 			","Gore Verbinski		","Adventures of Jack Sparrow					","120		","Yes		");	
		film[0] = new Film ("X-Men						","Hugh Jackman			","Bryan Singer			","Superhero adventures							","120		","Yes		");	
    	film[8] = new Film ("The Usual Suspects			","Kevin Spacey			","Bryan Singer			","Criminals head for a big payday				","120		","Yes		");	
    	film[9] = new Film ("Batman Begins				","	Christian Bale		","Christopher Nolan	","Adventures of the man from Gotham city		","120		","Yes		");	
    public void setDramaDetails()
    	drama[0] = new Drama ("24			","Keifer Sutherland	","Dan Maniche			","counter terrorist unit adventure					","60		","No		");
    	drama[1] = new Drama ("Prison Break	","Micheal Scofield		","Luca benjamin		","Prison escape drama								","60		","No		");
    	drama[2] = new Drama ("CSI NY		","Gary Sinese			","Jerry Bruckheimer	","Forensics team investigate murder in New York	","60		","No		");
    	drama[3] = new Drama ("Alias		","Jennifer Garner		","JJ Abrams			","Terrorist espionage drama						","60		","No		");
    	drama[4] = new Drama ("Lost			","Evangeline Lilly		","JJ Abrams			","Plane crash victims stranded on island			","60		","No		");
    	drama[5] = new Drama ("Smallville	","Clark Kent			","Mickey Regvardy		","Adventures of superman							","60		","No		");
    	drama[6] = new Drama ("Hustle		","Dougray Scott		","Smith Jones			","Professional team of theifs, plan robbery		","60		","No		");
    	drama[7] = new Drama ("The Unit		","Jack Ryan			","Polanski Jena		","Missions of secret tactics unit					","60		","No		");
    	drama[8] = new Drama ("CSI Miami	","Herashio Kane		","Jerry Bruckheimer	","Forensics team investigate murder in Miami		","60		","No		");
    	drama[9] = new Drama ("CSI			","Grissom Krusky		","Jerry Bruckheimer	","Forensics team investigate murder in Las Vegas	","60		","No		");
  	public void allComedies()
 		   System.out.println("Title	Actor   Director	Synopsis	Duration	Rentable");
 		   for (int i=0; i<comedysize;i++)
	public void allFilms()
 		   System.out.println("Title	Actor   Director	Synopsis	Duration	Rentable");
 		   for (int i=0; i<filmsize;i++)
 	public void allDramas()
 		   System.out.println("Title	Actor   Director	Synopsis	Duration	Rentable");
 		   for (int i=0; i<dramasize;i++)
 	public void viewAll()
 		   System.out.println("Title	Actor   Director		Synopsis		Duration		Rentable");
           for (int i=0; i<comedysize;i++)
 			public void mainMenu(){ 
		Schedule schedule= new Schedule();
	    char choice = '0';
			   System.out.println("\nPLEASE CHOOSE FROM THE OPTIONS BELOW");
			   System.out.println(" 1. VIEW ALL");
			   System.out.println(" 2. VIEW COMEDIES");
			   System.out.println(" 3. VIEW FILMS");
			   System.out.println(" 4. VIEW DRAMAS");
			   System.out.println(" 5. ADD PROGRAMME");
			   System.out.println(" 6. REMOVE PROGRAMME");
			   System.out.println(" 7. VIEW HOTEL INFO");
			   System.out.println(" 8. TO QUIT");
			   System.out.println(" ENTER A NUMBER CORRESPONDING THE OPTION:");
		       /**** problem ****/
		       choice=(char) System.in.read();
		       /**** end of problem ****/
		       //BufferedReader reader;
			//	reader = new BufferedReader(new InputStreamReader(System.in));
			//	String i = reader.readLine();
				//choice = Integer.parseInt(i);
			//	choice=(char) System.in.read();
			      case '1': viewAll();
		 	      case '2': allComedies();
		 	      case '3': allFilms();
		 	      case '4': allDramas();
		 	      case '5': addProgramme();
		 	      case '6': //removeProgramme();
		 	      case '7': //hotelInfo();
		 	      case '8': System.out.println("System Exit");
		    catch (IOException e)
		    //catch(NumberFormatException e)
		    //	System.out.println("Problem :"+e.getMessage());
		}while(choice !=8);
	public void addProgramme(){

you're trying to access an instance method like it were a static method, that's not allowed.

That entire ScheduleMenu class seems rather out of place in a Swing application anyway.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.