Search in sources :

Example 76 with BorderLayout

use of java.awt.BorderLayout in project binnavi by google.

the class COptionsPanel method buildRow.

/**
   * Builds a single row of components in the panel.
   * 
   * @param <T> Type of the editing component.
   * 
   * @param panel Panel the editing component is added to.
   * @param description Type description to be configured in that row.
   * @param hint Hint shown as a tooltip.
   * @param component The component to add to the panel.
   * @param isLast True, if the component is the last component to be added to the panel.
   * 
   * @return The panel passed to the function.
   */
private <T extends Component> T buildRow(final JPanel panel, final ITypeDescription description, final String hint, final T component, final boolean isLast) {
    component.setPreferredSize(new Dimension(COLORPANEL_WIDTH, COLORPANEL_HEIGHT));
    final JPanel rowPanel = new JPanel(new BorderLayout());
    rowPanel.setBorder(new EmptyBorder(0, 2, isLast ? 2 : 0, 2));
    final JPanel innerPanel = new JPanel(new GridLayout(1, 2));
    innerPanel.add(new JCheckBox(new CheckboxAction(description, description.getDescription() + ":")), BorderLayout.CENTER);
    innerPanel.add(CHintCreator.createHintPanel(component, hint), BorderLayout.EAST);
    rowPanel.add(innerPanel, BorderLayout.WEST);
    panel.add(rowPanel);
    return component;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) Dimension(java.awt.Dimension) EmptyBorder(javax.swing.border.EmptyBorder)

Example 77 with BorderLayout

use of java.awt.BorderLayout in project zaproxy by zaproxy.

the class DynamicSSLWelcomeDialog method initLayout.

private void initLayout() {
    if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
        this.setSize(480, 300);
    }
    this.setPreferredSize(new Dimension(480, 300));
    JTextArea txtSslWontWork = new JTextArea();
    txtSslWontWork.setEditable(false);
    // XXX: this doesn't work like expected, it should be the same color as the control's background :-/
    txtSslWontWork.setBackground(SystemColor.control);
    txtSslWontWork.setTabSize(4);
    txtSslWontWork.setWrapStyleWord(true);
    txtSslWontWork.setLineWrap(true);
    txtSslWontWork.setForeground(Color.BLACK);
    txtSslWontWork.setText(Constant.messages.getString("dynssl.text.sslwontwork"));
    getContentPane().setLayout(new BorderLayout());
    final JPanel contentPanel = new JPanel();
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    final JPanel contentIconPane = new JPanel();
    contentPanel.add(contentIconPane, BorderLayout.WEST);
    final JLabel lblCertificateIcon = new JLabel("");
    lblCertificateIcon.setIcon(new ImageIcon(DynamicSSLWelcomeDialog.class.getResource("/resource/certificate48x54.png")));
    contentIconPane.add(lblCertificateIcon);
    final JPanel contentTextPane = new JPanel();
    contentTextPane.setBorder(new EmptyBorder(0, 10, 5, 5));
    contentPanel.add(contentTextPane, BorderLayout.CENTER);
    contentTextPane.setLayout(new BorderLayout(5, 5));
    JPanel panelTitle = new JPanel();
    panelTitle.setBorder(new MatteBorder(0, 0, 1, 0, UIManager.getColor("InternalFrame.borderShadow")));
    contentTextPane.add(panelTitle, BorderLayout.NORTH);
    {
        JLabel lblTitle = new JLabel("SSL " + Constant.messages.getString("dynssl.label.rootca"));
        panelTitle.add(lblTitle);
        lblTitle.setFont(FontUtils.getFont(Font.BOLD));
    }
    contentTextPane.add(txtSslWontWork);
    final JPanel panelButtons = new JPanel();
    contentTextPane.add(panelButtons, BorderLayout.SOUTH);
    GridBagLayout gbl_panelButtons = new GridBagLayout();
    gbl_panelButtons.columnWidths = new int[] { 25, 0, 0 };
    gbl_panelButtons.rowHeights = new int[] { 23, 23, 0 };
    gbl_panelButtons.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    gbl_panelButtons.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    panelButtons.setLayout(gbl_panelButtons);
    GridBagConstraints gbc_btnCreate = new GridBagConstraints();
    gbc_btnCreate.anchor = GridBagConstraints.WEST;
    gbc_btnCreate.fill = GridBagConstraints.HORIZONTAL;
    gbc_btnCreate.insets = new Insets(0, 0, 5, 5);
    gbc_btnCreate.gridx = 0;
    gbc_btnCreate.gridy = 0;
    panelButtons.add(btnCreate, gbc_btnCreate);
    GridBagConstraints gbc_lblCreateCertificateNow = new GridBagConstraints();
    gbc_lblCreateCertificateNow.anchor = GridBagConstraints.WEST;
    gbc_lblCreateCertificateNow.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblCreateCertificateNow.insets = new Insets(0, 0, 5, 0);
    gbc_lblCreateCertificateNow.gridx = 1;
    gbc_lblCreateCertificateNow.gridy = 0;
    final JLabel lblCreateCertificateNow = new JLabel(Constant.messages.getString("dynssl.text.createnow"));
    panelButtons.add(lblCreateCertificateNow, gbc_lblCreateCertificateNow);
    GridBagConstraints gbc_btnLater = new GridBagConstraints();
    gbc_btnLater.anchor = GridBagConstraints.WEST;
    gbc_btnLater.fill = GridBagConstraints.HORIZONTAL;
    gbc_btnLater.insets = new Insets(0, 0, 0, 5);
    gbc_btnLater.gridx = 0;
    gbc_btnLater.gridy = 1;
    panelButtons.add(btnLater, gbc_btnLater);
    GridBagConstraints gbc_lblNotNowBut = new GridBagConstraints();
    gbc_lblNotNowBut.anchor = GridBagConstraints.WEST;
    gbc_lblNotNowBut.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblNotNowBut.gridx = 1;
    gbc_lblNotNowBut.gridy = 1;
    final JLabel lblNotNowBut = new JLabel(Constant.messages.getString("dynssl.text.notnow"));
    panelButtons.add(lblNotNowBut, gbc_lblNotNowBut);
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) MatteBorder(javax.swing.border.MatteBorder) GridBagConstraints(java.awt.GridBagConstraints) JTextArea(javax.swing.JTextArea) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) EmptyBorder(javax.swing.border.EmptyBorder)

Example 78 with BorderLayout

use of java.awt.BorderLayout in project zaproxy by zaproxy.

the class AddOnDependencyChecker method confirmChanges.

