Tags

, , , ,

Programs written with the acm library (ie. almost everything in stanford’s CS106A) have one bug that annoys me a lot. They do not take into account the OS Taskbar when creating the window.

In the event you have a vertical Taskbar, the created window will start -under- the Taskbar, see snapshot:

Bad ACM Window Start Position

You can change this behavior by using something like:


 @Override
 public void init() {
     this.getParent().setBounds(200,200,800,500);
 }

The values for setBounds() are (x,y,width,height). Same as with a GRector pretty much anything else bound by a rectangle.

In the above example I set the program window’s top left corner to be at screen coordinates 200×200, and have a program window of size 800×500.

See this in action in my previous post

Update: This doesn’t work with the old acm library version that comes with the assignments, I am using a newer version from jtf.acm.org. I bet there’s a way to do this for the old version too, but I haven’t discovered it yet. (relatively newer, but it’s also old since the newest available version is from 2006).

Enjoy!

Advertisements