i really need help...
i dont know where the problem...
the line error on that part>>class reserveform extends JFrame implements {

import java.awt.Dimens;
import java.awt.*;
import javax.swing.*;
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.Collections;
import java.awt.event.*;


class reserveform extends JFrame implements {


    // operation interface

    JPanel operation;
    JButton reservbtn, cancel,modify,save;
    JButton next,first,last,previous;
    JPanel moving;

    reserveform ()
    {

        Container c = getContentPane();
        c.setLayout(new FlowLayout());
        c.setBackground(Color.red);

        //hostcontainer = new JPanel(new FlowLayout());


        name= new JLabel("Name:");
        id = new JLabel("ID");
        address = new JLabel("Address:");
        job = new JLabel("JOB:");

        txtname= new JTextField(20);
        txtid = new JTextField (20);
        txtaddress= new JTextField (20);
        txtjob = new JTextField (20);

        name_id  = new JPanel(new FlowLayout());
        name_id .setBackground(Color.red);
        addr_job = new JPanel(new FlowLayout());
        addr_job.setBackground(Color.red);


        //add elemtents into panel
            name_id.add(name); name_id.add(txtname);
        name_id  .add(id); name_id  .add(txtid);
        addr_job .add(address); addr_job .add(txtaddress);
        addr_job .add(job); addr_job .add(txtjob);

        //hostcontainer.add(name_id  ); hostcontainer.add(addr_job );

        c.add(name_id); c.add(addr_job);
        //c.add(hostcontainer,"North");



        // building interface for room

        type=new JLabel("Type:  ");
        roomno=new JLabel("roomNo      ");
        arrivingdate=new JLabel("Arriving");
        days= new JLabel("Days:");

        txttype = new JComboBox(new String[]{"Single","Double","Sweet"});
        txttype.setBackground(Color.red);

        txtromno= new JTextField(20);
        txtarriving= new JTextField(20);
        txtdays= new JTextField(20);

        roomcontainer = new JPanel(new FlowLayout());
        roomcontainer.setBackground(Color.red);

        roomcontainer.add(type); roomcontainer.add(txttype);


        container2= new JPanel(new FlowLayout());
        container2.setBackground(Color.red);
        container2.add(roomno); container2.add(txtromno);

        container3= new JPanel(new FlowLayout());
        container3.setBackground(Color.red);
        container3.add(arrivingdate); container3.add(txtarriving);

        container4 = new JPanel(new FlowLayout());
        container4 .setBackground(Color.red);
        container4.add(days);container4.add(txtdays);

        c.add(roomcontainer); c.add(container2); c.add(container3); c.add(container4);

        // build interface of operations

        operation= new JPanel(new FlowLayout());
        operation.setBackground(Color.red);

        reservbtn = new JButton("New Resv:"); 
        reservbtn.addActionListener(this);

        cancel = new JButton("Cancel");
        cancel.addActionListener(this);

        modify= new JButton("Modify");
        modify.addActionListener(this);

        save = new JButton("Save");
        save.addActionListener(this);


        moving = new JPanel(new FlowLayout());
        moving .setBackground(Color.red);
        next = new JButton("Next");
        next.addActionListener(this);

        first= new JButton("first");
        first.addActionListener(this);

        last= new JButton("last");
        last.addActionListener(this);

        previous= new JButton("previous");
        previous.addActionListener(this);

        moving.add(first); moving.add(next);    moving.add(previous); moving.add(last);


        operation.add(reservbtn);   operation.add(save);
        operation.add(cancel);      operation.add(modify); 

        c.add(operation);
        c.add(moving);

        setVisible(true);
        setSize(600,270);


         setResizable(false);


        if (listA.isEmpty())
            { disableall(); disableaction();}

        setLocation(600,100);

    }


    void enableall() 
        {
            next.setEnabled(true);
            first.setEnabled(true);
            last.setEnabled(true);
            previous.setEnabled(true);
                cancel.setEnabled(true); 
            modify.setEnabled(true); 
            save.setEnabled(true);

        }
    void disableall()
        {

            next.setEnabled(false);
            first.setEnabled(false);
            last.setEnabled(false);
            previous.setEnabled(false);

        }
    void disableaction()
    {
     cancel.setEnabled(false); modify.setEnabled(false); save.setEnabled(false);
    }
    public void clearboxes()
    {

        txtname.setText(" ");
        txtid.setText(" ");
        txtaddress.setText(" ");
        txtjob.setText(" ");
        txtromno.setText(" ");
        txtarriving.setText(" ");
        txtdays.setText(" ");


      }

  public void fillinfo() 
    {

          return new reservation(txtname.getText(), txtid.getText(),txtaddress.getText(),
        txtjob.getText(), txtromno.getText(), txtarriving.getText(),txtdays.getText(),  
                (String)txttype.getSelectedItem()); 

    }

    public void show (reservation ob) 
    {


        if (index< listA.size() && index>=0)
        {
            txtname.setText(ob.hst.name);
            txtid.setText(ob.hst.id);
            txtaddress.setText(ob.hst.address);
            txtjob.setText(ob.hst.job);
            txtromno.setText(ob.rm.roomno);
            txtarriving.setText(ob.dateofcome);
            txtdays.setText(ob.days+" ");

            if(ob.rm.type.equals("Single"))
                txttype.setSelectedIndex(0);
            else
                if(ob.rm.type.equals("Double"))
                txttype.setSelectedIndex(1);
                else
                txttype.setSelectedIndex(2);
        }


}

public void actionPerformed(ActionEvent e) 
{ 

    String lbl=e.getActionCommand();

    if(lbl.equals( "New Resv:"))
       { clearboxes();
         save.setEnabled(true);
         cancel.setEnabled(true);
         cancel.setText("ignore");
       }

    else
        if(lbl.equals("Save"))
                { 

               listA.add(fillinfo());
               index= listA.size()-1;
               show((reservation)listA.get(index));
                enableall();cancel.setText("Cancel");
            }
        else
            if(lbl.equals("Cancel") )
             { listA.remove(index);
               if(!listA.isEmpty())
                show((reservation)listA.get(index));
                else
                { disableall(); disableaction();clearboxes();}
             }

              else if (lbl.equals("ignore"))
                { clearboxes(); cancel.setText("Cancel"); enableall();}
             else


                  if(lbl.equals("Modify"))
                {
                   listA.add(fillinfo());
                   listA.remove(index);
                   show((reservation)listA.get(listA.size()-1));
                }
                else
                  if(lbl.equals("first"))
                   {
                    index=0;  show((reservation)listA.get(index));cancel.setText("Cancel");
                   }
                   else
                   if(lbl.equals("last"))
                    { index=listA.size()-1; show((reservation)listA.get(index));cancel.setText("Cancel");}
                   else
                    if(lbl.equals("previous") && index>0)
                     {  
                    index-=1; show((reservation)listA.get(index));cancel.setText("Cancel");
                     }
                     else

                    if(lbl.equals("Next") && (index+1) < listA.size())
                      {
                        index+=1;show((reservation)listA.get(index)); cancel.setText("Cancel");
                      }    



    }

}

Recommended Answers

All 10 Replies

class reserveform extends JFrame implements ---???----{
- Which one interface implements?

implements ... need an interface name here.
ps post iin code tags and indent code properly

I'm very new to writing java.I've tried everything to fix it.can u make it right for me....

import java.awt.Dimens;
import java.awt.*;
import javax.swing.*;
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.Collections;
import java.awt.event.*;


class reserveform extends JFrame implements {


	// operation interface

	JPanel operation;
	JButton reservbtn, cancel,modify,save;
	JButton next,first,last,previous;
	JPanel moving;

	reserveform ()
	{

		Container c = getContentPane();
		c.setLayout(new FlowLayout());
		c.setBackground(Color.red);

		//hostcontainer = new JPanel(new FlowLayout());
		

		name= new JLabel("Name:");
		id = new JLabel("ID");
		address = new JLabel("Address:");
		job = new JLabel("JOB:");

		txtname= new JTextField(20);
		txtid = new JTextField (20);
		txtaddress= new JTextField (20);
		txtjob = new JTextField (20);

		name_id  = new JPanel(new FlowLayout());
		name_id .setBackground(Color.red);
		addr_job = new JPanel(new FlowLayout());
		addr_job.setBackground(Color.red);


		//add elemtents into panel
          	name_id.add(name); name_id.add(txtname);
		name_id  .add(id); name_id  .add(txtid);
		addr_job .add(address); addr_job .add(txtaddress);
		addr_job .add(job); addr_job .add(txtjob);

		//hostcontainer.add(name_id  ); hostcontainer.add(addr_job );
		
		c.add(name_id); c.add(addr_job);
		//c.add(hostcontainer,"North");



		// building interface for room

		type=new JLabel("Type:  ");
		roomno=new JLabel("roomNo      ");
		arrivingdate=new JLabel("Arriving");
		days= new JLabel("Days:");

		txttype = new JComboBox(new String[]{"Single","Double","Sweet"});
		txttype.setBackground(Color.red);

		txtromno= new JTextField(20);
		txtarriving= new JTextField(20);
		txtdays= new JTextField(20);

		roomcontainer = new JPanel(new FlowLayout());
		roomcontainer.setBackground(Color.red);

		roomcontainer.add(type); roomcontainer.add(txttype);
		
		
		container2= new JPanel(new FlowLayout());
		container2.setBackground(Color.red);
		container2.add(roomno); container2.add(txtromno);
		
		container3= new JPanel(new FlowLayout());
		container3.setBackground(Color.red);
		container3.add(arrivingdate); container3.add(txtarriving);

		container4 = new JPanel(new FlowLayout());
		container4 .setBackground(Color.red);
		container4.add(days);container4.add(txtdays);

		c.add(roomcontainer); c.add(container2); c.add(container3); c.add(container4);

		// build interface of operations
		
		operation= new JPanel(new FlowLayout());
		operation.setBackground(Color.red);

		reservbtn = new JButton("New Resv:"); 
		reservbtn.addActionListener(this);
		
		cancel = new JButton("Cancel");
		cancel.addActionListener(this);

		modify= new JButton("Modify");
		modify.addActionListener(this);

		save = new JButton("Save");
		save.addActionListener(this);
		
		
		moving = new JPanel(new FlowLayout());
		moving .setBackground(Color.red);
		next = new JButton("Next");
		next.addActionListener(this);

		first= new JButton("first");
		first.addActionListener(this);

		last= new JButton("last");
		last.addActionListener(this);

		previous= new JButton("previous");
		previous.addActionListener(this);

		moving.add(first); moving.add(next);	moving.add(previous); moving.add(last);

		
		operation.add(reservbtn);	operation.add(save);
		operation.add(cancel);		operation.add(modify); 

		c.add(operation);
		c.add(moving);
		
		setVisible(true);
		setSize(600,270);
		 
		 
		 setResizable(false);
		
		
		if (listA.isEmpty())
			{ disableall(); disableaction();}

		setLocation(600,100);

	}


	void enableall() 
		{
			next.setEnabled(true);
			first.setEnabled(true);
			last.setEnabled(true);
			previous.setEnabled(true);
		        cancel.setEnabled(true); 
			modify.setEnabled(true); 
			save.setEnabled(true);

		}
	void disableall()
		{

			next.setEnabled(false);
			first.setEnabled(false);
			last.setEnabled(false);
			previous.setEnabled(false);

		}
	void disableaction()
	{
	 cancel.setEnabled(false); modify.setEnabled(false); save.setEnabled(false);
	}
	public void clearboxes()
	{

		txtname.setText(" ");
		txtid.setText(" ");
		txtaddress.setText(" ");
		txtjob.setText(" ");
		txtromno.setText(" ");
		txtarriving.setText(" ");
		txtdays.setText(" ");


      }
	
  public void fillinfo() 
	{

		  return new reservation(txtname.getText(), txtid.getText(),txtaddress.getText(),
		txtjob.getText(), txtromno.getText(), txtarriving.getText(),txtdays.getText(),  
                (String)txttype.getSelectedItem()); 

	}

	public void show (reservation ob) 
	{

		 
		if (index< listA.size() && index>=0)
		{
			txtname.setText(ob.hst.name);
			txtid.setText(ob.hst.id);
			txtaddress.setText(ob.hst.address);
			txtjob.setText(ob.hst.job);
			txtromno.setText(ob.rm.roomno);
			txtarriving.setText(ob.dateofcome);
			txtdays.setText(ob.days+" ");
		
			if(ob.rm.type.equals("Single"))
		 		txttype.setSelectedIndex(0);
			else
		  	    if(ob.rm.type.equals("Double"))
			 	txttype.setSelectedIndex(1);
		   	    else
			 	txttype.setSelectedIndex(2);
		}
			
	
}

public void actionPerformed(ActionEvent e) 
{ 

	String lbl=e.getActionCommand();

	if(lbl.equals( "New Resv:"))
	   { clearboxes();
	     save.setEnabled(true);
	     cancel.setEnabled(true);
	     cancel.setText("ignore");
	   }

	else
		if(lbl.equals("Save"))
		        { 
			    	
			   listA.add(fillinfo());
			   index= listA.size()-1;
			   show((reservation)listA.get(index));
			    enableall();cancel.setText("Cancel");
			}
		else
			if(lbl.equals("Cancel") )
			 { listA.remove(index);
			   if(!listA.isEmpty())
			   	show((reservation)listA.get(index));
			    else
				{ disableall(); disableaction();clearboxes();}
			 }

			  else if (lbl.equals("ignore"))
				{ clearboxes(); cancel.setText("Cancel"); enableall();}
			 else
			   

			      if(lbl.equals("Modify"))
				{
				   listA.add(fillinfo());
				   listA.remove(index);
				   show((reservation)listA.get(listA.size()-1));
				}
				else
				  if(lbl.equals("first"))
				   {
					index=0;  show((reservation)listA.get(index));cancel.setText("Cancel");
				   }
				   else
				   if(lbl.equals("last"))
				    { index=listA.size()-1; show((reservation)listA.get(index));cancel.setText("Cancel");}
				   else
				    if(lbl.equals("previous") && index>0)
				     {  
					index-=1; show((reservation)listA.get(index));cancel.setText("Cancel");
				     }
				     else
				      
					if(lbl.equals("Next") && (index+1) < listA.size())
					  {
					    index+=1;show((reservation)listA.get(index)); cancel.setText("Cancel");
					  }    
			   
		

	}

}

i have fix it...
but i still cant get the solution...

If you have a new question, please mark this thread solved and start a new thread.

you wrote

class reserveform extends JFrame implements

but you didn't write what it implements..

either add implementation(such as

class reserveform extends JFrame implements java.awt.event.ActionListener

) or remove the word implements(

class reserveform extends JFrame

)

its still cant working..

You need declarations of type for all varibles:

public class reserveform extends JFrame implements ActionListener {

// operation interface
    JPanel operation;
    JButton reservbtn, cancel, modify, save;
    JButton next, first, last, previous;
    JPanel moving;
    /// missed declarations
    JLabel name, id, address, job;
    JTextField txtname, txtid, txtaddress, txtjob;
    
    ///and so on

look at your compilation errors

"sometimes a man is blind"
Look at line 1 of your code (first post)
import java.awt.Dimens;
should be
import java.awt.Dimension;

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.