A project I'm working on has this awful problem wherein the JFrame refuses to resize in Linux. I've tried the setResizable(true) method, both in the constructor and outside of it, but no go. It works fine on Windows. And I'm using Java 1.6 if that makes any difference. Am I just forgetting something stupid?

/* from main() */
ITSUCSFrame jf = new ITSUCSFrame();
jf.pack();
jf.setVisible(true);
jf.setResizable(true);
/* from constructor */
initComponents();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(true);
// the next line is to make it larger than a handful of pixels :(
setMinimumSize(new Dimension(800,600));

The Linux VMs are flaky when it comes to Swing code.

I found a fix, figured I'd post if anyone comes across the thread later. The problem was that there was a line in the frame constructor:

setMaximizedBounds(new Rectangle(0,0,0,0));

This keeps the max size pretty small. Only reason I could see the app was because of a setMinimumSize() call elsewhere in the code. The setMaximizedBounds line was added by the NetBeans GUI editor thingy (my partner did that part of it, so I didn't know about that line till I stumbled on it). And yet another reason why I can't stand WYSIWYG editors...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.