JDK-4904347 : XP L&F: Look and feel of menu under Windows XP
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2,5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-08-11
  • Updated: 2004-12-15
  • Resolved: 2004-12-15
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.
Other JDK 6
5.0u3Resolved 6Resolved
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description

Name: gm110360			Date: 08/11/2003


A DESCRIPTION OF THE REQUEST :
While Java emulates the XP look and feel on Windows XP, the menu has a brown border around the white background of the menu.

JUSTIFICATION :
  To have a look and feel similar to native applications on Windows XP

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The context menu must not contain the brown border. The color of this border is the default background color of Windows application
ACTUAL -
A bevelled brown border is present around the menu.

---------- BEGIN SOURCE ----------

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.io.File;
import java.io.BufferedReader;
import java.io.FileReader;

/**
 * User: vinodhl
 * Date: Mar 3, 2003
 * Time: 3:13:59 PM
 */

public class TextReader extends JFrame implements ActionListener,ItemListener
{
	private JMenuBar menuBar;
	private JTextArea viewer;
	private File prevPath ;
	private JFileChooser fileChooser ;

	public TextReader()
	{
		try
		{
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		fileChooser = new JFileChooser();
		fileChooser.setFileHidingEnabled(false);
		viewer = new JTextArea();
	}

	private void init()
	{
		this.setBounds(0,0,500,(int)Toolkit.getDefaultToolkit().getScreenSize().getHeight()-25);
		viewer.setFont(new Font("Verdana",Font.PLAIN,12));


		JScrollPane scrPane  = new JScrollPane( viewer);
		scrPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		scrPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

		this.getContentPane().add(scrPane,BorderLayout.CENTER);
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		createMenu();

		setVisible(true);
	}

	private void createMenu()
	{
		menuBar = new JMenuBar();
		JMenu file = new JMenu("File",true);
		file.setMnemonic(KeyEvent.VK_F);
        JMenu edit = new JMenu("Edit");
		edit.setMnemonic(KeyEvent.VK_E);

		JMenuItem fileOpen = new JMenuItem("Open");
		fileOpen.setMnemonic(KeyEvent.VK_O);
		fileOpen.addActionListener(this);
		fileOpen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,KeyEvent.CTRL_MASK));
		file.add(fileOpen);

		JMenuItem fileExit = new JMenuItem("Exit");
		fileExit.setMnemonic(KeyEvent.VK_X);
		fileExit.addActionListener(this);
		fileExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,KeyEvent.CTRL_DOWN_MASK));
		file.add(fileExit);

		menuBar.add(file);
		this.setJMenuBar(menuBar);
	}

	public static void main(String[] args)
	{
		TextReader logReader = new TextReader();
		logReader.init();
	}

	/**
	 * Invoked when an action occurs.
	 */
	public void actionPerformed(ActionEvent e)
	{
		//System.out.println(e.getActionCommand());
		String actionCommand = e.getActionCommand();
		if(actionCommand.equalsIgnoreCase("EXIT"))
		{
			prevPath = null;
			System.exit(0);
		}
		else if (actionCommand.equalsIgnoreCase("OPEN"))
		{
			if(prevPath != null)
			{
				fileChooser.setCurrentDirectory(prevPath);
			}
			fileChooser.showOpenDialog(this);
			prevPath = fileChooser.getSelectedFile();
			try
			{
				viewer.setText(getFileContent());
				setTitle(prevPath.getAbsolutePath());
			}
			catch(Exception ex){}
		}
	}

	/**
	 * Invoked when an item has been selected or deselected by the user.
	 * The code written for this method performs the operations
	 * that need to occur when an item is selected (or deselected).
	 */
	public void itemStateChanged(ItemEvent e)
	{

	}

    private String getFileContent() throws Exception
    {
	    StringBuffer sb = new StringBuffer();
	    if (prevPath != null)
	    {
		    BufferedReader br = new BufferedReader(new FileReader(prevPath));
		    String str = null;

		    while( (str = br.readLine())!= null)
		    {
			    sb.append(str);
			    sb.append("\n");
		    }
	    }
	    return sb.toString();
    }

}
---------- END SOURCE ----------
(Incident Review ID: 194454) 
======================================================================

Name: gm110360			Date: 06/01/2004


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

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
Native menu separators in Windows XP do not extend to the full width of the Menu.  There are gaps left on either side.
This is not the case with the Windows L&F and JMenu separators.
XP L&F JMenu separators do not have these small gaps on either side between them and the menu.
Native windows separators do.

REGRESSION.  Last worked in version tiger-beta

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Open SwingSet2
Switch to Windows L&F
Drop down the file menu and look at the separator.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JMenu drops down with correct looking separator with small gaps to the left and right of it.
ACTUAL -
JMenu drops down with separator that is the same width (left to right) as the JMenu itself.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Use SwingSet2
---------- END SOURCE ----------
(Review ID: 275408)
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: dragon mustang
25-09-2004

EVALUATION Should fix as soon as possible. ###@###.### 2003-09-26
26-09-2003