JDK-6179679 : REGRESSION: Window maximizes when moving in Red Hat 9.0
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2004-10-15
  • Updated: 2011-01-28
  • Resolved: 2004-11-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Linux localhost 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

EXTRA RELEVANT SYSTEM CONFIGURATION :
Red Hat 9.0
libgnome-2.2.0.1-8
XFree86-4.3.0-2

A DESCRIPTION OF THE PROBLEM :
When I move the window it maximizes almost everytime. Only happens when enabled Java Look&Feel at the beginning. Doesn't happen when I hava Java L&F but native titlebar. Doesn't happen with 1.42 but happens with 1.5 beta1, 1.5 rc1 and 1.5.
I have test many Sun's examples and happens in all of them.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Click on titlebar an move the window (must have Java Look&Feel decorated titlebar). Sometimes doesn't happen if you move it to screen borders.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Window must not maximize, only move.
ACTUAL -
Window maximize.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages.

REPRODUCIBILITY :
This bug can be reproduced often.

---------- BEGIN SOURCE ----------
// File dowloaded from Sun's Swing Learning Examples
// http://java.sun.com/docs/books/tutorial/uiswing/learn/example-1dot4/VoteDialog.java

/*
 * VoteDialog.java is a 1.4 example that requires
 * no other files.
 */
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class VoteDialog extends JPanel {
    JLabel label;
    JFrame frame;
    String simpleDialogDesc = "The candidates";

    public VoteDialog(JFrame frame) {
        super(new BorderLayout());

        this.frame = frame;
        JLabel title;
        
        //Create the components.
        JPanel choicePanel = createSimpleDialogBox();
        
        System.out.println("passed createSimpleDialogBox");
                
        title = new JLabel("Click the \"Vote\" button"
                           + " once you have selected a candidate.",
                           JLabel.CENTER);
        
        label = new JLabel("Vote now!", JLabel.CENTER);
        label.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
        choicePanel.setBorder(BorderFactory.createEmptyBorder(20,20,5,20));

        //Lay out the main panel.
        add(title, BorderLayout.NORTH);
        add(label, BorderLayout.SOUTH);
        add(choicePanel, BorderLayout.CENTER);
    }

    void setLabel(String newText) {
        label.setText(newText);
    }

    private JPanel createSimpleDialogBox() {
        final int numButtons = 4;
        JRadioButton[] radioButtons = new JRadioButton[numButtons];
        
        final ButtonGroup group = new ButtonGroup();

        JButton voteButton = null;

        final String defaultMessageCommand = "default";
        final String yesNoCommand = "yesno";
        final String yeahNahCommand = "yeahnah";
        final String yncCommand = "ync";

        radioButtons[0] = new JRadioButton(
          "<html>Candidate 1: <font color=red>Sparky the Dog</font></html>");
        radioButtons[0].setActionCommand(defaultMessageCommand);

        radioButtons[1] = new JRadioButton(
           "<html>Candidate 2: <font color=green>Shady Sadie</font></html>");
        radioButtons[1].setActionCommand(yesNoCommand);

        radioButtons[2] = new JRadioButton(
            "<html>Candidate 3: <font color=blue>R.I.P. McDaniels</font></html>");
        radioButtons[2].setActionCommand(yeahNahCommand);

        radioButtons[3] = new JRadioButton(
            "<html>Candidate 4: <font color=maroon>Duke the Java<font size=-2><sup>TM</sup></font size> Platform Mascot</font></html>");
        radioButtons[3].setActionCommand(yncCommand);


        for (int i = 0; i < numButtons; i++) {
            group.add(radioButtons[i]);
        }

        //Select the first button by default.
        radioButtons[0].setSelected(true);

        voteButton = new JButton("Vote");
        
        voteButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String command = group.getSelection().getActionCommand();

                //ok dialog
                if (command == defaultMessageCommand) {
                    JOptionPane.showMessageDialog(frame,
                       "This candidate is a dog. Invalid vote.");

                //yes/no dialog
                } else if (command == yesNoCommand) {
                    int n = JOptionPane.showConfirmDialog(frame,
                       "This candidate is a convicted felon. \nDo you still want to vote for her?",
                       "A Follow-up Question",
                       JOptionPane.YES_NO_OPTION);
                    if (n == JOptionPane.YES_OPTION) {
                        setLabel("OK. Keep an eye on your wallet.");
                    } else if (n == JOptionPane.NO_OPTION) {
                        setLabel("Whew! Good choice.");
                    } else {
                        setLabel("It is your civic duty to cast your vote.");
                    }

                //yes/no (with customized wording)
                } else if (command == yeahNahCommand) {
                    Object[] options = {"Yes, please", "No, thanks"};
                    int n = JOptionPane.showOptionDialog(frame,
                       "This candidate is deceased. \nDo you still want to vote for him?",
                       "A Follow-up Question",
                       JOptionPane.YES_NO_OPTION,
                       JOptionPane.QUESTION_MESSAGE,
                       null,
                       options,
                       options[0]);
                    if (n == JOptionPane.YES_OPTION) {
                        setLabel("I hope you don't expect much from your candidate.");
                    } else if (n == JOptionPane.NO_OPTION) {
                        setLabel("Whew! Good choice.");
                    } else {
                        setLabel("It is your civic duty to cast your vote.");
                    }

                //yes/no/cancel (with customized wording)
                } else if (command == yncCommand) {
                    Object[] options = {"Yes!",
                                        "No, I'll pass",
                                        "Well, if I must"};
                    int n = JOptionPane.showOptionDialog(frame,
                                    "Duke is a cartoon mascot. \nDo you  "
                                    + "still want to cast your vote?",
                                    "A Follow-up Question",
                                    JOptionPane.YES_NO_CANCEL_OPTION,
                                    JOptionPane.QUESTION_MESSAGE,
                                    null,
                                    options,
                                    options[2]);
                    if (n == JOptionPane.YES_OPTION) {
                        setLabel("Excellent choice.");
                    } else if (n == JOptionPane.NO_OPTION) {
                        setLabel("Whatever you say. It's your vote.");
                    } else if (n == JOptionPane.CANCEL_OPTION) {
                        setLabel("Well, I'm certainly not going to make you vote.");
                    } else {
                        setLabel("It is your civic duty to cast your vote.");
                    }
                }
                return;
            }
        });
        System.out.println("calling createPane");
        return createPane(simpleDialogDesc + ":",
                          radioButtons,
                          voteButton);
    }
    
    private JPanel createPane(String description,
                              JRadioButton[] radioButtons,
                              JButton showButton) {
        int numChoices = radioButtons.length;
        JPanel box = new JPanel();
        JLabel label = new JLabel(description);

        box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
        box.add(label);

        for (int i = 0; i < numChoices; i++) {
            box.add(radioButtons[i]);
        }

        JPanel pane = new JPanel(new BorderLayout());
        pane.add(box, BorderLayout.NORTH);
        pane.add(showButton, BorderLayout.SOUTH);
        System.out.println("returning pane");
        return pane;
    }

    /**
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
     */
    private static void createAndShowGUI() {
        //Make sure we have nice window decorations.
        JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);
       
        //Create and set up the window.
        JFrame frame = new JFrame("VoteDialog");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //Set up the content pane.
        Container contentPane = frame.getContentPane();
        contentPane.setLayout(new GridLayout(1,1));
        contentPane.add(new VoteDialog(frame));

        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
If I enable Java L&F after invoke JFrame and i got GNOME's titlebar the frame acts normally.

Release Regression From : 1.4.2
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.
###@###.### 10/15/04 04:17 GMT
###@###.### 10/18/04 19:42 GMT

Comments
EVALUATION Bad math in determining the click count... Simple fix. Will try to get in an update release. ###@###.### 2004-11-18 22:41:59 GMT Actually, this looks like an AWT bug. It's not reproducible on Windows. On Windows, if you click on the title bar and drag the window you get no MouseClicked event. For some reason, this isn't the case on Redhat. Instead you get a MouseClicked event with a click count of 0. This doesn't make sense. ###@###.### 2004-11-19 19:28:38 GMT Turns out that this is a duplicate of a known AWT bug (6176814). Only affects XAWT. ###@###.### 2004-11-19 20:05:27 GMT
18-11-2004