Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Meshulam Silk

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

Recent posts by Meshulam Silk

Welcome!

This book looks absolutely great. Definitely passing the name on to coder friends who aren't on the ranch.
4 years ago
Hey there
Is it ok with you if I ran your generator on my computer? This just looks really cool and a place I might wanna start dealing with cellular automata. (If so, you mind posting your most updated code?)
Don't worry I won't claim anything as my own, I just wanna have a look if that's ok.

EDIT: About the disconnected bits: you can find the "main" cave and use a flood fill method to mark it and all it's connected branches, then go over every spot and if it's not marked, turn it into a wall (this means that there will be a lot more walls than before but this system is pretty much the easiest).
6 years ago
Thanks for the quick reply. I'll have a look.
6 years ago
I'm making a game using a grid and I recently decided to make a circle drawer. After a bit of deep trig thinking I came up with a simple way to plot a circle:



I get the circle just fine I just wanted to know of there was a more efficient way to increment i instead of going through all the angles.
I came up with a this: i+=45/(radius-2)
I've tried it out and it seems to work pretty well for smaller circles but I think (haven't had a chance to test) it might screw up with bigger circles. Does anyone know of this is the most efficient incrementation (or if it's right)?
6 years ago
Yup the center tags worked perfectly!

Before:

After:


It's a tiny change but looks so much better.
Thanks everyone!
6 years ago
That actually looks like exactly what I need.
Thanks man! I'll try this and using JTextArea and tell you which works best.
6 years ago
I'll try that out. Thanks!
6 years ago
I saw this too and tried it out. The problem with it is that the second line will align to the first line and won't be centered if it's a different length.
Also it trims the string so I can't put in spaces or tabs to nudge it. Is there a way to do this maybe?
6 years ago
I actually had a look into JLabels because of they wrap but I couldn't get them to show on top of each other, they just went side by side. Do you know which layout I should use? I tried a couple I found online but none did it.

Randall: I thought so too but no, they just run off. Also it's not THAT urgent.
6 years ago
Hey there
I have a String which contains multiple lines ("\n") and I want to add it to a JDialog window. The thing is, the JDialog isn't wrapping around the text so some longer lines in the String will just run off the edge.
I there any way I can get the JDialog to resize itself so it fits the whole String into it?
6 years ago
I have a java program which creates a file on the computer.
This obviously only works on administrator accounts.
When on a normal account the program just quits.
I wanted to know if there was a way to use try/catch to know when the user running the program is not an admin.
Even better: is there a way to bypass this and make the computer think it's an admin?

Thanks
6 years ago

Jayesh A Lalwani wrote:...
What are you doing? Making a Pacman game that runs on a 4 core machine?!
...



Actually, now that you mention it, I felt elaborating more on the game itself would confuse anyone that could help so I didn't.
The game I'm making actually very much is grid based (much like like Pacman haha) so moving entities a different amount of squares would look weird and would also let them "skip over" walls (black squares), unless I made sure they knew they were skipping over it, but even then it would still look weird.
So yeah. That also explains why I'm not planning on having a lot of entities running at once, and even then a "move" consists of coloring a square, and actually a couple of other things, but altogether it's not very graphically fancy or resource consuming so I can afford it.
I can imagine that if my game was in 3D it would crash before I launched it but in that case I'd use a different approach.

And I'll have a look into game dev books. Thanks for the tip (and everything else).

Jesper de Jong wrote:That comment in front of the method is not an annotation. Annotations are something completely different, you were confusing Ulf by calling this an annotation. That comment is a JavaDoc comment. With the JavaDoc tool you can convert this to a set of HTML pages that contain API documentation, in the same way as the API documentation for the standard Java library.

If you're using Eclipse, and you've added a JAR file as a library to your project, then you can attach sources and JavaDoc to the JAR file. Right-click the JAR file in the list of dependencies of the project, click Properties, and in the dialog you can set the source location and JavaDoc location for the JAR file.



Oh ok I couldn't find the actual name and annotation seemed close enough. Thanks.
So I figured out how to export the JavaDoc from the pre-jarred project and add it to the imported jar in the new project like you said and now it works!
But, is there a way for the JavaDoc to be automatically attached to the jar (so I won't have to do this every time I import the jar)?

Either way, thanks for the help!