use of javax.swing.JMenuItem in project ACS by ACS-Community.
the class ObjectExplorer method oETree1_MouseClicked.
/**
* Comment
*/
public void oETree1_MouseClicked(java.awt.event.MouseEvent mouseEvent) {
//TODO ?!?!?!?!?!?!?
if (SwingUtilities.isRightMouseButton(mouseEvent)) {
TreePath clickedPath = getOETree1().getPathForLocation(mouseEvent.getX(), mouseEvent.getY());
Object clicked = null;
if (clickedPath != null)
clicked = clickedPath.getLastPathComponent();
if (clicked instanceof Introspectable) {
Introspectable node = (Introspectable) clicked;
getconnectMenuItem().setEnabled(!node.isConnected());
getdisconnectMenuItem().setEnabled(node.isConnected() && !node.isNonSticky());
getJLabel1().setText(node.toString());
getTreeHandlerBean1().setClicked(node);
// disable/enable converters
Converter currentConverter = ObjectExplorer.getConverter(node);
int len = getconverterMenu().getItemCount();
for (int i = 0; i < len; i++) {
JMenuItem item = getconverterMenu().getItem(i);
if (item != null && item.getActionListeners() != null && item.getActionListeners().length == 1 && item.getActionListeners()[0] instanceof SetConverterActionListener) {
SetConverterActionListener scal = (SetConverterActionListener) item.getActionListeners()[0];
if (scal.getConverter() == currentConverter)
item.setEnabled(false);
else
item.setEnabled(true);
}
}
getoeTreePopup().show(getOETree1(), mouseEvent.getX(), mouseEvent.getY());
}
}
return;
}
use of javax.swing.JMenuItem in project ACS by ACS-Community.
the class ObjectExplorer method getconverterMenu.
/**
* Return the convertMenuItem property value.
* @return javax.swing.JMenuItem
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JMenu getconverterMenu() {
if (ivjconverterMenu == null) {
try {
ivjconverterMenu = new javax.swing.JMenu();
ivjconverterMenu.setName("converterMenu");
ivjconverterMenu.setText("convert");
// user code begin {1}
// list of converters is static
List converters = getConverterRepository();
if (converters.size() > 0) {
JMenuItem item = new JMenuItem("none");
item.addActionListener(new SetConverterActionListener(null));
ivjconverterMenu.add(item);
ivjconverterMenu.add(new JSeparator());
}
Iterator iter = converters.iterator();
while (iter.hasNext()) {
Converter converter = (Converter) iter.next();
JMenuItem item = new JMenuItem(converter.getDescription());
item.addActionListener(new SetConverterActionListener(converter));
ivjconverterMenu.add(item);
}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjconverterMenu;
}
use of javax.swing.JMenuItem in project ACS by ACS-Community.
the class CommandCenterGui method prepare.
public void prepare() {
boolean setLookAndFeel = false;
if (setLookAndFeel) {
String lafName = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(lafName);
} catch (Exception exc) {
log.fine("Couldn't set look and feel " + lafName + " due to " + exc);
}
}
// title added later in doFrameTitle()
frame = new JFrame("");
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
controller.stop();
}
});
dlgContainerSettings = new EditContainerSettingsDialog(this);
frontPanel = new TabPanel(this);
writeModelToFrontPanel();
// Splitter between tree and the rest
splitLeftRight = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitLeftRight.setOneTouchExpandable(true);
JPanel p2 = new JPanel(new BorderLayout());
p2.setBorder(new EmptyBorder(10, 10, 10, 10));
p2.add(frontPanel, BorderLayout.NORTH);
splitLeftRight.setLeftComponent(p2);
// Deployment Tree
deploymentInfoPanel = new JPanel(new BorderLayout());
deploymentInfoPanel.setBorder(new CompoundBorder(new EmptyBorder(5, 7, 5, 7), new TitledBorder(LineBorder.createBlackLineBorder(), " Deployment Info ")));
deployTree = new DeploymentTree(controller.deploymentTreeControllerImpl);
JPanel addToDeployTree = new AddToDeployTree(this, deployTree);
deploymentInfoPanel.add(addToDeployTree, BorderLayout.NORTH);
deploymentInfoPanel.add(new JScrollPane(deployTree), BorderLayout.CENTER);
splitLeftRight.setRightComponent(deploymentInfoPanel);
// Feedback Area
feedbackTabs = new FeedbackTabs(this, FeedbackTabs.BOTTOM);
// Logo Panel
JPanel logoPanel = new LogoPanel(COLOR_LogoBackground_A, COLOR_LogoBackground_B);
logoPanel.setLayout(new BorderLayout());
JLabel alma = new JLabel(new ImageIcon(controller.findResource("alma.jpg")));
logoPanel.add(alma, BorderLayout.WEST);
JLabel text = new JLabel("Acs Command Center");
text.setForeground(COLOR_LogoForeground);
text.setHorizontalTextPosition(SwingConstants.CENTER);
text.setFont(text.getFont().deriveFont((float) (text.getFont().getSize() * 2.5)));
text.setBorder(new EmptyBorder(5, 30, 5, 30));
logoPanel.add(text, BorderLayout.CENTER);
// JLabel version = new JLabel(controller.version());
// version.setForeground(COLOR_LogoForeground);
// version.setBorder(new EmptyBorder(0, 0, 0, 4));
// JPanel pnl2 = new JPanel(new BorderLayout());
// pnl2.setOpaque(false);
// pnl2.add(version, BorderLayout.SOUTH);
// logoPanel.add(pnl2, BorderLayout.EAST);
menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("Project");
fileMenu.setMnemonic(KeyEvent.VK_P);
{
JMenu newMenu = new JMenu("New");
newMenu.add(new ActionNewProject("Project"));
fileMenu.add(newMenu);
}
fileMenu.add(new ActionOpenProject("Open..."));
fileMenu.add(new ActionSaveProject("Save"));
fileMenu.add(new ActionSaveAsProject("Save As..."));
fileMenu.addSeparator();
fileMenu.add(new ActionExit("Exit"));
menuBar.add(fileMenu);
toolsMenu = new JMenu("Tools");
toolsMenu.setMnemonic(KeyEvent.VK_T);
toolsMenu.add(new ActionConfigureTools("Configure Tools..."));
toolsMenu.addSeparator();
menuBar.add(toolsMenu);
// ---
JMenu extrasMenu = new JMenu("Expert");
extrasMenu.setMnemonic(KeyEvent.VK_E);
{
// JMenu sshMode = new JMenu("SSH Library");
// sshMode.add(new ActionSetSshMode("Platform-independent", false, false));
// sshMode.add(new ActionSetSshMode("Natively installed ssh", true, true));
// extrasMenu.add(sshMode);
// extrasMenu.add(new JSeparator());
JMenu extraTools = new JMenu("Tools Menu");
extraTools.add(new ActionShowExtraTools("View..."));
extraTools.add(new ActionInstallExtraTools("Replace..."));
extrasMenu.add(extraTools);
JMenu builtinTools = new JMenu("Acs Scripts");
builtinTools.add(new ActionShowBuiltinTools("View..."));
builtinTools.add(new ActionLoadBuiltinTools("Replace..."));
extrasMenu.add(builtinTools);
}
extrasMenu.add(new JSeparator());
extrasMenu.add(new ActionShowVariables("Variables..."));
menuBar.add(extrasMenu);
// ---
JMenuItem item;
JMenu helpMenu = new JMenu("Help");
helpMenu.setMnemonic(KeyEvent.VK_H);
item = helpMenu.add(new ActionShowHelp("Online Help"));
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
item = helpMenu.add(new ActionShowAbout("About"));
menuBar.add(Box.createHorizontalGlue());
menuBar.add(helpMenu);
// ---
JPanel h = new JPanel(new SpringLayout());
h.add(logoPanel);
h.add(menuBar);
SpringUtilities.makeCompactGrid(h, 0, 1);
frame.getContentPane().add(h, BorderLayout.NORTH);
// ---
pnlManagerLocationForTools = new ManagerLocationPanel.ForTools();
managerLocationDialog1 = new BasicDialog(this, "Specify Manager and Services for Tools", "Set", pnlManagerLocationForTools);
// ---
pnlManagerLocationForContainers = new ManagerLocationPanel.ForContainers();
managerLocationDialog2 = new BasicDialog(this, "Specify Manager and Services for Containers", "Set", pnlManagerLocationForContainers);
// ---
splitTopBottom = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitLeftRight, feedbackTabs);
splitTopBottom.setOneTouchExpandable(true);
// ---
// 2009-04: Introducing a desktop layout so i can make the
// progress dialog a lightweight window on top the front panel
AccInternalFrame bigInternalFrame = new AccInternalFrame();
bigInternalFrame.add(splitTopBottom);
desktop = new JDesktopPane();
bigInternalFrame.setVisible(true);
desktop.add(bigInternalFrame);
frame.getContentPane().add(desktop, BorderLayout.CENTER);
try {
bigInternalFrame.setSelected(true);
bigInternalFrame.setMaximum(true);
} catch (PropertyVetoException exc) {
}
// for mysterious swing reasons, the desktop has a preferred size
// of (1,1) instead of picking up the preferred size of its child
// component, so i'm doing this manually here.
desktop.setPreferredSize(bigInternalFrame.getPreferredSize());
doFrameTitle();
}
use of javax.swing.JMenuItem in project jdk8u_jdk by JetBrains.
the class DimensionEncapsulation method run.
@Override
public void run() {
runTest(new Panel());
runTest(new Button());
runTest(new Checkbox());
runTest(new Canvas());
runTest(new Choice());
runTest(new Label());
runTest(new Scrollbar());
runTest(new TextArea());
runTest(new TextField());
runTest(new Dialog(new JFrame()));
runTest(new Frame());
runTest(new Window(new JFrame()));
runTest(new FileDialog(new JFrame()));
runTest(new List());
runTest(new ScrollPane());
runTest(new JFrame());
runTest(new JDialog(new JFrame()));
runTest(new JWindow(new JFrame()));
runTest(new JLabel("hi"));
runTest(new JMenu());
runTest(new JTree());
runTest(new JTable());
runTest(new JMenuItem());
runTest(new JCheckBoxMenuItem());
runTest(new JToggleButton());
runTest(new JSpinner());
runTest(new JSlider());
runTest(Box.createVerticalBox());
runTest(Box.createHorizontalBox());
runTest(new JTextField());
runTest(new JTextArea());
runTest(new JTextPane());
runTest(new JPasswordField());
runTest(new JFormattedTextField());
runTest(new JEditorPane());
runTest(new JButton());
runTest(new JColorChooser());
runTest(new JFileChooser());
runTest(new JCheckBox());
runTest(new JInternalFrame());
runTest(new JDesktopPane());
runTest(new JTableHeader());
runTest(new JLayeredPane());
runTest(new JRootPane());
runTest(new JMenuBar());
runTest(new JOptionPane());
runTest(new JRadioButton());
runTest(new JRadioButtonMenuItem());
runTest(new JPopupMenu());
//runTest(new JScrollBar()); --> don't test defines max and min in
// terms of preferred
runTest(new JScrollPane());
runTest(new JViewport());
runTest(new JSplitPane());
runTest(new JTabbedPane());
runTest(new JToolBar());
runTest(new JSeparator());
runTest(new JProgressBar());
if (!failures.isEmpty()) {
System.out.println("These classes failed");
for (final Component failure : failures) {
System.out.println(failure.getClass());
}
throw new RuntimeException("Test failed");
}
}
use of javax.swing.JMenuItem in project aima-java by aimacode.
the class AimaDemoFrame method addApp.
/**
* Adds a new agent application to the menu. The class is expected to be
* part of a package and to provide a <code>constructApplicationFrame</code>
* method.
*/
public void addApp(Class<?> appClass) {
JMenuItem item = addDemoToMenu(appsMenu, appClass);
item.addActionListener(new AppStarter(appClass));
}
Aggregations