Name: ssT124754 Date: 03/13/2001
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
1. Mouse-select the frame menu or the first panel menu - press UP and DOWN
arrow keys - navigation works.
2. Mouse-select one of the two panel menus in the split pane - press UP and
DOWN arrow keys - navigation does NOT work.
Here is the source:
----------------------------------------------
import java.awt.*;
import javax.swing.*;
public class MenuProblem {
static public void main(String argv[]) {
JFrame jf = new JFrame("Test");
JMenu jm = new JMenu("Frame Menu");
JMenuItem jmi1 = new JMenuItem("Frame MenuItem 1");
JMenuItem jmi2 = new JMenuItem("Frame MenuItem 2");
JMenuBar menuBar = new JMenuBar();
jm.add(jmi1);
jm.add(jmi2);
menuBar.add(jm);
jf.setJMenuBar(menuBar);
jf.getContentPane().setLayout(new BorderLayout());
jf.getContentPane().add(new panel(), BorderLayout.NORTH );
JSplitPane jsplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
new panel(),
new panel());
jsplit.setTopComponent(new panel());
jf.getContentPane().add(jsplit, BorderLayout.CENTER);
jf.setSize(200,200);
jf.setVisible(true);
}
}
class panel extends JPanel {
public panel() {
super();
JMenuBar menuBar = new JMenuBar();
setLayout(new BorderLayout());
add(menuBar, BorderLayout.NORTH);
JMenu jm = new JMenu("Panel Menu");
menuBar.add(jm);
jm.add(new JMenuItem("Panel MenuItem1"));
jm.add(new JMenuItem("Panel MenuItem2"));
}
}
(Review ID: 118648)
======================================================================