Search in sources :

Example 76 with JSeparator

use of javax.swing.JSeparator in project libgdx by libgdx.

the class EffectPanel method initializeComponents.

private void initializeComponents() {
    setLayout(new GridBagLayout());
    {
        JScrollPane scroll = new JScrollPane();
        add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 6), 0, 0));
        {
            emitterTable = new JTable() {

                public Class getColumnClass(int column) {
                    return column == 1 ? Boolean.class : super.getColumnClass(column);
                }

                @Override
                public Dimension getPreferredScrollableViewportSize() {
                    Dimension dim = super.getPreferredScrollableViewportSize();
                    dim.height = getPreferredSize().height;
                    return dim;
                }
            };
            emitterTable.getTableHeader().setReorderingAllowed(false);
            emitterTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            scroll.setViewportView(emitterTable);
            emitterTableModel = new DefaultTableModel(new String[0][0], new String[] { "Emitter", "" });
            emitterTable.setModel(emitterTableModel);
            emitterTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

                public void valueChanged(ListSelectionEvent event) {
                    if (event.getValueIsAdjusting())
                        return;
                    emitterSelected();
                }
            });
            emitterTableModel.addTableModelListener(new TableModelListener() {

                public void tableChanged(TableModelEvent event) {
                    if (event.getColumn() != 1)
                        return;
                    emitterChecked(event.getFirstRow(), (Boolean) emitterTable.getValueAt(event.getFirstRow(), 1));
                }
            });
        }
    }
    {
        JPanel sideButtons = new JPanel(new GridBagLayout());
        add(sideButtons, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
        {
            controllerTypeCombo = new JComboBox();
            controllerTypeCombo.setModel(new DefaultComboBoxModel(ControllerType.values()));
            sideButtons.add(controllerTypeCombo, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
        }
        {
            JButton newButton = new JButton("New");
            sideButtons.add(newButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
            newButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent event) {
                    ControllerType item = (ControllerType) controllerTypeCombo.getSelectedItem();
                    createDefaultEmitter(item, true, true);
                }
            });
        }
        {
            JButton deleteButton = new JButton("Delete");
            sideButtons.add(deleteButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
            deleteButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent event) {
                    deleteEmitter();
                }
            });
        }
        {
            JButton cloneButton = new JButton("Clone");
            sideButtons.add(cloneButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
            cloneButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent event) {
                    cloneEmitter();
                }
            });
        }
        {
            sideButtons.add(new JSeparator(JSeparator.HORIZONTAL), new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
        }
        {
            JButton saveButton = new JButton("Save");
            sideButtons.add(saveButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
            saveButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent event) {
                    saveEffect();
                }
            });
        }
        {
            JButton openButton = new JButton("Open");
            sideButtons.add(openButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
            openButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent event) {
                    openEffect();
                }
            });
        }
        {
            JButton importButton = new JButton("Import");
            sideButtons.add(importButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
            importButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent event) {
                    importEffect();
                }
            });
        }
    /*
			{
				JButton importButton = new JButton("Export");
				sideButtons.add(importButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER,
					GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
				importButton.addActionListener(new ActionListener() {
					public void actionPerformed (ActionEvent event) {
						exportEffect();
					}
				});
			}
			*/
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) TableModelEvent(javax.swing.event.TableModelEvent) ActionEvent(java.awt.event.ActionEvent) DefaultTableModel(javax.swing.table.DefaultTableModel) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) ControllerType(com.badlogic.gdx.tools.flame.FlameMain.ControllerType) JSeparator(javax.swing.JSeparator) ListSelectionListener(javax.swing.event.ListSelectionListener) ActionListener(java.awt.event.ActionListener) JTable(javax.swing.JTable) TableModelListener(javax.swing.event.TableModelListener)

Example 77 with JSeparator

use of javax.swing.JSeparator in project binnavi by google.

the class CAddressSpaceNodeMenuBuilder method createMenu.

@Override
protected void createMenu(final JComponent menu) {
    menu.add(new JMenuItem(m_loadAddressSpaceAction));
    menu.add(new JSeparator());
    menu.add(new JMenuItem(CActionProxy.proxy(new CDeleteAddressSpaceAction(getParent(), m_project, m_addressSpaces, getParentUpdater()))));
    if (m_addressSpaces.length == 1) {
        menu.add(new JSeparator());
        menu.add(new JMenuItem(CActionProxy.proxy(new CCreateCombinedCallgraphAction(getParent(), m_container, m_project, m_addressSpaces[0]))));
        menu.add(new JSeparator());
        menu.add(new JMenuItem(CActionProxy.proxy(new CResolveAllFunctionsSingleAddressSpaceAction(menu, m_database, m_addressSpaces[0]))));
    }
    if (m_table != null) {
        menu.add(new JSeparator());
        menu.add(new JMenuItem(CActionProxy.proxy(new CSearchTableAction(getParent(), m_table))));
        menu.add(new JMenuItem(CActionProxy.proxy(new CopySelectionAction(m_table))));
    }
    addPluginMenus(menu);
}
Also used : CDeleteAddressSpaceAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CDeleteAddressSpaceAction) CResolveAllFunctionsSingleAddressSpaceAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CResolveAllFunctionsSingleAddressSpaceAction) CCreateCombinedCallgraphAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CCreateCombinedCallgraphAction) CopySelectionAction(com.google.security.zynamics.zylib.gui.tables.CopySelectionAction) JMenuItem(javax.swing.JMenuItem) CSearchTableAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CSearchTableAction) JSeparator(javax.swing.JSeparator)

