Win a copy of Rust Web Development this week in the Other Languages forum!

Tyler Eastman

+ Follow
since Jan 02, 2010
Portland, Or
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 Tyler Eastman

Thank you so much Peter, your example seems to have solved the problem completely! It will require me to restructure my animation code a little bit, but after pulling my hair out for 2 weeks on the resize code, it will be a welcome change of pace!

Thank you everyone for your help, it is very appreciated!
11 years ago
Thanks for your fast response Pete! I will condense the piece initialization and resize code down using arrays once I'm at my home computer tomorrow, I can see how not using them adds unnecessary bulk to the example.
11 years ago
Any idea's guys? I'm thinking it might be thread related, however if I spawn a new thread each time the resize event is called, won't it be flooded with duplicate threads, all doing the same thing but with different size variables? Any thoughts?
Thanks guys!
11 years ago
Heres a simple compilable example of the problem. I apologize for the length of Most of the code in that class is initialization code and can be ignored. The resizeBoard, setSize, and paintComponent methods are the only ones linked to the problem (that I'm aware of) in that class.

Thank you for taking the time to help!
11 years ago
Ok, I will trim down the fat and try to get a simple compilable example ready by the end of today.
11 years ago
I am so stumped here!

Ok, so I have a chess program that I am writing, and I can't for the life of me figure out what is wrong with my resize code. Any help is greatly appreciated!

EDIT: See 2 comments below for a short compilable example.

Problem: Every time I resize the window smaller, certain pieces disappear, however this problem only arises when I resize the window fast. If I gradually resize it smaller, the pieces don't disappear!?!? I have attached images of the problem.

Code Structure: The resize code is spread over 3 classes. The MainGui, the ChessBoard, and the ChessPiece class. The gamePanelComponentResize method resides in the MainGui class, and is a listener for the resize component event. This method then delegates the resize order to the ChessBoard object, which in turn delegates it to each of the remaining ChessPiece objects.

MainGui method:

ChessBoard Methods:

ChessPiece methods:
11 years ago
I started programming in mid 2009 as a diversion from my college studies (music major at the time, switched to liberal arts).

1st: Python
2nd: C
3rd: C++
4th: Java

Java is by far my favorite due to it's simplicity and flexibility. Plus in Oregon it seems to be very in demand. Now if I can just hone my skills and actually find a job doing it!
12 years ago