hi please i deperately need help been trying to compile this code on netbeans IDE but it keeps giving me error on the output

code is:

package gameapplication;

import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;


/**
 *
 * @author beeumeh
 */
class Selection2 extends JFrame implements ActionListener {
private JLabel label1, label2, label3, label4, label5, label6, label7,
            label8;
    private JButton button1;
    private String PlayersNos;
    private JCheckBox team1, team2, team3, team4, team5, team6;
    private JPanel panel1, panel2, panel3, panel4, panel5, panel6, panel7;
    private Vector Teams;
    private int cost = 0;
    private int Total = 0;
    private Vector Team1 = new Vector();
    private Vector Team2 = new Vector();

    //Construcor to display GUI for second player to select teams

    public Selection2(Vector team, Vector team1) {
                Teams = team;
        Team1 = team1;


        panel7 = new JPanel();
        label8 = new JLabel();

        this.getContentPane().setLayout(new GridLayout(11, 0));
        label1 = new JLabel(
                "Please select your teams from below. Some of the teams have already been taken");

        team1 = new JCheckBox(team.get(0).toString());
        team1.addActionListener(this);
        label2 = new JLabel("£" + team.get(1).toString());

        team2 = new JCheckBox(team.get(2).toString());
        team2.addActionListener(this);
        label3 = new JLabel("£" + team.get(3).toString());

        team3 = new JCheckBox(team.get(4).toString());
        team3.addActionListener(this);
        label4 = new JLabel("£" + team.get(5).toString());

        team4 = new JCheckBox(team.get(6).toString());
        team4.addActionListener(this);
        label5 = new JLabel("£" + team.get(7).toString());

        team5 = new JCheckBox(team.get(8).toString());
        team5.addActionListener(this);
        label6 = new JLabel("£" + team.get(9).toString());
//If a team is already selected, disable the selection
        if (team.get(1).toString().equalsIgnoreCase("Taken")) {
            team1.setEnabled();
        }
        if (team.get(3).toString().equalsIgnoreCase("Taken")) {
            team2.setEnabled(false);
        }
        if (team.get(5).toString().equalsIgnoreCase("Taken")) {
            team3.setEnabled(false);
        }
        if (team.get(7).toString().equalsIgnoreCase("Taken")) {
            team4.setEnabled(false);
        }
        if (team.get(9).toString().equalsIgnoreCase("Taken")) {
            team5.setEnabled(false);
        }
        if (team.get(11).toString().equalsIgnoreCase("Taken")) {
            team6.setEnabled(false);
        }

        team6 = new JCheckBox(team.get(10).toString());
        team6.addActionListener(this);
        label7 = new JLabel("£" + team.get(11).toString());

        panel1 = new JPanel(new GridLayout(0, 2));
        panel1.add(team1);
        panel1.add(label2);

        panel2 = new JPanel(new GridLayout(0, 2));
        panel2.add(team2);
        panel2.add(label3);

        panel3 = new JPanel(new GridLayout(0, 2));
        panel3.add(team3);
        panel3.add(label4);

        panel4 = new JPanel(new GridLayout(0, 2));
        panel4.add(team4);
        panel4.add(label5);

        panel5 = new JPanel(new GridLayout(0, 2));
        panel5.add(team5);
        panel5.add(label6);

        panel6 = new JPanel(new GridLayout(0, 2));
        panel6.add(team6);
        panel6.add(label7);

        panel7.add(label8);

        button1 = new JButton("Next -->");
        button1.addActionListener(this);
        this.getContentPane().add(label1);
        this.getContentPane().add(new JLabel());

        this.getContentPane().add(panel1);
        this.getContentPane().add(panel2);
        this.getContentPane().add(panel3);
        this.getContentPane().add(panel4);
        this.getContentPane().add(panel5);
        this.getContentPane().add(panel6);
        this.getContentPane().add(new JLabel());
        this.getContentPane().add(panel7);
        this.getContentPane().add(button1);

        this.setSize(410, 270);
        this.setLocation(500, 300);
        this.show();

    }

    //Respond to user actions
    public void actionPerformed(ActionEvent e) {
        String s = e.getActionCommand();
        if (s.equals("Next -->")) {
            this.dispose();
            new Instructions(Team1, Team2);
        } else {
            Team2.add(s);
            label8.setText("");
            label8.setForeground(Color.RED);
            int i = Teams.indexOf(s);
            cost = Integer.parseInt(Teams.get(i + 1).toString());
            Total += cost;
            //If player has gone over budget, display error message
            if (Total > 600000) {
                Team1.clear();
                team1.setSelected(false);
                team2.setSelected(false);
                team3.setSelected(false);
                team4.setSelected(false);
                team5.setSelected(false);
                team6.setSelected(false);
                label8
                        .setText("You have gone over your budget. Please re-select your teams");
                Total = 0;
            }
        }

    }
}

the output is:

symbol  : method add(java.util.Vector)
location: class javax.swing.JPanel
                panel1.add(team1);
                      ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors

please any help from anyway will be highly appreciated

Code tags. The code looks terrible without them.

private Vector Team1 = new Vector();
    private Vector Team2 = new Vector();

    //Construcor to display GUI for second player to select teams

    public Selection2(Vector team, Vector team1) {
                Teams = team;
        Team1 = team1;


        panel7 = new JPanel();
        label8 = new JLabel();

        this.getContentPane().setLayout(new GridLayout(11, 0));
        label1 = new JLabel(
                "Please select your teams from below. Some of the teams have already been taken");

        team1 = new JCheckBox(team.get(0).toString());
        team1.addActionListener(this);

Lines 18 and 19 - team1 is a Vector, as defined in lines 1, 6, and 8. You're trying to make a Vector a JCheckBox, which doesn't make sense.

Your other errors appear also to involve team1 being used as a JCheckBox, which it is not.

so what do you suggest i do about it pls

You can have a Vector of JCheckBoxes. Write a for loop that generates them from the Vector team.

Or an array of JCheckBoxes

why dont you give me an example from the code i posted here pls

private Vector team1CheckBoxes = new Vector();
....
....

Team1 = team1;
for (int i=0;i<Team1.size();i++) {
  // get the object from the Team1 Vector
  //Team1.get(i);

  JCheckBox box = new JCheckBox( Team1.get(i).toString() );
  box.addActionListener(this)
  
  team1CheckBoxes.add(box);
}

team1CheckBoxes is a Vector that contains JCheckBox objects.
Also you must not forget to display the check boxes. Write another for loop or in the same write code that displays them

sorry tried it put but still getiing errors, pls can you kindly edit the code for me is been stressful, cos i changed the jdk i used for it before. The code is as follows again, thanks

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gameapplication;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.util.Vector;


/**
 *
 *
 */
class Selection2 extends JFrame implements ActionListener {
private JLabel label1, label2, label3, label4, label5, label6, label7,
            label8;
    private JButton button1;
    private String PlayersNos;
    private JCheckBox team1, team2, team3, team4, team5, team6;
    private JPanel panel1, panel2, panel3, panel4, panel5, panel6, panel7;
    private Vector Teams;
    private int cost = 0;
    private int Total = 0;
    private Vector Team1 = new Vector();
    private Vector Team2 = new Vector();

    //Construcor to display GUI for second player to select teams

    public Selection2(Vector team, Vector team1) {
                Teams = team;
        Team1 = team1;


        panel7 = new JPanel();
        label8 = new JLabel();

        this.getContentPane().setLayout(new GridLayout(11, 0));
        label1 = new JLabel(
                "Please select your teams from below. Some of the teams have already been taken");

        team1 = new JCheckBox(team.get(0).toString());
        team1.addActionListener(this);
        label2 = new JLabel("£" + team.get(1).toString());

        team2 = new JCheckBox(team.get(2).toString());
        team2.addActionListener(this);
        label3 = new JLabel("£" + team.get(3).toString());

        team3 = new JCheckBox(team.get(4).toString());
        team3.addActionListener(this);
        label4 = new JLabel("£" + team.get(5).toString());

        team4 = new JCheckBox(team.get(6).toString());
        team4.addActionListener(this);
        label5 = new JLabel("£" + team.get(7).toString());

        team5 = new JCheckBox(team.get(8).toString());
        team5.addActionListener(this);
        label6 = new JLabel("£" + team.get(9).toString());
//If a team is already selected, disable the selection
        if (team.get(1).toString().equalsIgnoreCase("Taken")) {
            team1.setEnabled(false);
        }
        if (team.get(3).toString().equalsIgnoreCase("Taken")) {
            team2.setEnabled(false);
        }
        if (team.get(5).toString().equalsIgnoreCase("Taken")) {
            team3.setEnabled(false);
        }
        if (team.get(7).toString().equalsIgnoreCase("Taken")) {
            team4.setEnabled(false);
        }
        if (team.get(9).toString().equalsIgnoreCase("Taken")) {
            team5.setEnabled(false);
        }
        if (team.get(11).toString().equalsIgnoreCase("Taken")) {
            team6.setEnabled(false);
        }

        team6 = new JCheckBox(team.get(10).toString());
        team6.addActionListener(this);
        label7 = new JLabel("£" + team.get(11).toString());

        panel1 = new JPanel(new GridLayout(0, 2));
        panel1.add(team1);
        panel1.add(label2);

        panel2 = new JPanel(new GridLayout(0, 2));
        panel2.add(team2);
        panel2.add(label3);

        panel3 = new JPanel(new GridLayout(0, 2));
        panel3.add(team3);
        panel3.add(label4);

        panel4 = new JPanel(new GridLayout(0, 2));
        panel4.add(team4);
        panel4.add(label5);

        panel5 = new JPanel(new GridLayout(0, 2));
        panel5.add(team5);
        panel5.add(label6);

        panel6 = new JPanel(new GridLayout(0, 2));
        panel6.add(team6);
        panel6.add(label7);

        panel7.add(label8);

        button1 = new JButton("Next -->");
        button1.addActionListener(this);
        this.getContentPane().add(label1);
        this.getContentPane().add(new JLabel());

        this.getContentPane().add(panel1);
        this.getContentPane().add(panel2);
        this.getContentPane().add(panel3);
        this.getContentPane().add(panel4);
        this.getContentPane().add(panel5);
        this.getContentPane().add(panel6);
        this.getContentPane().add(new JLabel());
        this.getContentPane().add(panel7);
        this.getContentPane().add(button1);

        this.setSize(410, 270);
        this.setLocation(500, 300);
        this.show();

    }

    //Respond to user actions
    public void actionPerformed(ActionEvent e) {
        String s = e.getActionCommand();
        if (s.equals("Next -->")) {
            this.dispose();
            new Instructions(Team1, Team2);
        } else {
            Team2.add(s);
            label8.setText("");
            label8.setForeground(Color.RED);
            int i = Teams.indexOf(s);
            cost = Integer.parseInt(Teams.get(i + 1).toString());
            Total += cost;
            //If player has gone over budget, display error message
            if (Total > 600000) {
                Team1.clear();
                team1.setSelected(false);
                team2.setSelected(false);
                team3.setSelected(false);
                team4.setSelected(false);
                team5.setSelected(false);
                team6.setSelected(false);
                label8
                        .setText("You have gone over your budget. Please re-select your teams");
                Total = 0;
            }
        }

    }
}

You don't use code tags, nor you specify your problem and at what line you get it. You will get no help this way.

the error bellow is from the line on the code that says:

team1 = new JCheckBox(team.get(0).toString());
        team1.addActionListener(this);
        label2 = new JLabel("£" + team.get(1).toString());

the output shows incompatible types

found   : javax.swing.JCheckBox
required: java.util.Vector
                team1 = new JCheckBox(team.get(0).toString());

the second on error on output is from the line on code:

if (team.get(1).toString().equalsIgnoreCase("Taken")) {
            team1.setEnabled(false);

the error on output is cannot find symbol

symbol  : method setEnabled(boolean)
location: class java.util.Vector
                        team1.setEnabled(false);

This is your code:

private JCheckBox [B]team1[/B], team2, team3, team4, team5, team6;

public Selection2(Vector team, Vector [B]team1[/B]) {

}

You define private global team1 JCheckBox variable, AND at the constructor you have:
Vector team1

So when inside the constructor you do this: team1.setEnabled(false); You are referring to the Vector which has no setEnabled method.
Inside the constructor 2 variables exists with the same name:
The team1 argument and the global team1 defined outside the constructor.
Inside the constructor if you want to refer to the CheckBox write: this.team1.setEnabled(false); Although it would be better to rethink the name of all of your variables.
I mean I find this stupid:

private JCheckBox team1;
private Vector Team1 = new Vector();

public Selection2(..., Vector team1) {
Team1 = team1;

Even though it compiles and runs since no rules were violated, later it is very easy to make the mistakes that you made.

hi

Your point?

You don't use code tags, nor you specify your problem and at what line you get it. You will get no help this way.

hi

You'll get no help this way either. The forum rules mention code tags and how to use them, I did too on my post, then Java Addict did too. Use them and ask a specific question.

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.