00:00
00:00
Newgrounds Background Image Theme

christopher54000 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Making it appear in a window?

845 Views | 6 Replies
New Topic Respond to this Topic

Making it appear in a window? 2013-01-18 14:46:33


So, I've got this code, more like a script. It's a random generator for my role-plays. Got it all coded nice and neat runs perfectly....... In command line. How do I make this

<pre>
package role.play.generator;
import java.util.Random;
public class RolePlayGenerator {
public static void main(String[] args) {
Random randomgenerator = new Random();
int hairsel = randomgenerator.nextInt(5);
int clothsel = randomgenerator.nextInt(4);
String[] clothtypes = {"Dress","Skirt","Robe","Pants"};
String[] haircolours = {"Blue", "Red", "Blonde","Black","Purple"};
double height = Math.floor(Math.random()*9+58);
String Haircolour="Hair Colour:"+haircolours[hairsel];
String Clothing="Clothing:"+clothtypes[clothsel];
String Height = "Height:"+height+" Inches";
System.out.println(Height);
System.out.println(Clothing);
System.out.println(Haircolour);
}
}

Output the prints, into a window with a button to run it again?
I'm week in and this is only functional as of yesterday.


Sorry about the formatting fail.

Response to Making it appear in a window? 2013-01-19 12:39:16


Did a little research going to do some tutorials, maybe repost this thread if I still can't do it.


Sorry about the formatting fail.

Response to Making it appear in a window? 2013-01-22 09:22:09


You know what would help?

Telling us what language you're writing this in. That's a fundamental thing we MUST know to be able to help.

You're also giving us a bare minimum of information. Remember, when asking for help, the more information and detail you can give, the better.


BBS Signature

Response to Making it appear in a window? 2013-01-22 10:07:29


At 1/22/13 09:22 AM, Hoeloe wrote: what language you're writing this in.
At 1/18/13 02:46 PM, sekendis wrote: import java.util.Random;

Hmmm

Response to Making it appear in a window? 2013-01-22 10:10:33


At 1/22/13 09:22 AM, Hoeloe wrote: You know what would help?

Telling us what language you're writing this in. That's a fundamental thing we MUST know to be able to help.

You're also giving us a bare minimum of information. Remember, when asking for help, the more information and detail you can give, the better.

Actually, it's very clear that he/she is using Java. What would help is if he/she would put the source code in the code tags. You'll find more information about the code tag on the left of the message box.


BBS Signature

Response to Making it appear in a window? 2013-01-23 13:36:30


At 1/18/13 02:46 PM, sekendis wrote: So, I've got this code, more like a script. It's a random generator for my role-plays. Got it all coded nice and neat runs perfectly....... In command line. How do I make this

You need to use a framework, I used to use swing, but it's deprecated as shit now. People recommend GWT instead of swing, not sure how it work or how easy/hard it is to setup and use, but you could also check that out I guess.

Also links:
Swing
GWT

Response to Making it appear in a window? 2013-01-24 14:54:45


At 1/24/13 02:10 PM, VBAssassin wrote: If swing is deprecated... why does GWT to use Swing (look at the components)?
https://developers.google.com/web-toolkit/tools/gwtdesigner/
userinterface/source_view

Not sure, basically sometime ago java developers decided that SWING should belong in a dark corner where upgrades aren't necessary and was removed from netbeans to be superseded by something else sometime in the future (that was one year ago when I last used java for gui programming link here for a somewhat related discussion)

After snooping around for a while it seems that at the time oracle just released JavaFX 2.0 and was trying to push it as a replacement and I basically fell for the marketing.
@OP use whatever you want then I guess.

Still if you have the time I'd advise you to try out Qt before deciding what you want to pursue in the world of GUI programming.