Mailing Lists: Apple Mailing Lists

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

Re: More SIGBUS when dragging JFrames



Harry Mantheakis wrote:
>
> Bob
>
> I was mucking about with your code and suddenly the SIGBUS error
> went away - the JFrame could be dragged about...
>
> Eventually I found that by calling "pack()" AFTER calling
> "setResizable(false)" the SIGBUS error is avoided.
>
> In your original code, you were calling "pack()" BEFORE calling
> "setResizable(false)".
>
> Mind you, calling "setResizable(false)" still does not prevent zooming the
> window - same problem as with Frame, which apparently has now been fixed.
>
> > import java.awt.*;
> > import javax.swing.*;
> > import javax.swing.border.*;
> >
> > public class JFrameTest extends JFrame {
> > public JLabel mImageLabel;
> > public Container mContentPane;
> > public ImageIcon mIcon;
> >
> > public static void main(String args[]) {
> > new JFrameTest();
> > }
> >
> > public JFrameTest() {
> > super("JFrame Drag");
> > mContentPane = getContentPane();
> > mIcon = new ImageIcon("insertJPEGofchoice.jpg");
> > mImageLabel = new JLabel(mIcon);
> > mImageLabel.setBorder(BorderFactory.createEtchedBorder());
> > mImageLabel.setText("The Text Goes Here");
> > mContentPane.add(mImageLabel);
> > pack();
> > setResizable(false);
> > setVisible(true);
> > }
> > }

Oops! I meant to add a couple more things, but hit the send button.
D'oh! First, I suspect that since JFrame is a subclass of Frame, that
the zoom out widget issue is a Frame bug and as you say, it's been
fixed. Secondly, I found an interesting reference to pack() in David
Geary's "Graphic Java 1.2 Vol 1 AWT". In one of his examples he points
out that "First note that we've explicitly resized the window instead of
invoking pack() because pack() was not up to the task on Solaris." He
goes on to point out that pack() works fine on Windows. Since this
problem doesn't occur on pre-Mac OS X, is it possible that whatever
problem afflicted Solaris is in the Mac OS X code due to the common lineage?

----------
Bob
Dixon, Ca.


References: 
 >Re: More SIGBUS when dragging JFrames (From: Harry Mantheakis <email@hidden>)



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.