Win a copy of Head First Android this week in the Android forum!

Ben Jass

Ranch Hand
+ Follow
since Sep 25, 2010
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 Ben Jass

Couple questions for everybody who wants to chirp in. I really appreciate everyone's feedback.

1 ) The way my school works when you get your Associates in Programming is you specialize in a certain field. If I have already studied Java on my own master, but I'm proficient in the fundamentals and I'm beginner-intermediate w/ advanced topics. Which of these choices would make me the most desirable developer?

   1) Major in Java to refine my fundamentals and practice more advanced topics.
   2) Major in Web Development (Html, xml, javascript)
   3) Major in Mobile Development (iOS + android)
   4) Web 2D based Game Development (idk what language is emphasized here, but a few courses on photoshop + 1 on 3D)

2) What benefits will I see in the job world from getting a Associates in Programming vs a certificate? For example, if I get a Associates in Java programming. The only classes that are added on vs. a certificate is:

   - Computer Networking
   - Intro to Computer and Programming Concepts
   - Intro to Algorithms + Data Structures
   - Machine Architecture + Organization
   - My choice of: A Serverside, clientside or Objective-C course.

A few of these I already feel I have a good grasp on, if not I could just buy a book and learn that way too?

Just looking for some feedback because I'm struggling with how getting a degree will benefit me that much more getting a Job and on the working on the field.
5 years ago
Thank you guys for your responses. Was able to use Jdialogs and you can adjust their modality in the constructor. I will look further into JLayer's, thank you.
5 years ago
Question 1:

Let's say I have two windows (Picture 1)

How do I make the window on the backside, unclickable or uneditable?

Question 2:

Going one step further, if I wanted to blur out the window on the backside. How would I do this if the back window is made up of JComponents?
5 years ago
So this behaves the same as a JTextPane or a Swing component, I can add a ScrollPane to it? Where I can modify Strings? Can be directly added to a JPanel?

I see insertString(offset, string, attribute), is the attribute parameter where I would insert something like Color.BLUE? The offset is simply the location?
5 years ago
So I'm working on making a small chat client. The area where you display different user messages I originally had as a JTextArea. I realized that (to my knowledge), I can't change the color of specific Strings in the component without changing the color of all the text. Such as Usernames, specific words, etc.

A little research shows that JTextPane allows you to modify Strings apart from others. However, it doesn't have the append() method from JTextArea which allows me to add text directly after that last line. I didn't see that JTextPane inherited any type of method such as that.

If someone could give me some pointers on how add messages one after another without an append() method in JTextPane?
Or maybe there's something I'm missing? Completely different text component that I can use?

Thanks guys.
5 years ago
Sorry lol, I simply forgot the new keyword. I was trying to save you guys from seeing the whole program. I'm trying to shorten this down to the keyparts:

Initialized Instance =

Connection to Server:

Sock still has it's values..
After so and so user action, we come to this call:

5 years ago
I've established a connection between a client and server. On the client side, I'm trying to pass a socket as an argument to a constructor.

However, Whenever I do this, when I attach a stream I get a big fat null. (Yes, I initialized in the constructor).

Are Socket's not able to be passed over as arguments? How would I do this without any polymorphism? So that the same connection gets brought over to another class?
5 years ago
Okay, Yeah I didn't get a whole lot of background for handling multiple types of streams.

- Server Running...

- Client Running...
-> Connects to Server
-> Server sends currentPlayerList to client (So user can login)

- If User needs to create a new player
-> Send new Player to Server so Server can update playerList (...and then saves the playerlist to a file)

- When user logs in (Haven't created this yet)
-> Types message into JTextField
- Sends to Server which disperses it among all clients

This is all I have now, and I only have the GUI for the login window and create new player window

- Scratch having two threads
- One thread constantly reading if the client sends an object or a string of text
- Implement code from there accordingly


Something like:

I've added System.out.println for debugging between threads. The code above won't even finish after the first thread is initialized.



Hey guys, just finished reading my first book on Java and I'm working on a Chat Client/Server project so I can dig a little bit into streams, multi-threading, saving objects, etc.

At the moment, I'm a little puzzled.

The way I think this through in my head (and you can tell me if this is completely wrong) is when the server accepts a client,
- I want to create a separate thread for any messages that might come through (text, when people are typing back and forth).
- The other thread is constantly waiting for any Objects that are sent to the Server so I can update the Player list.

This is my code for accepting another client:

I have two inner classes that implement Runnable and have their own run() methods that are being executed by two threads.
However, the program doesn't want to initialize both threads? If I have them both in there it won't make the second thread?
If I have just one thread created in this procedure than everything works fine?

Please tell me if I'm doing something completely incorrect here. If you need more code, let me know. Keep in mind, this is my FIRST thread project.

PS: After looking this over, is the solution to have another thread constantly just doing the accepting process of clients?
Oh wow. Didn't even think about that guys, really appreciate the help.
5 years ago
Hey guys, I'm parsing data from a .txt file:

For some reason, when I use the trim() method, it only trims the first whitespace.

" Benjamin "


"Benjamin "

But I can never get rid of the last whitespace? I've tried the replaceAll(" ", ""); method. Doesn't work. There isn't any hanging whitespaces in the code OR in the .txt file
5 years ago
Exporting a project into a JAR file hasn't been working for me. Program runs fine in Eclipse. However if I export it into a Runnable OR a standard JAR file. They won't run past the first window. I have 3 Gui's. A Begin one, disposes than opens the next window upon certain commands, and the third window after that. After the first window, nothing happens as if the program just quit or had an error. I created a manifest, included all pictures in the exporting. Any help?
5 years ago
Thanks, from the reviews that I'm seeing that looks like a very good book to get into. Anyone have any recommendations on good 2D / 3D Gaming books?
5 years ago