Search in sources :

Example 41 with JButton

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

the class CProgressPanel method createPanel.

private void createPanel(final boolean indeterminate, final boolean showSeconds, final boolean showCancelButton, final boolean addBorder) {
    setLayout(new BorderLayout());
    final JPanel pPb = new JPanel(new BorderLayout());
    pPb.setBorder(new TitledBorder(""));
    if (m_description == null) {
        m_label.setVisible(false);
    } else {
        m_label.setText(convertTextToHtml(m_description));
    }
    pPb.add(m_label, BorderLayout.NORTH);
    m_progressBar.setIndeterminate(indeterminate);
    m_progressBar.setStringPainted(true);
    final JPanel borderPanel = new JPanel(new BorderLayout());
    if (addBorder) {
        borderPanel.setBorder(BorderFactory.createCompoundBorder(new LineBorder(Color.GRAY), new EmptyBorder(1, 1, 1, 1)));
    }
    if (showCancelButton) {
        final JPanel buttonPanel = new JPanel(new BorderLayout());
        final JButton cancelButton = new JButton(new CancelAction());
        cancelButton.setFocusable(false);
        final JPanel paddingPanel = new JPanel(new BorderLayout());
        paddingPanel.setBorder(new EmptyBorder(0, 1, 0, 0));
        paddingPanel.setMinimumSize(new Dimension(1, 0));
        buttonPanel.add(paddingPanel, BorderLayout.WEST);
        buttonPanel.add(cancelButton, BorderLayout.EAST);
        borderPanel.add(buttonPanel, BorderLayout.EAST);
    }
    borderPanel.add(m_progressBar, BorderLayout.CENTER);
    pPb.add(borderPanel, BorderLayout.CENTER);
    if (indeterminate && showSeconds) {
        updateSecondsText();
        m_timer.setRepeats(true);
    }
    add(pPb, BorderLayout.NORTH);
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) LineBorder(javax.swing.border.LineBorder) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Example 42 with JButton

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

the class ErrorDialog method createGui.

private void createGui() {
    final JPanel topPanel = new JPanel(new BorderLayout());
    final JPanel messagePanel = new JPanel(new BorderLayout());
    final JTextField messageField = new JTextField();
    messageField.setEditable(false);
    messageField.setText(message);
    messageField.setBackground(Color.WHITE);
    messagePanel.add(messageField);
    messagePanel.setBorder(new TitledBorder("Error Message"));
    topPanel.add(messagePanel, BorderLayout.NORTH);
    final JTabbedPane tabbedPane = new JTabbedPane();
    final JTextArea descriptionArea = new JTextArea();
    descriptionArea.setEditable(false);
    descriptionArea.setText(description);
    descriptionArea.setLineWrap(true);
    descriptionArea.setWrapStyleWord(true);
    tabbedPane.addTab("Description", descriptionArea);
    if (exception != null) {
        final JTextArea traceArea = new JTextArea();
        traceArea.setEditable(false);
        traceArea.setText(StackTrace.toString(exception.getStackTrace()));
        tabbedPane.addTab("Stack Trace", new JScrollPane(traceArea));
    }
    add(topPanel, BorderLayout.NORTH);
    add(tabbedPane);
    final JPanel bottomButtonPanel = new JPanel(new BorderLayout());
    final JPanel leftButtonPanelBottom = new JPanel();
    final JButton reportButton = new JButton(new ReportAction());
    reportButton.setMinimumSize(new Dimension(180, reportButton.getHeight()));
    leftButtonPanelBottom.add(reportButton);
    bottomButtonPanel.add(leftButtonPanelBottom, BorderLayout.WEST);
    final JPanel rightButtonPanelBottom = new JPanel();
    final JButton okButton = new JButton(new CloseButtonListener());
    getRootPane().setDefaultButton(okButton);
    rightButtonPanelBottom.add(okButton);
    bottomButtonPanel.add(rightButtonPanelBottom, BorderLayout.EAST);
    add(bottomButtonPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) BorderLayout(java.awt.BorderLayout) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) TitledBorder(javax.swing.border.TitledBorder)

