}
});
addToFileMenu(exitMI, 3);
// Turn location bar on and off
locationBarMI = new JCheckBoxMenuItem(BUNDLE.getString("Location_Bar"));
locationBarMI.setSelected(true);
locationBarMI.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
locationBarMIActionPerformed(evt);
}
});
addToViewMenu(locationBarMI, -1);
// View menu
firstPersonRB = new JRadioButtonMenuItem(
BUNDLE.getString("First Person Camera"));
firstPersonRB.setAccelerator(KeyStroke.getKeyStroke('f'));
firstPersonRB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
cameraChangedActionPerformed(evt);
}
});
addToViewMenu(firstPersonRB, 0);
cameraButtonGroup.add(firstPersonRB);
thirdPersonRB = new JRadioButtonMenuItem(
BUNDLE.getString("Third Person Camera"));
thirdPersonRB.setAccelerator(KeyStroke.getKeyStroke('t'));
thirdPersonRB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
cameraChangedActionPerformed(evt);
}
});
addToViewMenu(thirdPersonRB, 1);
cameraButtonGroup.add(thirdPersonRB);
frontPersonRB = new JRadioButtonMenuItem(
BUNDLE.getString("Front Camera"));
frontPersonRB.setToolTipText(
BUNDLE.getString("Front_Camera_Tooltip"));
frontPersonRB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
cameraChangedActionPerformed(evt);
}
});
addToViewMenu(frontPersonRB, 2);
cameraButtonGroup.add(frontPersonRB);
// add custom accelerators for cycling and resetting the
// camera
InputMap im = mainMenuBar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(KeyStroke.getKeyStroke('c'), "cycleCamera");
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "resetCamera");
ActionMap am = mainMenuBar.getActionMap();
am.put("cycleCamera", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
cameraButtonGroup.next();
}
});
am.put("resetCamera", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
ViewManager.getViewManager().setCameraController(
ViewManager.getDefaultCamera());
}
});
// Frame Rate menu
frameRateMenu = new JMenu(BUNDLE.getString("Max Frame Rate"));
JMenuItem fps15 = new JCheckBoxMenuItem(
BUNDLE.getString("15 fps"));
JMenuItem fps30 = new JCheckBoxMenuItem(
BUNDLE.getString("30 fps (default)"));
JMenuItem fps60 = new JCheckBoxMenuItem(
BUNDLE.getString("60 fps"));
JMenuItem fps120 = new JCheckBoxMenuItem(
BUNDLE.getString("120 fps"));
JMenuItem fps200 = new JCheckBoxMenuItem(
BUNDLE.getString("200 fps"));
frameRateMenu.add(fps15);
frameRateMenu.add(fps30);
frameRateMenu.add(fps60);
frameRateMenu.add(fps120);
frameRateMenu.add(fps200);
addToViewMenu(frameRateMenu, 5);
fps15.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
frameRateActionPerformed(evt);
}
});
fps30.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
frameRateActionPerformed(evt);
}
});
fps60.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
frameRateActionPerformed(evt);
}
});
fps120.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
frameRateActionPerformed(evt);
}
});
fps200.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
frameRateActionPerformed(evt);
}
});
// frame rate meter
fpsMI = new JCheckBoxMenuItem(BUNDLE.getString("FPS_Meter"));
fpsMI.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if ((fpsComponent == null) ||
!fpsComponent.isVisible()) {