hye..I have 3 classes

1.Welcome
2.Admin
3.User

At Welcome classes,

public class Welcome extends javax.swing.JFrame {

    
    public Welcome() {
        initComponents();
    }

   
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("WELCOME TO");

        jButton1.setText("START");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("LOGIN");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jLabel2.setText(" MALAY SYNONYM WORD CHECKER!");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(135, 135, 135)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(83, 83, 83)
                        .addComponent(jLabel2))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(137, 137, 137)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jButton2)
                            .addComponent(jButton1))))
                .addContainerGap(87, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(80, 80, 80)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(jLabel2)
                .addGap(25, 25, 25)
                .addComponent(jButton1)
                .addGap(18, 18, 18)
                .addComponent(jButton2)
                .addContainerGap(108, Short.MAX_VALUE))
        );

        pack();
    }

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
         User page=new User();
         page.setVisible(true);
*When Click Start button,should go to User classes*
    }                                        

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         

        Admin page=new Admin();
         page.setVisible(true);
*When Click Login button,should go to Admin classes*
    }                                        

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Welcome().setVisible(true);
            }
        });
    }

   
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
   

}

What happens in your program? Do you get some error? or by pressing the button nothing happens.

What happens in your program? Do you get some error? or by pressing the button nothing happens.

yup..got error..

this is the error


Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol: class User
location: class Welcome
at Welcome.jButton1ActionPerformed(Welcome.java:84)
at Welcome.access$000(Welcome.java:7)
at Welcome$1.actionPerformed(Welcome.java:35)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5806)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4413)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2440)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

the error seems to point to the fact that it cannot find the User class, is it in the same folder? Which compiler are you using?

You'll need an explicit import statement for the User class unless
it's in the same package as Welcome. Probably you don't have both classes saved in the same folder, make sure that they both exist in the same folder.

the error seems to point to the fact that it cannot find the User class, is it in the same folder? Which compiler are you using?

You'll need an explicit import statement for the User class unless
it's in the same package as Welcome. Probably you don't have both classes saved in the same folder, make sure that they both exist in the same folder.

all the classes is in the same folder..i use netbeans compiler.

your code snipped doesn't shows java import, and any imagine about User class, maybe that's look like as throuble with Java DeskTop Aplications (JRS 296), not exactly with constuctor, maybe will be better ask for help on Netbeans Forum

can you show us the user class or the admin class

can you show us the user class or the admin class

this is my user class

import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;

class Login extends JFrame
{

public void Menu()
{
    JFrame amy = new JFrame("Malay Synonym Word Checker");

    amy.setSize(500,500);
    amy.setVisible(true);
    amy.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

     JMenuBar bar = new JMenuBar();

		setJMenuBar(bar);

		JMenu fileMenu = new JMenu("File");
		fileMenu.setMnemonic('F');
		JMenu helpMenu = new JMenu("Help");
		helpMenu.setMnemonic('r');

		bar.add(fileMenu);
		bar.add(helpMenu);

		JMenuItem aboutItem = new JMenuItem("About");
		aboutItem.setMnemonic('A');
		aboutItem.addActionListener(

		new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				JOptionPane.showMessageDialog(getRootPane(), "This is a final year project by \nNur Amillia bt Amran.", "About", JOptionPane.PLAIN_MESSAGE);
			}
		}
		);

		JMenuItem exitItem = new JMenuItem("Exit");
		exitItem.setMnemonic('x');
		exitItem.addActionListener(

		new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				System.exit(0);
			}
		}
		);

		fileMenu.add(aboutItem);
		fileMenu.addSeparator();
		fileMenu.add(exitItem);

                 JPanel mypane = new JPanel(new GridLayout(5,3));
                JButton Search = new JButton("SEARCH");
                Search.setMnemonic('a');
		Search.addActionListener(
                new ActionListener()
                  {

                    JButton SEARCH;
                    JLabel label3;
                    JTextField search;
                    public void actionPerformed(ActionEvent e){

                final JFrame s=new JFrame("Malay Synonym Word Checker - SEARCH WORD");
                                s.setLayout(null);

				label3 = new JLabel();
                                label3.setText("WORD:");
                                search = new JTextField(15);

                                SEARCH=new JButton("SEARCH");
                                label3.setBounds(60,50,150,28);
                                search.setBounds(120,50,170,25);
                                SEARCH.setBounds(310,50,83,28);

                                s.add(label3);
                                s.add(search);
                                s.add(SEARCH);
                                s.setVisible(true);
                                s.setSize(450,250);

                                SEARCH.addActionListener(new ActionListener(){
                                public void actionPerformed(ActionEvent ae) {

                                String value1=search.getText();

                                try{
                                 Class.forName("com.mysql.jdbc.Driver");
                                 Connection con = DriverManager.getConnection("jdbc:mysql://localhost/finalproject", "root", "Amillia89");
                                 Statement st=con.createStatement();
                     ResultSet rs=st.executeQuery("select * from synonym where words='"+value1+"'");
                     String words="";
                    if(rs.next()){
               words=rs.getString("words");

           }

            if (value1.equals(words)) {

         System.out.println("Synonyms :" + rs.getString("synonyms"));
           JOptionPane.showMessageDialog(null,"Synonyms :" + rs.getString("synonyms"));

      s.add(search);
       s.setSize(459,250);

         }
                    else{
            
             JOptionPane.showConfirmDialog(null,"Word not found.\n Add the word to the database?", "NotFound", JOptionPane.YES_NO_OPTION);
            search.setText("");


         }
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
}

 });
                               }
                              }
                             );


                 mypane.add(Search);
                 mypane.add(new JLabel(""));

                amy.add(mypane);
                amy.setVisible(true);
                amy.setSize(550,200);
		amy.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	}

}
 class LoginDemo
{
  public static void main(String arg[]){

    new Menu();

}
 }
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.