makerbot / ReplicatorG

An open-source gcode interpreter for driving RepRaps, Makerbots, and other similar CNC beasties
http://replicat.org
GNU General Public License v2.0
404 stars 226 forks source link

Fix for preview panel not showing in Ubuntu 11.04 with OpenJDK #257

Open noisecapella opened 12 years ago

noisecapella commented 12 years ago

It's a little bit of a hack, but it should be simple enough to easily understand. The problem comes from a bug in OpenJDK/Java3D which seems to occur when there are two components in the JPanel at once (the gcode and model tabs). My fix is to replace the MainWindow.cardPanel JPanel object with a wrapper class, which ensures that the JPanel only contains one Component at a time. It stores the other hidden Components in its own HashMap, which is accessed when show() is called.

There are checks to make sure that this only happens when Base.isLinux() is true, otherwise it forwards method calls so that the behavior should be exactly what it was before. I did that mostly because I wasn't sure if it would produce any weird flickering or etc on other platforms.

noisecapella commented 12 years ago

Is there any opinion one way or another about this fix? I'm willing to do a better fix if it's considered too hackish

rheaplex commented 12 years ago

This works perfectly. It really should be merged into ReplicatorG so that the software just works on modern GNU/Linux systems.

phooky commented 12 years ago

I'll put this merge into the todo for the next repg release if it's not already there.

rheaplex commented 12 years ago

Excellent! Thank you.

noisecapella commented 12 years ago

FYI I just installed Ubuntu 12.04 and the broken behavior still happens in that version. Also, the only important commit is my first commit. The other ones are just merges to keep this updated with ReplicatorG/master