Problem i cant get this to compile using Textpad5 any help would be nice on what i am doing wrong
seems i cant get the GUI aspect of Java to work and yes i have all latest updates of JDK and JDE

import java.awt.FlowLayout; //specifies how components are arranged
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame; //provides basic window features
import javax.swing.JButton; //provides buttons
import javax.swing.Jlabel; //displays text and images
import javax.swing.SwingConstants; // common constants used with swing
import javax.swing.JOptionPane;


public class ButtonFrame extends JFrame
{
   private JButton plainJButton; //plain button with text
   private JButton plainButton;
   
   //ButtonFrame adds Jbuttons to frame
   
   public ButtonFrame()
   {
   super( "DB Project" );
   setLayout( new FlowLayout() ); // set frame layout
   
   plainJbutton = new JButton( "Time"); //button Time with text
   add(plainJButton ); // Time button
   
   plainJButton = new JButton( "Quit"); //button Quit
   add(plainJButton ); // Quit Button
   
   //creates new ButtonHandler for button event handling
   ButtonHandler handler = new ButtonHandler();
   plainJButton.addActionListioner( handler );
   plainJButton.addActionListioner(handler );
   
   } // end ButtonFrame constructors
   
   //inner class for button event handling
   private class ButtonHandler implements ActionListener
      {
         //handle button event
         public void actionPerformed( ActionEvent event )
         {
            JOptionPane.showMessegeDialog( ButtonFrame.this, String.format( "You pressed: %s", event.getActionCommand() ) );
         } //ends method actionPerformed
      } //ends private inner class ButtonHandler
   }  // end class ButtonFrame

ERRORS
java:12: class ButtonFrame is public, should be declared in a file named ButtonFrame.java
public class ButtonFrame extends JFrame
^
C:\Users\Ghost\Desktop\DB Project\Project.java:7: cannot find symbol
symbol : class Jlabel
location: package javax.swing
import javax.swing.Jlabel; //displays text and images
^
C:\Users\Ghost\Desktop\DB Project\Project.java:24: cannot find symbol
symbol : variable plainJbutton
location: class ButtonFrame
plainJbutton = new JButton( "Time"); //button Time with text
^
C:\Users\Ghost\Desktop\DB Project\Project.java:32: cannot find symbol
symbol : method addActionListioner(ButtonFrame.ButtonHandler)
location: class javax.swing.JButton
plainJButton.addActionListioner( handler );
^
C:\Users\Ghost\Desktop\DB Project\Project.java:33: cannot find symbol
symbol : method addActionListioner(ButtonFrame.ButtonHandler)
location: class javax.swing.JButton
plainJButton.addActionListioner(handler );
^
C:\Users\Ghost\Desktop\DB Project\Project.java:43: cannot find symbol
symbol : method showMessegeDialog(ButtonFrame,java.lang.String)
location: class javax.swing.JOptionPane
JOptionPane.showMessegeDialog( ButtonFrame.this, String.format( "You pressed: %s", event.getActionCommand() ) );
^
6 errors

Tool completed with exit code 1

Recommended Answers

All 2 Replies

> class ButtonFrame is public, should be declared in a file named ButtonFrame.java
means what it says
> cannot find symbol : class Jlabel
> cannot find symbol : variable plainJbutton
check your capitalisation - all Java names are case sensitive

After that it doesn't help that the code you posted is NOT the code that the error messages refer to.

ooo sorry this was a mispost as it was actually pulled from two places and didnt relise i had 3 folders working on same project PLEASE DELETE

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.