Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4381311

Window appears iconified after changing visibility with Linux twm

XMLWordPrintable

    • x86
    • linux

      The following problem occurs with jdk1.3.0 for Linux when using the twm, fvwm and fvwm2 window managers. It does not happen with kde. It also doesn't happen with jdk1.2.2_006

      Create and display a java.awt.Window from within a java application and then toggle it's visibility using setVisible(false) and then setVisible(true) after the call to setVisible(true) the Window appears but is Iconified. This also happens if you call show() instead of setVisible(true).

      The following code demonstrates the problem. My tests were made with RedHat 6.2

      import java.awt.*;
      import java.awt.event.*;

      public class MyFrame extends Frame implements ActionListener {

              Button visible, invisible;
              Window testFrame;

              public MyFrame() {
                      setLayout(new FlowLayout());
                      visible = new Button("Visible");
                      invisible = new Button("Invisible");

                      visible.addActionListener(this);
                      invisible.addActionListener(this);

                      add(visible);
                      add(invisible);
              }

              public void actionPerformed(ActionEvent ae) {
                      if(ae.getActionCommand().equals("Visible")) {
                              if(testFrame == null) {
                                      System.out.println("Creating new testFrame");
                                      testFrame = new Window(this);
                                      testFrame.setBounds(100, 100, 100, 100);
                                      testFrame.setVisible(true);
                              }
                              else {
                                      testFrame.setVisible(true);
                              }
                      }
                      else if(ae.getActionCommand().equals("Invisible")) {
                              if(testFrame != null) {
                                      testFrame.setVisible(false);
                              }
                      }
              }

              public static void main(String[] args) {
                      Frame frame = new MyFrame();
                      frame.setBounds(0, 0, 100, 60);
                      frame.setVisible(true);
                      frame.addWindowListener(new WindowAdapter() {
                              public void windowClosing(WindowEvent we) {
                                      System.exit(0);
                              }
                      });
              }
      }

            mbronsonsunw Mike Bronson (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: