package jas2.swingstudio;
import java.io.*;
import jas2.util.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public final class ProgramPagePopupMenu extends JPopupMenu
{
ProgramPagePopupMenu()
{
super();
add("Cut", 'X', "images/Cut.gif");
add("Copy", 'C', "images/Copy.gif");
add("Paste",'V', "images/Paste.gif");
addSeparator();
add("Save", 'S', "images/Save.gif");
add("Save As", 'A', null);
add("Compile", 'M', "images/Compile.gif");
add(m_load);
add("Print...", 'P', "images/Print.gif");
add("Go To Line...", 'G', null);
addSeparator();
add("Options...", 'O', null);
}
public void add(String s, char mnemonic, String theImage)
{
JMenuItem i = new JASMenuItem(s, mnemonic);
if (theImage != null) {
SwingStudioIcon theIcon = new SwingStudioIcon();
theIcon.setImage(theImage);
i.setIcon(theIcon);
}
super.add(i);
}
void willBecomeVisible(String className, boolean enableLoad)
{
m_className = className;
super.firePopupMenuWillBecomeVisible();
m_load.setEnabled(enableLoad);
}
private String m_className = null;
private LoadMenuItem m_load = new LoadMenuItem();
private class LoadMenuItem extends JMenuItem
{
LoadMenuItem()
{
super("Load");
setMnemonic('L');
}
protected void fireActionPerformed(ActionEvent e)
{
super.fireActionPerformed(e);
// loadClass() should handle all exceptions
JavaAnalysisStudio.getApp().getJob().loadClass(m_className);
LoadDialog.updateListWithClass(m_className);
}
}
}
Ads help maintain this website.