• Post Reply Bookmark Topic Watch Topic
  • New Topic

event handling problem

 
Tamana Joshi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

wenever i compiles this code it gives error "ILLEGAL START OF EXPRESSION"
why is it so i really cant understand,this is a main form of banking managment system.
plz help

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


public class banksystem extends JFrame implements ActionListener
{
public static void main(String args[])
{

JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("ABC BANK");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPanel contentPane = new JPanel(new BorderLayout());


JLabel lb = new JLabel("WELCOMW TO ABC BANK");
lb.setBackground(Color.blue);
lb.setFont(new Font("MS Comic Sans", Font.BOLD,36));
lb.setPreferredSize(new Dimension(200, 180));

JButton b1 = new JButton("CONTINUE");
b1.addActionListener(this);
b1.setBackground(Color.red);
b1.setPreferredSize(new Dimension(20, 18));


frame.getContentPane().add(lb, BorderLayout.CENTER);
frame.getContentPane().add(b1, BorderLayout.PAGE_END);

frame.pack();
frame.setVisible(true);



public void actionPerformed((ActionEvent event){

this.dispose();
banksysteml b = new banksysteml();
b.setVisible(true);
});

}


}


thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The bold characters don't belong there. Maybe you were copying a definition of an anonymous class without understanding the syntax?
 
Tamana Joshi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks

even i complied without these parentheses, but it gives 2 errors now
1)";" expected at line 41
2) illegal start of expression
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are trying to put a method inside your main method.

 
Tamana Joshi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks it worked

plz tell me one more thing if i hav to change background color after every 5 seconds how can i do it with the help of TImer??

thnks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!