I created a class that extends JPanel which gets the page source of a file that I uploaded to the internet (it simply says "This is a text file" on several lines).
And this is the class:
When I test the main method it works just as intended. A blue panel with a JTextArea with appropriate text.
However, when I try adding this to an applet, all that shows up is a blue box, there isn't a text area. I even tried manually resizing it just to make sure it wasn't a paint thing.
this is my applet code:
I can't tell what's wrong with it. Can anyone help?
Lester Burnham wrote:If you import "java.awt.*", it's not a good idea to refer to a class called "Panel". In other words, rename that class.
Oh wait, you said it is actually blue. Hm ... start by deleting that "paint" method. That's an AWT thing that doesn't work in conjunction with Swing.
Okay I'll try that.
Hm. Still nothing.
And on a side note, does someone here know anything about MySQL databases and JDBC drivers?
If you want to do this from an applet, you need to enter into the fun world of code signing -- and I say "fun" in the most sarcastic possible way. See here for an introduction:
So I made that temporary website that I referenced for the URL. Would I be able to directly refer to the file as new File("Text.txt"); because they are in the same folder on the server? Or would that not work since the code is only read until the browser executes it...
I need to be able to change the file dynamically in the complete project that I want to put in.
Sorry, but I have no experience in web stuff so it's all pretty confusing to me X)
Is there any way that I could get around this then? Would I have to make some sort of database?
The process running on the server could be many things. It could be an FTP server which accepted uploads, or it could be a Java servlet, or a PHP script, and so on.
(I have lost count of the number of times I have seen forum threads where the real-life implications of applets have to be explained to people who thought an applet would be a good thing to use. Don't the textbooks which tell you how to use applets talk about this at all?)
Would this servlet send out and accept say an ArrayList of strings?
I think to move on I need to know the best way to approach my problem:
What I need is to be able to store strings to a file(or some other source of memory) and modify them and also add new strings. I also need to have separate memory locations for three different groups of names and another for tournament info.
It would also be great if separate brain classes would be able to access the info at the same time, but it is not a necessity.
If anyone can tell me the best way to approach this I can then seek help in the appropriate forum.
Thanks for all your help guys