Alex Sinclair

+ Follow
since Feb 07, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alex Sinclair

Using the same stage only changes the contents of the same window, although that is very good to know for future reference.

Updating my driver worked. Looking back that probably have been my first step. I'm used to upgrading my driver for games, not Java >.>

9 years ago
Yeah, those samples are fine, and yes it's my graphics driver. I can run a single Stage with a single Scene, it's when I try to show a second Scene that the driver goes unresponsive. I'll try updating it.
9 years ago
I've always been a fan of Swing, but I decided recently to try out JavaFX now that I don't have to learn a new scripting language. I'm still looking for a good JavaFX 2.0 resource, so I'm sort of winging everything here, and I've run into an odd problem.

I'm trying to display a new window with some input controls when the user presses a button. The only way to display a window (other than undecoroated popup windows) that my Google-fu has produced is by using a Stage, so inside of the handle() method I create a new Stage and show it. When it's empty, everything is fine. However, if I add a Scene to the Stage (so I can add the controls), when I press the button my display driver crashes. When it recovers the new window is there, but if I try to tab to it then it crashes again.

Any solution would be great, either fixing the cause of the crash, or a better way to implement a new window that hopefully doesn't crash.
9 years ago
I have been creating it with one server in mind from the start, so that's good.

I found my router information and forwarded a port. When I try to connect to my server from a client on the same machine using the external IP, I get a ConnectException. I've read that some routers won't let the internal network to connect to the external IP of the router. I sent the client to a friend and she was not able to connect, but says that it can see my service. Is there an easy way to test the connection on one machine? I can test all the other functionality by using localhost.
I suppose what I'm looking for just isn't possible, as there appears to be more user setup than I would like. For instance, I do not know the login information for my router, and I doubt this would be an uncommon problem. I could probably dig it up, but I barely want to do that - why would anyone else?

Anyway, thanks for the help. At least I learned something through all of this.
Thanks for the replies.

I've looked into port forwarding in Java, but unfortunately I haven't been able to find a clear example for beginners.

Henry, you said that the machine needs to be configured. By this do you mean that user running the client needs to manually change system settings in some way? I was hoping the setup between the person running the server and the person running the client would be a lot easier than that.

I'll explain what I'm trying to do in case there is an easier way that I have not considered. In essence, I want to create an application that would function similarly to a chat room, only instead of chatting, users are simply toggling a busy/available status that is displayed to everyone in the chat room. For example, one user might press a hotkey to toggle into "busy" mode, and then all the other users would receive a message saying that said user is now busy and processes it accordingly. Ideally, the setup for this "chatroom" would be as simple as possible. I was hoping one person could simply host a server, distribute his IP address, and then users could connect to it, like you might when hosting your own Ventrilo server.

If there's no better way than the way that I'm currently not understanding, then I'm afraid I might be in trouble.
I've been using Java for a few years now and, until now, I've always felt like I could overcome any obstacle in Java with a little Googling and some trial and error. Recently I decided to give Sockets a try after avoiding learning anything network-related for my entire programming career, but I don't think I can go any further on my own. To state it bluntly, I really have no idea how the internet works insofar as programming is concerned.

Currently all I want to do is to be able to send a message to a server across the internet, have the server process that message, and then have the server send messages back to multiple clients. I'm going to post bits and pieces of code rather than posting everything for now because, at this point, the issue is really just fundamentals. I also think it's important to explain what I hoped the code did. What I have written works fine when I run it locally, but that's probably expected. If nothing looks amiss here I will post the full thing, but like I said, I think the problem is just my understanding of the code rather than the code itself.


1. I create a server:

2. I then wait for and accept all clients attempting to connect to the server:

3. I obtain some sort of way to read messages from the client (a thread is started for each client by this point):

4. I read messages from the cilent and process them in some way:

5. I obtain some way to write message to the client:

6. I write a message to the client:


1. I connect to a server:

2. I obtain some way to write messages to the server:

3. I write a message to the server:

4. I obtain some sort of way to read messages from the server:

5. I read messages from the server and process them in some way:

When creating the Socket for the server in the client, the host I use is the IPv4 address I get when I run ipconfig. I used port 1982. I don't really know what either of those mean, but it worked in testing so I ran with it. I also obtain the same address when I run:

When I give that address to a friend across the country running the client, however, absolutely nothing works. I guess I sort of expected some wizardry to take over and for everything to work out fine by sharing a single IP address, but now I'm back at square one and hours and hours of Googling haven't lead me any closer to an answer. Any help would be appreciated.