Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another change in Jaguar



I had a problem with an application when I switched
to Jaguar, it wouldn't draw properly, sometimes it
didn't show up at all, sometimes I could see lower left
corner, but I couldn't move it or resize it.

The problem is that it used to work and other JVM-s draw
it right. The cause of the problem was a vertical strut, which was
created to get "proper" size of a JTextField. An example of
this is shown below (OK, I know now that this isn't the way
to do it, but it might be helpful for someone). Interestingly
if the strut is smaller (but still really large) it draws
properly.

/Lars


----------------------------------------
import java.awt.event.*;
import javax.swing.*;

public class MainFrame extends JFrame {

MainFrame() {
super("test");
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
JTextField searchNameField = new JTextField("Foo");
panel.add(searchNameField);

//this used to work in 10.1 and works in other JVM-s
panel.add(Box.createVerticalStrut(Short.MAX_VALUE));

//however this works
//panel.add(Box.createVerticalStrut(Short.MAX_VALUE / 10));

getContentPane().add(panel);
}

public static final void main(String[] args) {
MainFrame window = new MainFrame();
window.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
System.exit(0);
}
});
window.pack();
window.setSize(400, 200);
window.setVisible(true);
}
}
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.