Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help me,i can't fix this code

 
dhuha al khoiri
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i found error in this code,and i try to fix it with eclipse,but i can't,i didnt know why,can all of you help me fix this code?

and the error in public class SwingApplet,i try to fix it,but i am still can't fix it,altough i always try,help me please


 
Tim Moores
Bartender
Posts: 2500
10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you going to tell us what the problem with this code is, or are we supposed to guess?
 
Thakur Sachin Singh
Ranch Hand
Posts: 242
Hibernate Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
without knowing how we will give you answers?
 
dhuha al khoiri
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the error is in:

public class SwingApplet extends JApplet {

the error said: the public type SwingApplet must be defined in its own file

why this can be happen??

and i try to fix it with eclipse,but the code still error,altough i was try so many times,i still can't recognize where is the error from this code

please help me,thanks...
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dhuha, you've been told about using code tags when you posted in this thread. I've added them for you, but you have to form a habit of reading responses to your posts and learning from them.

A file can contain only one public class, and a public class must be in a file with a name that matches the class name. Your SwingApplet code needs to be in a file named SwingApplet.java.

What are you trying to do with a JFrame class and a JApplet class together anyways?
 
dhuha al khoiri
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i try to make swing applet,so i combine code from applet that i was learn before from my lecturer,and that code is JApplet class

and my code is Jframe,so i combined it, and hope can make a new code,that have a swing applet in it,is it right? or is it wrong?

so how come if i want to make an applet,but have a swing feature? i dunno


and about my habit,forgot to use code tags,i don't know to use it in this forum
where i can find codetags?and what button should i click? how i can make it,like you did?
explain it to me...

thanks,and sorry for my mistake,because i did'nt know to use code tags
 
Tim Moores
Bartender
Posts: 2500
10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Java source file can have only one public class. You'll need to move that class to its own source file.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to create two java files:

SwingApplet.java
HelloWorldFrame.java

Since they don't appear to depend on each other from your code, compile and run separately.

WP
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dhuha al khoiri wrote:and about my habit,forgot to use code tags,i don't know to use it in this forum
where i can find codetags?and what button should i click? how i can make it,like you did?
explain it to me...

Maneesh gave you a link in the other thread I posted a link to here, but since you didn't see it there, I'll give it to you again: UseCodeTags <-- link
 
dhuha al khoiri
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for all of you,this forum so amazing!
you guys are really help me..

thank you so much,and if i have another question,i will ask again in this forum

God Bless You All...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic