| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| Thanks for the input Jeremy and Sergiy. I'm looking into your suggestions now. The Container.update method and ComponentUI.update look particularly promising. It would be great if the Apple guys could chime in and verify that this isn't a bug in their side - it's looking to me like it may be problem somewhere on the Java side. I say this because I did manage to create a JFrame with a custom resize widget that didn't flicker (though it does seem to hop around a little). Try the following code: public class JFrameFlicker extends JFrame { private GrowBox fGrowBox = new GrowBox(this); public JFrameFlicker() { JPanel dummyPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT,1,1)); dummyPanel.add(fGrowBox); JPanel backgroundPanel = new JPanel(new BorderLayout()); backgroundPanel.setOpaque(false); backgroundPanel.add(dummyPanel, BorderLayout.SOUTH); getContentPane().add(dummyPanel, BorderLayout.SOUTH); ((JComponent)getContentPane()).setOpaque(false); setUndecorated(true); setBackground(new Color(0,0,0,100)); } private static class GrowBox extends JLabel implements MouseListener, MouseMotionListener { private Point fPressedPoint; private int fStartWidth; private int fStartHeight; private Frame fFrame; private GrowBox(Frame frame) { super(); fFrame = frame; addMouseListener(this); addMouseMotionListener(this); setOpaque(true); setPreferredSize(new Dimension(12,12)); setBackground(Color.GRAY); } // MouseListener implementation. ////////////////////////////////////// public void mouseClicked(MouseEvent e) { } public void mousePressed(MouseEvent e) { fPressedPoint = e.getPoint(); SwingUtilities.convertPointToScreen(fPressedPoint, this); fStartWidth = fFrame.getWidth(); fStartHeight = fFrame.getHeight(); } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } // MouseMotionListener implementation. //////////////////////////////// public void mouseDragged(MouseEvent e) { Point currentPoint = e.getPoint(); SwingUtilities.convertPointToScreen(currentPoint, this); int width = fStartWidth - (fPressedPoint.x - currentPoint.x); int height = fStartHeight - (fPressedPoint.y - currentPoint.y); fFrame.setSize(width, height); } public void mouseMoved(MouseEvent e) { } } public static void main(String[] args) { JFrame jframe = new JFrameFlicker(); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.setSize(400,400); jframe.setLocationRelativeTo(null); jframe.setVisible(true); } } On Sep 24, 2008, at 9:30 AM, Sergiy Michka wrote:
|
_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden This email sent to email@hidden
| References: | |
| >Programmatic resize flicker (From: Ken Orr <email@hidden>) | |
| >Re: Programmatic resize flicker (From: email@hidden) | |
| >Re: Programmatic resize flicker (From: "Sergiy Michka" <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.