-
Bug
-
Resolution: Duplicate
-
P4
-
1.4.2, 5.0
-
x86
-
windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2119917 | 5.0u3 | Leif Samuelsson | P4 | Closed | Duplicate |
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)
======================================================================
- backported by
-
JDK-2119917 XP L&F: Look and feel of menu under Windows XP
-
- Closed
-
- duplicates
-
JDK-5101407 XP L&F: The mouseover highlight for a menu item lacks margins
-
- Closed
-
-
JDK-4991588 Spacing and appearance of menus does not match Windows XP
-
- Closed
-
-
JDK-4884423 XP L&F: JPopupMenu borders not using XP style
-
- Resolved
-
- relates to
-
JDK-5016492 XP L&F: Separator between menu items in native give more gap than java
-
- Closed
-