my dog learned polymorphism
The moose likes Applets and the fly likes 85 line program...wondering if it's possible to do in Applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "85 line program...wondering if it Watch "85 line program...wondering if it New topic

85 line program...wondering if it's possible to do in Applets

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

I have never created an applet before. I do know Java and HTML though. I have a server, which is currently running as an application. Is there a way to port this to an Applet? If the server was online (I have a website that I could put it on), I wouldn't have to have it running on my computer. The client is running and will run as an application. Here is my server code:
NOTE: Places that are security codes and otherwise things you shouldn't know will be replaced with ******'s...Don't worry about that, just the application.

Do I have to make any major changes? Do I just have to extend Applet?
John Price aka cc11rocks

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

I don't see a GUI, so I can't understand what would be the point of making it an applet. It is possible to have applets which don't display anything in their GUI, but why would you want a chat server to run as an applet?

Also you would have to sign your applet to allow it to act as a socket server.
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

I just need a server to be online, and not on my computer. Would a user have to be on my website for the server to work? If so, this is not what I want. I just got my first applet up and running on my website, so I guess I know how to use it know.
Check my knowledge please:
Applet starts code from init() method.

From the init method, you can add other methods to run?

Example of my Question (no I'm not writing code, just making sure I know how applets work):

If someone typed any character, the jtextfield would display the string "Hello World" in their, correct? I just want to make sure everything is the same.

General questions:
How do you use/create and what are signed applets?
What are the major differences between Applets and Applications, coding-wise? (I know there is no JFrame, JPanel, etc.)

cc11rocks aka John Price

EDIT FOR CLARIFICATION(To the people who may think I'm stupid and/or don't know how to code):
Yes, I know the code uphead won't compile. I am using a general overview to ask my question and give an example. I know you have to implement keylistener and use all the methods and stuff. I realize the jtextfield isn't initialized. This is a general type code, mostly asking about syntax and not about the code itself, since Java Applications and Applets (to my knowlege), have the same code (and especially for JTextFields).
I agree. Here's the link:
subject: 85 line program...wondering if it's possible to do in Applets
It's not a secret anymore!