Title bar is not visible after changing the LookAndFeel

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: P4
    • None
    • Affects Version/s: 1.4.2
    • Component/s: client-libs



      Name: rmT116609 Date: 04/21/2003


      FULL PRODUCT VERSION :
      java version "1.4.1_02"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
      Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)

      java version "1.4.2-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
      Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)

      FULL OS VERSION :
      Microsoft Windows XP [Version 5.1.2600]
      All of Windows Operating Systems (95/98/2000/ME/XP)

      A DESCRIPTION OF THE PROBLEM :
      I am using JFrame's setDefaultLookAndFeelDecorated and set it is true. While Changing the LookAndFeel FROM Metal to Windows/Motif LookAndFeels in Runtime by the user, title bar of the JFrame is not visible, so i can't minimize/resize/close the JFrame. But i closed and reopen the application the problem is solved by using default LookAndFeel Decoration (Windows)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just change the look and feels I provided with my program.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      LookAndFeel needs to be changed normally, I need my title bar on my JFrame
      Title bar will not visible after changed to Motif/Windows Look And Feel

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      public class MyJFrame extends JFrame implements ActionListener
      {
      JMenuBar menu = new JMenuBar();

      JMenu mnuFile = new JMenu("File");
      JMenu mnuLook = new JMenu("Look And Feel");

      JMenuItem miExit = new JMenuItem("Exit",'X');
      JMenuItem miMetal = new JMenuItem("Metal Look And Feel",'M');
      JMenuItem miMotif = new JMenuItem("Motif Look And Feel",'T');
      JMenuItem miWindows = new JMenuItem("Windows Look And Feel",'W');

      public MyJFrame()
      {
      super("MyFrame for my Bug");
      setSize(400,400);
      setVisible(true);

      mnuFile.add(miExit);

      mnuLook.add(miMetal);
      mnuLook.add(miMotif);
      mnuLook.add(miWindows);

      menu.add(mnuFile);
      menu.add(mnuLook);

      setJMenuBar(menu);

      validate();

      mnuFile.setMnemonic('F');
      mnuLook.setMnemonic('L');

      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      miExit.addActionListener(this);
      miMetal.addActionListener(this);
      miMotif.addActionListener(this);
      miWindows.addActionListener(this);
      }

      public void actionPerformed(ActionEvent ae)
      {
      if(ae.getSource() == miExit)
      {
      dispose();
      System.exit(0);
      }
      else if(ae.getSource() == miMetal)
      changeLookAndFeel("Metal");
      else if(ae.getSource() == miMotif)
      changeLookAndFeel("Motif");
      else if(ae.getSource() == miWindows)
      changeLookAndFeel("Windows");
      }

      public void changeLookAndFeel(String strLook)
      {
      try
      {
      if(strLook.equals("Metal"))
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
      else if(strLook.equals("Motif"))
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
      else if(strLook.equals("Windows"))
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

      SwingUtilities.updateComponentTreeUI(this);
      }
      catch(Exception ex)
      {
      JOptionPane.showMessageDialog(this,ex.toString(),"Error occured",JOptionPane.ERROR_MESSAGE);
      }
      }

      public static void main(String args[])
      {
      JFrame.setDefaultLookAndFeelDecorated(true);
      JDialog.setDefaultLookAndFeelDecorated(true);
      new MyJFrame();
      }
      }


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

      CUSTOMER SUBMITTED WORKAROUND :
      i need to close and reopen the JFrame
      (Review ID: 184492)
      ======================================================================

            Assignee:
            Joshua Outwater (Inactive)
            Reporter:
            Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: