whtennisfan115
New member
Hey everyone. I was hoping to get some help with a personal Java project I'm trying to code. Let me start off by saying that I'm no Java expert so I'm trying to work within the "basics" so to speak. But I feel like what I've got planned shouldn't be that hard. So here's my issue...
I'm trying to implement a sort of "simulated" chat applet. I don't want to work with IP addresses or anything like that so here's how I'm envisioning this working.
1. Every user that launches the applet receives a popup(JOptionPane.inputdialog thingy) that asks for the chatroom name. Lets say I pick "MikesChat" as the name.
2. I'd like the program to then take that name I enter and create a file called: MikesChatlog.txt.
3. After that, the first user enters in a screen name in a second pop up.
4. After that I have a Graphical User Interface set up, that has a long thin text field for entering messages, and a big thick one for displaying them. I also have a send button(JButton) that currently just pretty much moves whatever you type in the thin text field, over to the big one(overwriting what was previously there.
5. The real key to this is, the first user gets the MikesChat.txt created. Then the next user enters the same name in, so their applet is referencing that exact same text file. Then when they get to the interface, I want the send button to actually append what they typed to that text file, while the display area then reads said text file and displays it(every second or so) allowing the users to simulate chatting without using IP addresses and the like.
------------------------------------
Basic summary if you don't want to read that long part
User 1: Creates chat room by entering its name in a JOptionPane box, causing the program to make a corresponding text file.
User 2: enters the same name, thus referencing that text file as well, causing both user's applets to be working with the same file.
Then any user that types something in and clicks the send button causes that text to be written to the text file that they are both separately editing, while their display field is reading from it every couple of seconds or every second thus displaying any changes they make in near real time to simulate chatting.
I'm at the point where I've got the pop ups working fine. I even got it to create a file using the name that the user puts in. Unfortunately I seem to have to do so in a separate method and I can't get the rest of the program to write to it properly. Any advice would be helpful and if you need more info I'll be happy to discuss it further!
I should have said "I can't get the rest of the program to write to it AT ALL actually. Thanks again guys.
I'm trying to implement a sort of "simulated" chat applet. I don't want to work with IP addresses or anything like that so here's how I'm envisioning this working.
1. Every user that launches the applet receives a popup(JOptionPane.inputdialog thingy) that asks for the chatroom name. Lets say I pick "MikesChat" as the name.
2. I'd like the program to then take that name I enter and create a file called: MikesChatlog.txt.
3. After that, the first user enters in a screen name in a second pop up.
4. After that I have a Graphical User Interface set up, that has a long thin text field for entering messages, and a big thick one for displaying them. I also have a send button(JButton) that currently just pretty much moves whatever you type in the thin text field, over to the big one(overwriting what was previously there.
5. The real key to this is, the first user gets the MikesChat.txt created. Then the next user enters the same name in, so their applet is referencing that exact same text file. Then when they get to the interface, I want the send button to actually append what they typed to that text file, while the display area then reads said text file and displays it(every second or so) allowing the users to simulate chatting without using IP addresses and the like.
------------------------------------
Basic summary if you don't want to read that long part
User 1: Creates chat room by entering its name in a JOptionPane box, causing the program to make a corresponding text file.
User 2: enters the same name, thus referencing that text file as well, causing both user's applets to be working with the same file.
Then any user that types something in and clicks the send button causes that text to be written to the text file that they are both separately editing, while their display field is reading from it every couple of seconds or every second thus displaying any changes they make in near real time to simulate chatting.
I'm at the point where I've got the pop ups working fine. I even got it to create a file using the name that the user puts in. Unfortunately I seem to have to do so in a separate method and I can't get the rest of the program to write to it properly. Any advice would be helpful and if you need more info I'll be happy to discuss it further!
I should have said "I can't get the rest of the program to write to it AT ALL actually. Thanks again guys.