Help coderanch get a
new server
by contributing to the fundraiser

Jonathan Bjerche

Greenhorn
+ Follow
since Nov 14, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jonathan Bjerche

In my "class1" I want to make a method that *listens* to a boolean in another "class2".

Whenever the boolean in "class2" becomes FALSE I want "class 1" to do stuff;


Is it possible to make something like this:



???

How do I make the periodic event?
12 years ago
I need a very simple event that activates anytime Left-Mouse-Button is clicked.

I'm looking at the mouse-listener java class. < Everything just looks overcomplicated for this small task.

Any ideas?
12 years ago
Question is: How can I make the Jframe/Jdialog window modal over the Jframe/Jdialog window of another class?

Ex:
Lets say I have 2 GUI classes that each represents a window with lots of buttons etc..

When I click on a button of GUI class 1's window, GUI class 2 comes up with its window.

How can I make GUI class 2's window modal over GUI class 1's window? (So that GUI class 1's window can't be clicked when GUI class 2's window is open)
12 years ago
Ok.

The class PlayerRegister contains an arraylist<Player>.

Before I serialize the PlayerRegister I have added 2 Player-objects to this arrayList<Player> in the PlayerRegister class.

I want to save the PlayerRegister and all the players that are added to the arraylist<player> in playerregister using the code I posted in the first post.

Problem is: When I deserialize the PlayerRegister again the arrayList is empty with no Players.

I know from using the netbeans debugger that:
1) There are 2 players in the player register arraylist<player> when I serialize it
2) There are no players in the player register arraylist<player>when I deserialize it
12 years ago
Ok, thanks guys.

The problem is when I deserialize the PlayerRegister; I don't get all the players that was in the original PlayerRegister.

So how can I save them too?
12 years ago
2 classes involved in this:

Player Class: Has a name and adress string variables.

Player Register Class: Has an array list of players.


I want to save the PlayerRegister with all the players in it when the application exits, and then restore the saved PlayerRegister when the application starts the next time.


Here is the code for importing the PlayerRegister when the application starts:



Here is the code for saving the PlayerRegister when the application exits.

12 years ago
If you want to create games in java and you are a total newbie I would recommend you download Greenfoot (google it).

We have used it alot on our school for learning java, and I created a pretty good mario-like game when I almost had no programming-experience at all.
12 years ago
Thanks for the replies.

I suppose it's better to let my application-class add the coupon to the register when it creates a coupon then? (the application class is my class that interacts with the user)

It's a school project and Iam going to have a presentation where the teacher asks me why I have done it this way etc...
12 years ago
I have 1 coupon class and 1 Coupon Register class that contains an array-list of coupons.

1 constructor that is something like this:

public Coupon (CouponRegister couponReg)
{
this.couponReg=couponReg;
couponReg.addCoupon(THIS##COUPON) <<< This is what I want to do, but HOW??
}

I want to add this instance of Coupon to the Array List in CouponRegister when the instance of Coupon is created, but how??
12 years ago