JDK-4898776 : XP L&F: JPopupMenu doesn't have a shadow in Windows XP
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-07-30
  • Updated: 2003-11-04
  • Resolved: 2003-11-04
Related Reports
Duplicate :  
Description

Name: jk109818			Date: 07/30/2003


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

FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
Native popup menus have shadow when they are visible (if this option is on at System Properties|Advanced|Visial Effects). The Swing popup menu doesn't have such effect so it doesn't look as native popup.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Go to System Properties|Advanced|Visial Effects and be sure that "Show Shadow under menu" is on
2. Compile and run attached sample application
3. Click right mouse button at the "Hello, world..." label.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Appeared popup menu should have a shadow
ACTUAL -
There is no shadow effect. Moreover appeared menu doesn't look as native menu: it has wrong ugly border.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * @author Vladimir Kondratyev
 */
public class test {
  public static void main(String[] args) throws IllegalAccessException, ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    JFrame frame = new JFrame("Test");
    Container contentPane = frame.getContentPane();
    contentPane.setLayout(new BorderLayout());
    frame.addWindowListener(
      new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          System.exit(0);
        }
      }
    );

    final JLabel label = new JLabel("Hello, world...");
    label.addMouseListener(
      new MouseAdapter() {
        private void showPopup(MouseEvent e) {
          JPopupMenu popupMenu = new JPopupMenu();
          popupMenu.add(new JMenuItem("one"));
          popupMenu.add(new JMenuItem("two"));
          popupMenu.add(new JMenuItem("three"));
          popupMenu.show(label, e.getX(), e.getY());
        }

        public void mousePressed(MouseEvent e) {
          if(e.isPopupTrigger()){
            showPopup(e);
          }
        }

        public void mouseReleased(MouseEvent e) {
          if(e.isPopupTrigger()){
            showPopup(e);
          }
        }
      }
    );
    contentPane.add(label, BorderLayout.CENTER);

    frame.pack();
    frame.show();
  }
}
---------- END SOURCE ----------
(Incident Review ID: 192652) 
======================================================================

Comments
EVALUATION ...
11-06-2004