private boolean confirmChanges(Component parent, AddOnChangesResult changesResult, boolean updating) {
    Set<AddOn> selectedAddOnsJavaIssue = new HashSet<>();
    for (AddOn addOn : changesResult.getSelectedAddOns()) {
        if (!addOn.canRunInCurrentJavaVersion()) {
            selectedAddOnsJavaIssue.add(addOn);
        }
    }
    String question;
    Set<AddOn> installs = new HashSet<>(changesResult.getInstalls());
    Set<AddOn> updates = new HashSet<>(changesResult.getNewVersions());
    Set<AddOn> dependents = getDependents(updates, changesResult.getUninstalls());
    if (updating) {
        question = Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithUpdate");
        updates.removeAll(changesResult.getSelectedAddOns());
    } else {
        question = Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithInstallation");
        installs.removeAll(changesResult.getSelectedAddOns());
    }
    if (changesResult.getUninstalls().isEmpty() && updates.isEmpty() && installs.isEmpty() && dependents.isEmpty() && changesResult.getOptionalAddOns().isEmpty() && changesResult.getSoftUnloadExtensions().isEmpty() && changesResult.getUnloadExtensions().isEmpty()) {
        // No other changes required.
        if (selectedAddOnsJavaIssue.isEmpty()) {
            // No need to ask for confirmation.
            return true;
        }
        int size = changesResult.getSelectedAddOns().size();
        if (size == 1) {
            String baseMessage = MessageFormat.format(Constant.messages.getString("cfu.confirmation.dialogue.message.selectedAddOnNewerJavaVersion"), changesResult.getSelectedAddOns().iterator().next().getMinimumJavaVersion());
            return JOptionPane.showConfirmDialog(parent, baseMessage + question, Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
        }
        String mainMessage;
        if (selectedAddOnsJavaIssue.size() == size) {
            mainMessage = Constant.messages.getString("cfu.confirmation.dialogue.message.addOnsNewerJavaVersion");
        } else {
            mainMessage = Constant.messages.getString("cfu.confirmation.dialogue.message.someSelectedAddOnsNewerJavaVersion");
        }
        JLabel label = new JLabel(Constant.messages.getString("cfu.confirmation.dialogue.message.warnAddOnsNotRunJavaVersion"), ManageAddOnsDialog.ICON_ADD_ON_ISSUES, SwingConstants.LEADING);
        Object[] msgs = { mainMessage, createScrollableTable(new AddOnTableModel(selectedAddOnsJavaIssue, selectedAddOnsJavaIssue.size())), label, question };
        return JOptionPane.showConfirmDialog(parent, msgs, Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
    }
    JPanel panel = new JPanel(new BorderLayout());
    JTabbedPane tabs = new JTabbedPane();
    panel.add(tabs);
    int issues = selectedAddOnsJavaIssue.size();
    if (!selectedAddOnsJavaIssue.isEmpty()) {
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.selectedAddOns"), createScrollableTable(new AddOnTableModel(selectedAddOnsJavaIssue, selectedAddOnsJavaIssue.size())));
    }
    if (!changesResult.getUninstalls().isEmpty()) {
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.uninstallations"), createScrollableTable(new AddOnTableModel(changesResult.getUninstalls(), false)));
    }
    if (!updates.isEmpty()) {
        AddOnTableModel model = new AddOnTableModel(updates);
        issues += model.getMinimumJavaVersionIssues();
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.updats"), createScrollableTable(model));
    }
    if (!installs.isEmpty()) {
        AddOnTableModel model = new AddOnTableModel(installs);
        issues += model.getMinimumJavaVersionIssues();
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.installations"), createScrollableTable(model));
    }
    if (!dependents.isEmpty()) {
        AddOnTableModel model = new AddOnTableModel(dependents);
        issues += model.getMinimumJavaVersionIssues();
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.softUninstalls"), createScrollableTable(model));
    }
    SelectableAddOnTableModel optionalAddOnsTableModel = null;
    if (!changesResult.getOptionalAddOns().isEmpty()) {
        optionalAddOnsTableModel = new SelectableAddOnTableModel(changesResult.getOptionalAddOns());
        issues += optionalAddOnsTableModel.getMinimumJavaVersionIssues();
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.optionalAddOns"), createScrollableTable(optionalAddOnsTableModel));
    }
    if (!changesResult.getUnloadExtensions().isEmpty()) {
        ExtensionsTableModel model = new ExtensionsTableModel(changesResult.getUnloadExtensions());
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.extensionUnloads"), createScrollableTable(model));
    }
    if (!changesResult.getSoftUnloadExtensions().isEmpty()) {
        ExtensionsTableModel model = new ExtensionsTableModel(changesResult.getSoftUnloadExtensions());
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.extensionSoftUnloads"), createScrollableTable(model));
    }
    List<Object> optionPaneContents = new ArrayList<>();
    if (!changesResult.getOptionalAddOns().isEmpty() && changesResult.getUninstalls().isEmpty() && updates.isEmpty() && installs.isEmpty() && dependents.isEmpty() && changesResult.getSoftUnloadExtensions().isEmpty() && changesResult.getUnloadExtensions().isEmpty()) {
        optionPaneContents.add(Constant.messages.getString("cfu.confirmation.dialogue.message.suggestedChanges"));
    } else if (!changesResult.getOptionalAddOns().isEmpty()) {
        optionPaneContents.add(Constant.messages.getString("cfu.confirmation.dialogue.message.requiredSuggestedChanges"));
    } else {
        optionPaneContents.add(Constant.messages.getString("cfu.confirmation.dialogue.message.requiredChanges"));
    }
    optionPaneContents.add(panel);
    if (issues != 0) {
        String message;
        if (selectedAddOnsJavaIssue.size() == issues) {
            if (selectedAddOnsJavaIssue.size() == changesResult.getSelectedAddOns().size()) {
                message = Constant.messages.getString("cfu.confirmation.dialogue.message.selectedAddOnsNewerJavaVersion");
            } else {
                message = Constant.messages.getString("cfu.confirmation.dialogue.message.someUnnamedSelectedAddOnsNewerJavaVersion");
            }
        } else if (issues == 1) {
            message = Constant.messages.getString("cfu.confirmation.dialogue.message.addOnNewerJavaVersion");
        } else {
            message = Constant.messages.getString("cfu.confirmation.dialogue.message.someAddOnsNewerJavaVersion");
        }
        JLabel label = new JLabel(Constant.messages.getString("cfu.confirmation.dialogue.message.warnUnknownNumberAddOnsNotRunJavaVersion"), ManageAddOnsDialog.ICON_ADD_ON_ISSUES, SwingConstants.LEADING);
        optionPaneContents.add(message);
        optionPaneContents.add(label);
    }
    optionPaneContents.add(question);
    boolean confirmed = JOptionPane.showConfirmDialog(parent, optionPaneContents.toArray(), Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
    if (confirmed && optionalAddOnsTableModel != null) {
        changesResult.getInstalls().addAll(optionalAddOnsTableModel.getSelectedAddOns());
    }
    return confirmed;
}
Also used : JPanel(javax.swing.JPanel) AddOn(org.zaproxy.zap.control.AddOn) JTabbedPane(javax.swing.JTabbedPane) ArrayList(java.util.ArrayList) JLabel(javax.swing.JLabel) BorderLayout(java.awt.BorderLayout) HashSet(java.util.HashSet)

Example 79 with BorderLayout

use of java.awt.BorderLayout in project zaproxy by zaproxy.

the class ContextAuthenticationPanel method getConfigContainerPanel.

private JPanel getConfigContainerPanel() {
    if (configContainerPanel == null) {
        configContainerPanel = new JPanel(new BorderLayout());
        configContainerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PANEL_TITLE_CONFIG, javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black));
    }
    return configContainerPanel;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout)

Example 80 with BorderLayout

use of java.awt.BorderLayout in project zaproxy by zaproxy.

the class WorkbenchPanel method getPaneSelect.

/**
	 * This method initializes paneSelect
	 * 
	 * @return JPanel
	 */
private JPanel getPaneSelect() {
    if (paneSelect == null) {
        paneSelect = new JPanel();
        paneSelect.setLayout(new BorderLayout(0, 0));
        paneSelect.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        paneSelect.add(getTabbedSelect());
    }
    return paneSelect;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout)

Aggregations

BorderLayout (java.awt.BorderLayout)761 JPanel (javax.swing.JPanel)514 JLabel (javax.swing.JLabel)238 JScrollPane (javax.swing.JScrollPane)191 Dimension (java.awt.Dimension)155 JButton (javax.swing.JButton)134 FlowLayout (java.awt.FlowLayout)90 ActionEvent (java.awt.event.ActionEvent)88 JTextField (javax.swing.JTextField)85 EmptyBorder (javax.swing.border.EmptyBorder)73 ActionListener (java.awt.event.ActionListener)70 JCheckBox (javax.swing.JCheckBox)69 Insets (java.awt.Insets)64 BoxLayout (javax.swing.BoxLayout)62 GridBagConstraints (java.awt.GridBagConstraints)57 GridBagLayout (java.awt.GridBagLayout)57 JTable (javax.swing.JTable)57 JTextArea (javax.swing.JTextArea)52 GridLayout (java.awt.GridLayout)49 Box (javax.swing.Box)45