![]() |
| ||
| Big errors i got plz help me out illegal type of expression type, import javax.swing.*;/* errors:- C:\>javac panel.java panel.java:14: <identifier> expected lang="abc"; ^ panel.java:18: <identifier> expected p.setSize(100,100); ^ panel.java:18: illegal start of type p.setSize(100,100); ^ panel.java:19: <identifier> expected p.setLayout(new GridLayout(3,0)); ^ panel.java:19: illegal start of type p.setLayout(new GridLayout(3,0)); ^ panel.java:21: <identifier> expected p1=new JPanel(); ^ panel.java:22: <identifier> expected p2=new JPanel(); ^ panel.java:23: <identifier> expected p3=new JPanel(); ^ panel.java:24: <identifier> expected p4=new JPanel(); ^ panel.java:25: <identifier> expected l1=new JLabel(lang); ^ panel.java:26: <identifier> expected l2=new JLabel(); ^ panel.java:27: <identifier> expected l3=new JLabel(); ^ panel.java:29: <identifier> expected b1=new JButton(); ^ panel.java:30: <identifier> expected b1.setIcon(button); ^ panel.java:30: <identifier> expected b1.setIcon(button); ^ panel.java:31: <identifier> expected b1.setOpaque(false); ^ panel.java:31: illegal start of type b1.setOpaque(false); ^ panel.java:32: <identifier> expected b1.setFocusPainted(false); ^ panel.java:32: illegal start of type b1.setFocusPainted(false); ^ panel.java:33: <identifier> expected b1.setBorderPainted(false); ^ panel.java:33: illegal start of type b1.setBorderPainted(false); ^ panel.java:34: <identifier> expected b1.setContentAreaFilled(false); ^ panel.java:34: illegal start of type b1.setContentAreaFilled(false); ^ panel.java:35: <identifier> expected b1.setBorder(BorderFactory.createEmptyBord ^ panel.java:35: <identifier> expected b1.setBorder(BorderFactory.createEmptyBord panel.java:36: <identifier> expected b1.setBorderPainted(false); ^ panel.java:36: illegal start of type b1.setBorderPainted(false); ^ panel.java:37: <identifier> expected b1.addActionListener(this); ^ panel.java:37: illegal start of type b1.addActionListener(this); ^ panel.java:38: <identifier> expected b1.setBackground(Color.green); ^ panel.java:38: <identifier> expected b1.setBackground(Color.green); ^ panel.java:40: <identifier> expected p1.setBackground(Color.black); ^ panel.java:40: <identifier> expected p1.setBackground(Color.black); ^ panel.java:41: <identifier> expected p1.add(l1); ^ panel.java:41: <identifier> expected p1.add(l1); ^ panel.java:42: <identifier> expected p2.setBackground(Color.green); ^ panel.java:42: <identifier> expected p2.setBackground(Color.green); ^ panel.java:43: <identifier> expected p3.setBackground(Color.red); ^ panel.java:43: <identifier> expected p3.setBackground(Color.red); ^ panel.java:44: <identifier> expected p4.setBackground(Color.blue); ^ panel.java:44: <identifier> expected p4.setBackground(Color.blue); ^ panel.java:45: <identifier> expected p.add(p1); ^ panel.java:45: <identifier> expected p.add(p1); ^ panel.java:46: <identifier> expected p.add(p2); ^ panel.java:46: <identifier> expected p.add(p2); ^ panel.java:47: <identifier> expected p.add(p3); ^ panel.java:47: <identifier> expected p.add(p3); ^ panel.java:48: <identifier> expected p4.add(b1); ^ panel.java:48: <identifier> expected p4.add(b1); ^ panel.java:50: <identifier> expected frame.add(p,BorderLayout.CENTER); ^ panel.java:50: <identifier> expected frame.add(p,BorderLayout.CENTER); ^ panel.java:50: <identifier> expected frame.add(p,BorderLayout.CENTER); ^ panel.java:51: <identifier> expected frame.add(p4,BorderLayout.SOUTH); ^ panel.java:51: <identifier> expected frame.add(p4,BorderLayout.SOUTH); ^ panel.java:51: <identifier> expected frame.add(p4,BorderLayout.SOUTH); ^ panel.java:52: <identifier> expected frame.pack(); ^ panel.java:53: <identifier> expected frame.setVisible(true); ^ panel.java:53: illegal start of type frame.setVisible(true); ^ panel.java:55: illegal start of type try ^ panel.java:65: illegal start of type catch(Exception e) ^ panel.java:65: ';' expected catch(Exception e) ^ 61 errors */ |
| ||
| Re: Big errors i got plz help me out illegal type of expression type, Yes. Because you have no main method - you need to put any code (other than variable declarations) inside methods. The main method is the method that runs when you first start your program, *edit* Oops, nevermind - I see that you do have a main method. For statements like String lang, then lang = "abc", you would need to initially just say String lang = "abc"; . . and what I said about only having variable declarations still stands. lang = "abc" is an assignment statement, and thus, isn't allowed unless you do it inside of a method. |
| ||
| Re: Big errors i got plz help me out illegal type of expression type, edit, sorry guys. Combined the two posts. |
| ||
| Re: Big errors i got plz help me out illegal type of expression type, I am not satisfied with this answer |
| ||
| Re: Big errors i got plz help me out illegal type of expression type, It gives me errors like previous one |
| ||
| Re: Big errors i got plz help me out illegal type of expression type, Satisfied or not, he's right. Everything except variable declarations have to be inside a method. Post your latest code, with code=java tags. |
| ||
| Re: Big errors i got plz help me out illegal type of expression type, Guys i changed the code now i get 3 errors plz HLP me out errors are after the code //code /*<applet code=panel.class height=300 width=500></applet>*//*errors C:\Documents and Settings\Desktop>javac panel.java panel.java:54: illegal start of type try ^ panel.java:70: illegal start of type catch(Exception e){ ^ panel.java:70: ';' expected catch(Exception e){ ^ 3 errors */ |
| ||
| Re: Big errors i got plz help me out illegal type of expression type, Everything except variable declarations still have to be inside a method. Indent your code so you can see where methods and classes end. Your errors start immediately after the end of the init method because the following code isn't in a method. This would have been obvious to you with proper indentation and code tags. |
| ||
| Re: Big errors i got plz help me out illegal type of expression type, ps: If you have code that looks like this: catch(Exception ee) {}then what you are saying is: "if my code goes wrong I do not want to know why or where it happened. Please just stop executing and give me no help at all".Try replacing all those with catch(Exception ee) {so you know what's happening. |
| ||
| Re: Big errors i got plz help me out illegal type of expression type, thnks my code is now running |
| All times are GMT -4. The time now is 1:22 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC