Help 'error' Cannot find it.

Discussion in 'Java' started by jspence, Apr 20, 2005.

  1. jspence

    jspence Guest

    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();
    }

    }
    }
    }
     
    jspence, Apr 20, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.microsoft.com
    Replies:
    4
    Views:
    5,017
    =?Utf-8?B?Q2hpbm1heQ==?=
    Jan 10, 2005
  2. jspence

    Help 'error' Cannot find it.

    jspence, Apr 20, 2005, in forum: Java
    Replies:
    2
    Views:
    422
    Owen Jacobson
    Apr 21, 2005
  3. Wybo Dekker
    Replies:
    1
    Views:
    396
    Yukihiro Matsumoto
    Nov 15, 2005
  4. vdvorkin
    Replies:
    0
    Views:
    437
    vdvorkin
    Feb 10, 2011
  5. vdvorkin
    Replies:
    3
    Views:
    866
    vdvorkin
    Feb 14, 2011
Loading...

Share This Page