• Post Reply Bookmark Topic Watch Topic
  • New Topic

Not able to insert Label into frame  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to make a small application using frames. The code compiles and runs perfectly as I want it without Label. But if i insert Label it throws around 40 errors.



It throws the following errors:

Applicationn.java:25: error: not a statement
Label class = new Label("PLLSSSS");
^
Applicationn.java:25: error: ';' expected
Label class = new Label("PLLSSSS");
^
Applicationn.java:25: error: <identifier> expected
Label class = new Label("PLLSSSS");
^
Applicationn.java:25: error: illegal start of type
Label class = new Label("PLLSSSS");
^
Applicationn.java:25: error: illegal start of type
Label class = new Label("PLLSSSS");
^
Applicationn.java:26: error: <identifier> expected
ob.add(class);
^
Applicationn.java:26: error: illegal start of type
ob.add(class);
^
Applicationn.java:32: error: <identifier> expected
ob.setLayout(new BorderLayout());
^
Applicationn.java:32: error: illegal start of type
ob.setLayout(new BorderLayout());
^
Applicationn.java:32: error: ')' expected
ob.setLayout(new BorderLayout());
^
Applicationn.java:32: error: ';' expected
ob.setLayout(new BorderLayout());
^
Applicationn.java:32: error: illegal start of type
ob.setLayout(new BorderLayout());
^
Applicationn.java:32: error: <identifier> expected
ob.setLayout(new BorderLayout());
^
Applicationn.java:42: error: <identifier> expected
ob.addWindowListener(new WindowAdapter()
^
Applicationn.java:42: error: illegal start of type
ob.addWindowListener(new WindowAdapter()
^
Applicationn.java:42: error: ')' expected
ob.addWindowListener(new WindowAdapter()
^
Applicationn.java:42: error: ';' expected
ob.addWindowListener(new WindowAdapter()
^
Applicationn.java:42: error: illegal start of type
ob.addWindowListener(new WindowAdapter()
^
Applicationn.java:42: error: <identifier> expected
ob.addWindowListener(new WindowAdapter()
^
Applicationn.java:43: error: ';' expected
{
^
Applicationn.java:48: error: illegal start of expression
});
^
21 errors
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does the fact that in the statement



the word "class" is a different color indicate anything to you?
 
Hemanth Reddy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I just realized. I still use notepad so I don't know if the colors mean anything actually. Thanks anyways !!
 
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May I ask why, in this day and age, you are learning to use AWT widgets? Swing has been in existence for well over a decade now (and of course the latest craze is Java FX 2).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!