Example 43 with JButton

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

the class MemberDialog method createControls.

private void createControls(final TypeManager typeManager) {
    setBounds(100, 100, 450, 215);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    final GridBagLayout gbl_contentPanel = new GridBagLayout();
    gbl_contentPanel.columnWidths = new int[] { 0, 0, 0 };
    gbl_contentPanel.rowHeights = new int[] { 0, 0, 0, 0 };
    gbl_contentPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
    contentPanel.setLayout(gbl_contentPanel);
    {
        final JLabel lblMemberName = new JLabel("Member name:");
        final GridBagConstraints gbc_lblMemberName = new GridBagConstraints();
        gbc_lblMemberName.insets = new Insets(0, 0, 5, 5);
        gbc_lblMemberName.anchor = GridBagConstraints.EAST;
        gbc_lblMemberName.gridx = 0;
        gbc_lblMemberName.gridy = 0;
        contentPanel.add(lblMemberName, gbc_lblMemberName);
    }
    {
        memberName = new JTextField();
        final GridBagConstraints gbc_memberName = new GridBagConstraints();
        gbc_memberName.insets = new Insets(0, 0, 5, 0);
        gbc_memberName.fill = GridBagConstraints.HORIZONTAL;
        gbc_memberName.gridx = 1;
        gbc_memberName.gridy = 0;
        contentPanel.add(memberName, gbc_memberName);
        memberName.setColumns(10);
    }
    {
        final JLabel lblMemberType = new JLabel("Member type:");
        final GridBagConstraints gbc_lblMemberType = new GridBagConstraints();
        gbc_lblMemberType.anchor = GridBagConstraints.EAST;
        gbc_lblMemberType.insets = new Insets(0, 0, 5, 5);
        gbc_lblMemberType.gridx = 0;
        gbc_lblMemberType.gridy = 1;
        contentPanel.add(lblMemberType, gbc_lblMemberType);
    }
    {
        memberType = new TypeComboBox(new TypeListModel(typeManager.getTypes(), new TypeListModel.PrototypesFilter()));
        final GridBagConstraints gbc_memberType = new GridBagConstraints();
        gbc_memberType.insets = new Insets(0, 0, 5, 0);
        gbc_memberType.fill = GridBagConstraints.HORIZONTAL;
        gbc_memberType.gridx = 1;
        gbc_memberType.gridy = 1;
        contentPanel.add(memberType, gbc_memberType);
    }
    {
        final JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            final JButton okButton = new JButton("OK");
            okButton.addActionListener(new OkActionListener());
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            final JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(final ActionEvent e) {
                    dispose();
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) EmptyBorder(javax.swing.border.EmptyBorder)

Example 44 with JButton

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

the class CGraphToolBar method addButton.

/**
   * Adds a button to the toolbar.
   * 
   * @param action The action associated with the button.
   * @param rolloverIcon Path to the icon to be used when the mouse hovers over the button.
   * @param pressedIcon Path to the icon to be used when the button is pressed.
   * 
   * @return The created button.
   */
private JButton addButton(final AbstractAction action, final String rolloverIcon, final String pressedIcon) {
    final JButton button = add(CActionProxy.proxy(action));
    button.setFocusable(false);
    button.setBorder(new EmptyBorder(new Insets(1, 0, 1, 0)));
    button.setRolloverIcon(new ImageIcon(CMain.class.getResource(rolloverIcon)));
    button.setPressedIcon(new ImageIcon(CMain.class.getResource(pressedIcon)));
    return button;
}
Also used : ImageIcon(javax.swing.ImageIcon) Insets(java.awt.Insets) JButton(javax.swing.JButton) EmptyBorder(javax.swing.border.EmptyBorder)

Example 45 with JButton

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

the class CGraphToolBar method createButtons.

/**
   * Creates the toolbar.
   * 
   * @param parent Parent window used for dialogws.
   * @param graph The graph the toolbar is for.
   * @param graphPanel Panel in which the graph is shown.
   */
private void createButtons(final JFrame parent, final ZyGraph graph, final CGraphPanel graphPanel) {
    final CActionZoomIn zoomInAction = new CActionZoomIn(graph);
    final JButton zoomInButton = addButton(zoomInAction, "data/magnify_hover.jpg", "data/magnify_down.jpg");
    addHotkey(zoomInButton, HotKeys.GRAPH_TOOLBAR_ZOOM_IN.getKeyStroke(), zoomInAction, "Zoom In");
    final CActionZoomOut zoomOutAction = new CActionZoomOut(graph);
    final JButton zoomOutButton = addButton(zoomOutAction, "data/reduce_hover.jpg", "data/reduce_down.jpg");
    addHotkey(zoomOutButton, HotKeys.GRAPH_TOOLBAR_ZOOM_OUT.getKeyStroke(), zoomOutAction, "Zoom Out");
    final CActionZoomSelected zoomSelectedAction = new CActionZoomSelected(graph);
    final JButton zoomSelectedButton = addButton(zoomSelectedAction, "data/frameall_hover.jpg", "data/frameall_down.jpg");
    addHotkey(zoomSelectedButton, HotKeys.GRAPH_TOOLBAR_ZOOM_SELECTED.getKeyStroke(), zoomSelectedAction, "Zoom Selected");
    final CActionZoomFit zoomFitAction = new CActionZoomFit(graph);
    final JButton zoomFitButton = addButton(zoomFitAction, "data/centerview_hover.jpg", "data/centerview_down.jpg");
    addHotkey(zoomFitButton, HotKeys.GRAPH_TOOLBAR_ZOOM_FIT.getKeyStroke(), zoomFitAction, "Fit Graph to Screen");
    m_magnifierModeAction = new CActionMagnifyingGlassViewMode(graph);
    final JButton magnifierModeButton = addButton(m_magnifierModeAction, "data/nomagnifieingglass_hover.jpg", "data/nomagnifieingglass_down.jpg");
    m_magnifierModeAction.setButton(magnifierModeButton);
    addHotkey(magnifierModeButton, HotKeys.GRAPH_TOOLBAR_TOGGLE_MAGNIFY.getKeyStroke(), m_magnifierModeAction, "Magnifying Glass");
    final CActionFreezeView freezeAction = new CActionFreezeView(graph);
    final JButton freezeButton = addButton(freezeAction, "data/viewnavi_hover.jpg", "data/viewnavi_down.jpg");
    freezeAction.setButton(freezeButton);
    addHotkey(freezeButton, HotKeys.GRAPH_TOOLBAR_FREEZE.getKeyStroke(), freezeAction, "Freeze view");
    final CActionCircularLayout circularAction = new CActionCircularLayout(parent, graph);
    final JButton circularButton = addButton(circularAction, "data/laycirc_hover.jpg", "data/laycirc_down.jpg");
    addHotkey(circularButton, HotKeys.GRAPH_TOOLBAR_CIRCULAR_LAYOUT.getKeyStroke(), circularAction, "Circular Layout");
    final CActionOrthogonalLayout orthogonalAction = new CActionOrthogonalLayout(parent, graph);
    final JButton orthogonalButton = addButton(orthogonalAction, "data/layorth_hover.jpg", "data/layorth_down.jpg");
    addHotkey(orthogonalButton, HotKeys.GRAPH_TOOLBAR_ORTHOGONAL_LAYOUT.getKeyStroke(), orthogonalAction, "Orthogonal Layout");
    final CActionHierarchicLayout hierarchicAction = new CActionHierarchicLayout(parent, graph);
    final JButton hierarchicButton = addButton(hierarchicAction, "data/layhier_hover.jpg", "data/layhier_down.jpg");
    addHotkey(hierarchicButton, HotKeys.GRAPH_TOOLBAR_HIERARCHIC_LAYOUT.getKeyStroke(), hierarchicAction, "Hierarchical Layout");
    addButton(new CActionSelectChildren(graph, true), "data/selallchild_hover.jpg", "data/selallchild_down.jpg");
    addButton(new CActionSelectParents(graph, true), "data/selparent_hover.jpg", "data/selparent_down.jpg");
    addButton(new CActionInvertSelection(graph, true), "data/selinvert_hover.jpg", "data/selinvert_down.jpg");
    addButton(new CActionSelectByCriteria(graphPanel, true), "data/selcriteria_hover.jpg", "data/selcriteria_down.jpg");
    final CActionDeleteSelectedNodes deleteSelectedAction = new CActionDeleteSelectedNodes(graph, true);
    final JButton deletedSelectedButton = addButton(deleteSelectedAction, "data/deleteselectednodes_hover.png", "data/deleteselectednodes_down.png");
    addHotkey(deletedSelectedButton, HotKeys.GRAPH_TOOLBAR_DELETE_SELECTED.getKeyStroke(), deleteSelectedAction, HotKeys.GRAPH_TOOLBAR_DELETE_SELECTED.getDescription());
    final CActionDeleteSelectedNodesKeep deleteSelectedKeepAction = new CActionDeleteSelectedNodesKeep(graph);
    final JButton deletedSelectedKeepButton = addButton(deleteSelectedKeepAction, "data/deleteselectednodeskeepedges_hover.png", "data/deleteselectednodeskeepedges_down.png");
    addHotkey(deletedSelectedKeepButton, HotKeys.GRAPH_TOOLBAR_DELETE_SELECTED_KEEP_EDGES.getKeyStroke(), deleteSelectedKeepAction, HotKeys.GRAPH_TOOLBAR_DELETE_SELECTED_KEEP_EDGES.getDescription());
    addButton(new CActionColorNodes(graphPanel), "data/nodecolor_hover.jpg", "data/nodecolor_down.jpg");
}
Also used : CActionOrthogonalLayout(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionOrthogonalLayout) CActionColorNodes(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionColorNodes) JButton(javax.swing.JButton) CActionHierarchicLayout(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionHierarchicLayout) CActionCircularLayout(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionCircularLayout) CActionSelectParents(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionSelectParents) CActionDeleteSelectedNodes(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionDeleteSelectedNodes) CActionMagnifyingGlassViewMode(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionMagnifyingGlassViewMode) CActionSelectChildren(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionSelectChildren) CActionInvertSelection(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionInvertSelection) CActionSelectByCriteria(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionSelectByCriteria) CActionZoomIn(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionZoomIn) CActionDeleteSelectedNodesKeep(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionDeleteSelectedNodesKeep) CActionFreezeView(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionFreezeView) CActionZoomOut(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionZoomOut) CActionZoomSelected(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionZoomSelected) CActionZoomFit(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CActionZoomFit)

Aggregations

JButton (javax.swing.JButton)923 JPanel (javax.swing.JPanel)408 ActionEvent (java.awt.event.ActionEvent)389 ActionListener (java.awt.event.ActionListener)317 JLabel (javax.swing.JLabel)278 JScrollPane (javax.swing.JScrollPane)166 BoxLayout (javax.swing.BoxLayout)158 FlowLayout (java.awt.FlowLayout)142 BorderLayout (java.awt.BorderLayout)138 Dimension (java.awt.Dimension)138 Insets (java.awt.Insets)114 JTextField (javax.swing.JTextField)114 GridBagLayout (java.awt.GridBagLayout)110 JCheckBox (javax.swing.JCheckBox)103 GridBagConstraints (java.awt.GridBagConstraints)95 ImageIcon (javax.swing.ImageIcon)95 JTable (javax.swing.JTable)67 JDialog (javax.swing.JDialog)65 JComboBox (javax.swing.JComboBox)56 JTextArea (javax.swing.JTextArea)56