J
jspence
Can't find error
C:\JAVA\WS_BuyerInterface\src\ws_buyerinterface\Main.java:29: illegal
start of expression
public class BuyerInterface implements ActionListener {
C:\JAVA\WS_BuyerInterface\src\ws_buyerinterface\Main.java:29: ';'
expected
public class BuyerInterface implements ActionListener {
I hope this is something trivial that I have overlooked. It has been a
while since I've done any programming(poor excuse eh).
I'm using netBeans 4.0.
Thanks Jeff.
/*
* Main.java
* Created on January 6, 2005, 1:42 PM
*/
package ws_buyerinterface;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*
* @author jspence
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
//public static void main(String[] args) {
// TODO code application logic here
public class BuyerInterface implements ActionListener { // line 29
JFrame buyerFrame;
JPanel buyerPanel;
JPanel userPanel;
JTextField fieldOne;
JTextField fieldTwo;
JLabel LabelOne;
JLabel LabelTwo;
public BuyerInterface(){
buyerFrame = new JFrame("Military Produce Group");
buyerFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
buyerFrame.setSize(new Dimension(100,20));
//Create and set up window
buyerPanel = new JPanel(new GridLayout(5,5,2,2));
buyerPanel.setBorder(BorderFactory.createLineBorder
(Color.black));
//userPanel = new JPanel(new GridLayout(5,5,2,2));
//userPanel.setBorder(BorderFactory.createLineBorder(Color.red));
addWidgets();
//Add panel to the window.
buyerFrame.getContentPane().add(buyerPanel,BorderLayout.NORTH);
//buyerFrame.getContentPane().add(userPanel,BorderLayout.SOUTH);
// Display the window.
buyerFrame.pack();
buyerFrame.setVisible(true);
}
private void addWidgets() {
// Create widgets
fieldOne = new JTextField("One",5);
fieldTwo = new JTextField("Two",5);
LabelOne = new JLabel("Label One", SwingConstants.CENTER);
LabelTwo = new JLabel("Label Two", SwingConstants.CENTER);
// Listen to events
fieldOne.addActionListener(this);
// Add widgets to the container
buyerPanel.add(fieldOne); buyerPanel.add(LabelOne);
//userPanel.add(fieldTwo); userPanel.add(LabelTwo);
}
public void actionPerformed(ActionEvent event) {
fieldOne.setText("Hello MPG");
}
private static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);
BuyerInterface buyerInterface = new BuyerInterface();
}
}
}
}
C:\JAVA\WS_BuyerInterface\src\ws_buyerinterface\Main.java:29: illegal
start of expression
public class BuyerInterface implements ActionListener {
C:\JAVA\WS_BuyerInterface\src\ws_buyerinterface\Main.java:29: ';'
expected
public class BuyerInterface implements ActionListener {
I hope this is something trivial that I have overlooked. It has been a
while since I've done any programming(poor excuse eh).
I'm using netBeans 4.0.
Thanks Jeff.
/*
* Main.java
* Created on January 6, 2005, 1:42 PM
*/
package ws_buyerinterface;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*
* @author jspence
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
//public static void main(String[] args) {
// TODO code application logic here
public class BuyerInterface implements ActionListener { // line 29
JFrame buyerFrame;
JPanel buyerPanel;
JPanel userPanel;
JTextField fieldOne;
JTextField fieldTwo;
JLabel LabelOne;
JLabel LabelTwo;
public BuyerInterface(){
buyerFrame = new JFrame("Military Produce Group");
buyerFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
buyerFrame.setSize(new Dimension(100,20));
//Create and set up window
buyerPanel = new JPanel(new GridLayout(5,5,2,2));
buyerPanel.setBorder(BorderFactory.createLineBorder
(Color.black));
//userPanel = new JPanel(new GridLayout(5,5,2,2));
//userPanel.setBorder(BorderFactory.createLineBorder(Color.red));
addWidgets();
//Add panel to the window.
buyerFrame.getContentPane().add(buyerPanel,BorderLayout.NORTH);
//buyerFrame.getContentPane().add(userPanel,BorderLayout.SOUTH);
// Display the window.
buyerFrame.pack();
buyerFrame.setVisible(true);
}
private void addWidgets() {
// Create widgets
fieldOne = new JTextField("One",5);
fieldTwo = new JTextField("Two",5);
LabelOne = new JLabel("Label One", SwingConstants.CENTER);
LabelTwo = new JLabel("Label Two", SwingConstants.CENTER);
// Listen to events
fieldOne.addActionListener(this);
// Add widgets to the container
buyerPanel.add(fieldOne); buyerPanel.add(LabelOne);
//userPanel.add(fieldTwo); userPanel.add(LabelTwo);
}
public void actionPerformed(ActionEvent event) {
fieldOne.setText("Hello MPG");
}
private static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);
BuyerInterface buyerInterface = new BuyerInterface();
}
}
}
}