Results 1 to 4 of 4
Thread: Problem with applets!!
- 09-11-2011, 01:54 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 2
- Rep Power
- 0
Problem with applets!!
I am a newbie to eclipse and java. I wrote a programme but when tried to run it, eclipse compiler generated an error : "Editor does not have an applet. Please help me out!!!
Java Code:import java.io.IOException; import javax.swing.JApplet; public class mohsin extends JApplet{ public static int a,b,c,o; public void main(String[] args) throws IOException { System.out.println("Enter an operator code to continue:"); System.out.println("\n1 for addition.\n2 for subtraction."); System.out.println("\n3 for division.\n4 for multiplication"); o = System.in.read(); mohsin.option(o); } public static int addition (int a,int b) { c = a + b; return c; } public static int subtraction (int a,int b) { c = a - b; return c; } public static int division (int a, int b) { c = a / b; return c; } public static int multiplication (int a, int b) { c = a * b; return c; } public static int option (int o) { switch(o) { case 1: mohsin.addition(a, b); break; case 2: mohsin.subtraction(a, b); break; case 3: mohsin.multiplication(a, b); break; case 4: mohsin.division(a, b); break; default: System.err.println("Wrong number entered, try again: "); } return c; } }
-
Re: Problem with applets!!
If you're trying to run this as an applet, you're doing it all wrong. In fact your code is not GUI code at all, but rather a simple console program.
First and foremost, decide what you want: a simple console program or an applet GUI. If the latter, then you'll need to read an applet tutorial as it will help you to understand what you need (such as an init method).
- 09-12-2011, 12:09 PM #3
Member
- Join Date
- Sep 2011
- Posts
- 2
- Rep Power
- 0
Re: Problem with applets!!
I just want to run the programme, whether simple or applet. I was forced to do applet by the compiler because when i clicked run, instead of running, it gives me option to run in either java application or applet. Please tell me how can i run this programme in simple
- 09-12-2011, 02:10 PM #4
Similar Threads
-
Help with embed problem with applets
By Beginner in forum New To JavaReplies: 0Last Post: 10-22-2010, 10:31 AM -
Linux java applets: printing problem
By dixan in forum Java AppletsReplies: 0Last Post: 01-28-2010, 02:52 PM -
I need help with Applets
By ProgrammingPup in forum Advanced JavaReplies: 1Last Post: 12-22-2009, 08:07 PM -
problem with applets?
By srikanthnambu in forum Java AppletsReplies: 2Last Post: 05-22-2009, 06:08 AM -
problem with applets..
By sireesha in forum New To JavaReplies: 3Last Post: 05-21-2009, 03:36 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks