C
Colin Hemmings
Can anybody tell me why this isnt working. I get two error both saying
"cannot find symbol" I have denoted them witha comment
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* Write a description of class gridLayout here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class gridLayout extends JFrame implements ActionListener
{
private JPanel grid = new JPanel( new GridLayout(3, 3));
public void actionPerformed(ActionEvent event)
{
System.out.println("Item: " + event.getActionCammand());
// get an error here saying "cannot find symbol"
System.out.println("Item: ");
}
public gridLayout()
{
JPanel panel1 = new JPanel();
JLabel labelOne = new JLabel("one");
//labelOne.addActionListener(this);
// get an error here saying "cannot find symbol"
panel1.add(labelOne);
grid.add(panel1);
grid.add(new JButton("2"));
grid.add(new JButton("3"));
grid.add(new JButton("4"));
grid.add(new JButton("5"));
grid.add(new JButton("6"));
grid.add(new JButton("7"));
grid.add(new JButton("8"));
grid.add(new JButton("9"));
//JTabbedPane tp = new JTabbedPane();
//tp.addTab("Grid", grid);
setContentPane(grid);
setSize(300,175);
setVisible(true);
}
}
"cannot find symbol" I have denoted them witha comment
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* Write a description of class gridLayout here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class gridLayout extends JFrame implements ActionListener
{
private JPanel grid = new JPanel( new GridLayout(3, 3));
public void actionPerformed(ActionEvent event)
{
System.out.println("Item: " + event.getActionCammand());
// get an error here saying "cannot find symbol"
System.out.println("Item: ");
}
public gridLayout()
{
JPanel panel1 = new JPanel();
JLabel labelOne = new JLabel("one");
//labelOne.addActionListener(this);
// get an error here saying "cannot find symbol"
panel1.add(labelOne);
grid.add(panel1);
grid.add(new JButton("2"));
grid.add(new JButton("3"));
grid.add(new JButton("4"));
grid.add(new JButton("5"));
grid.add(new JButton("6"));
grid.add(new JButton("7"));
grid.add(new JButton("8"));
grid.add(new JButton("9"));
//JTabbedPane tp = new JTabbedPane();
//tp.addTab("Grid", grid);
setContentPane(grid);
setSize(300,175);
setVisible(true);
}
}