Example 78 with JSeparator

use of javax.swing.JSeparator in project binnavi by google.

the class CDatabaseNodeMenuBuilder method createMenu.

@Override
protected void createMenu(final JComponent menu) {
    menu.add(new JMenuItem(openAction));
    menu.add(new JMenuItem(closeAction));
    menu.add(new JSeparator());
    menu.add(new JMenuItem(CActionProxy.proxy(new CImportModuleAction(getParent(), database))));
    menu.add(new JSeparator());
    menu.add(new JMenuItem(CActionProxy.proxy(new CDeleteDatabaseAction(getParent(), database, new CParentSelectionUpdater(getProjectTree(), parentNode)))));
    addPluginMenus(menu);
}
Also used : CParentSelectionUpdater(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Updaters.CParentSelectionUpdater) CDeleteDatabaseAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CDeleteDatabaseAction) CImportModuleAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CImportModuleAction) JMenuItem(javax.swing.JMenuItem) JSeparator(javax.swing.JSeparator)

Example 79 with JSeparator

use of javax.swing.JSeparator in project binnavi by google.

the class CDebuggerNodeMenuBuilder method createMenu.

@Override
protected void createMenu(final JComponent menu) {
    menu.add(new JMenuItem(CActionProxy.proxy(new CDeleteDebuggerDescriptionAction(getParent(), m_database, m_debuggers, getParentUpdater()))));
    if (m_table != null) {
        menu.add(new JSeparator());
        menu.add(new JMenuItem(CActionProxy.proxy(new CopySelectionAction(m_table))));
    }
}
Also used : CDeleteDebuggerDescriptionAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CDeleteDebuggerDescriptionAction) CopySelectionAction(com.google.security.zynamics.zylib.gui.tables.CopySelectionAction) JMenuItem(javax.swing.JMenuItem) JSeparator(javax.swing.JSeparator)

Example 80 with JSeparator

use of javax.swing.JSeparator in project binnavi by google.

the class CProjectNodeMenuBuilder method addPluginMenus.

/**
   * Adds the plugin-generated menus to the context menu.
   * 
   * @param menu The context menu where the menu items are added.
   */
private void addPluginMenus(final JComponent menu) {
    final List<IProjectMenuPlugin> plugins = new ArrayList<IProjectMenuPlugin>();
    for (@SuppressWarnings("rawtypes") final IPlugin plugin : PluginInterface.instance().getPluginRegistry()) {
        if (plugin instanceof IProjectMenuPlugin) {
            plugins.add((IProjectMenuPlugin) plugin);
        }
    }
    if (!plugins.isEmpty()) {
        boolean addedSeparator = false;
        for (final IProjectMenuPlugin plugin : plugins) {
            try {
                final List<JComponent> menuItems = plugin.extendProjectMenu(getPluginProjects());
                if (menuItems != null) {
                    for (final JComponent menuItem : menuItems) {
                        if (!addedSeparator) {
                            menu.add(new JSeparator());
                            addedSeparator = true;
                        }
                        menu.add(menuItem);
                    }
                }
            } catch (final Exception exception) {
                CUtilityFunctions.logException(exception);
                final String innerMessage = "E00088: " + "Plugin caused an unexpected exception";
                final String innerDescription = CUtilityFunctions.createDescription(String.format("The plugin %s caused an unexpected exception.", plugin.getName()), new String[] { "The plugin contains a bug." }, new String[] { "The plugin probably behaves erroneously from this point on but it remains active" });
                NaviErrorDialog.show(getParent(), innerMessage, innerDescription, exception);
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) JComponent(javax.swing.JComponent) IProjectMenuPlugin(com.google.security.zynamics.binnavi.API.plugins.IProjectMenuPlugin) JSeparator(javax.swing.JSeparator) IPlugin(com.google.security.zynamics.binnavi.api2.plugins.IPlugin)

Aggregations

JSeparator (javax.swing.JSeparator)147 JPanel (javax.swing.JPanel)74 JLabel (javax.swing.JLabel)65 ActionEvent (java.awt.event.ActionEvent)44 BoxLayout (javax.swing.BoxLayout)44 JButton (javax.swing.JButton)44 JMenuItem (javax.swing.JMenuItem)38 JMenu (javax.swing.JMenu)32 GridBagConstraints (java.awt.GridBagConstraints)31 Insets (java.awt.Insets)30 ActionListener (java.awt.event.ActionListener)30 Dimension (java.awt.Dimension)24 FlowLayout (java.awt.FlowLayout)24 JScrollPane (javax.swing.JScrollPane)24 GridBagLayout (java.awt.GridBagLayout)22 JPopupMenu (javax.swing.JPopupMenu)19 BorderLayout (java.awt.BorderLayout)16 JTextField (javax.swing.JTextField)16 JCheckBox (javax.swing.JCheckBox)13 AbstractAction (javax.swing.AbstractAction)12