Duplicate :
|
Name: krT82822 Date: 06/13/99 [This looks like a regression -- this bug had appeared in early versions of 1.2, and appears to be back --kevin.ryan@eng, 13 June 99] (prev bug similar to this: 4188386) -------------- Top 1.: After select JMenuItem an JFileChooser-Dialog is opening and layed over the parent Window (wich is hide completly). After closing JFileChooser-Dialog the parent dialog is shown also the JMenu with the selected JMenuItem is shown true but is not active. Top 2.: SOURCE CODE: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; public class WebCopyFrame extends JFrame implements ActionListener { private JFileChooser fileChooser; private JScrollPane scrollPane; private JTextArea ausgabe; public WebCopyFrame() { JMenuBar menuBar; JMenu menu; JMenuItem menuItem; menuBar = new JMenuBar(); setJMenuBar(menuBar); menu = new JMenu("File"); menuBar.add(menu); menuItem = new JMenuItem("Open file-dialog"); menu.add(menuItem); menuItem.setActionCommand("file"); menuItem.addActionListener(this); menuItem = new JMenuItem("Exit"); menu.add(menuItem); menuItem.setActionCommand("end"); menuItem.addActionListener(this); Container contentPane = getContentPane(); ausgabe = new JTextArea(10, 20); scrollPane = new JScrollPane(ausgabe); scrollPane.setAlignmentX(100); contentPane.add(scrollPane, BorderLayout.CENTER); setContentPane(contentPane); fileChooser = new JFileChooser(); addWindowListener (new WindowAdapter () { public void windowClosing (WindowEvent e) { System.exit (0);} } ); } public void actionPerformed (ActionEvent a) { if (a.getActionCommand().equals("file")) { System.out.println("Menuepunkt open file selected"); int returnVal = fileChooser.showOpenDialog(WebCopyFrame.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); System.out.println("Saving: " + file.getName()); } else { System.out.println("Save command cancelled by user."); } } if (a.getActionCommand().equals("end")) { System.out.println("Menuepunkt exit selected"); System.exit(0); } } static public void main (String[] args) throws Exception { WebCopyFrame frame = new WebCopyFrame(); frame.getContentPane().add(new JPanel(),BorderLayout.NORTH); frame.setTitle("HTML-Copy"); frame.pack (); frame.setVisible (true); }//end main } Top 5.: java -version -fullversion java version "1.2" Classic VM (build JDK-12.3-V, native threads) (Review ID: 84238) ======================================================================