Java Code Examples for javax.swing.JCheckBox#setText()

The following examples show how to use javax.swing.JCheckBox#setText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarkdownDocletOptionsForm.java    From markdown-doclet with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$()
{
    root = new JPanel();
    root.setLayout(new GridLayoutManager(2, 4, new Insets(0, 0, 0, 0), -1, -1));
    final JLabel label1 = new JLabel();
    label1.setText("Project");
    root.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    enableMarkdownDocletCheckBox = new JCheckBox();
    enableMarkdownDocletCheckBox.setText("Enable Markdown Doclet");
    root.add(enableMarkdownDocletCheckBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    optionsButton = new JButton();
    optionsButton.setText("Options...");
    root.add(optionsButton, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer1 = new Spacer();
    root.add(spacer1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    final JScrollPane scrollPane1 = new JScrollPane();
    root.add(scrollPane1, new GridConstraints(1, 0, 1, 4, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    modulesTable = new JTable();
    modulesTable.setFillsViewportHeight(true);
    scrollPane1.setViewportView(modulesTable);
}
 
Example 2
Source File: DefaultsDisplay.java    From littleluck with Apache License 2.0 6 votes vote down vote up
public ValueRenderer(Color colors[]) {
    super(colors);
    buttonIconRenderer = new JButton();
    buttonIconRenderer.setBorderPainted(false);
    buttonIconRenderer.setContentAreaFilled(false);
    buttonIconRenderer.setText("(for AbstractButtons only)");
    radioIconRenderer = new JRadioButton();
    radioIconRenderer.setBorderPainted(false);
    radioIconRenderer.setText("for JRadioButtons only)");
    checkboxIconRenderer = new JCheckBox();
    checkboxIconRenderer.setBorderPainted(false);
    checkboxIconRenderer.setText("for JCheckBoxes only)");
    menuItemIconRenderer = new JMenuItem();
    menuItemIconRenderer.setBorderPainted(false);
    menuItemIconRenderer.setText("(for JMenuItems only)");
    
}
 
Example 3
Source File: DefaultsDisplay.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
public ValueRenderer(Color colors[]) {
    super(colors);
    buttonIconRenderer = new JButton();
    buttonIconRenderer.setBorderPainted(false);
    buttonIconRenderer.setContentAreaFilled(false);
    buttonIconRenderer.setText("(for AbstractButtons only)");
    radioIconRenderer = new JRadioButton();
    radioIconRenderer.setBorderPainted(false);
    radioIconRenderer.setText("for JRadioButtons only)");
    checkboxIconRenderer = new JCheckBox();
    checkboxIconRenderer.setBorderPainted(false);
    checkboxIconRenderer.setText("for JCheckBoxes only)");
    menuItemIconRenderer = new JMenuItem();
    menuItemIconRenderer.setBorderPainted(false);
    menuItemIconRenderer.setText("(for JMenuItems only)");
    
}
 
Example 4
Source File: AlertsPanel.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
private JCheckBox getRiskBox(final String riskLevel, final String riskName) {
    JCheckBox riskChk = new JCheckBox();
    riskChk.setText(riskLevel);
    riskChk.setSelected(true);
    riskChk.addItemListener(
            new java.awt.event.ItemListener() {
                @Override
                public void itemStateChanged(java.awt.event.ItemEvent e) {
                    boolean selected = (ItemEvent.SELECTED == e.getStateChange());
                    for (JCheckBox selection : selections) {
                        if (alertTypeRisk.get(selection.getName()) == riskName) {
                            selection.setSelected(selected);
                        }
                    }
                }
            });

    return riskChk;
}
 
Example 5
Source File: IncludedFractionsDesktopPane.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
private void ShowAliquotDateModels(
        AliquotInterface aliquot,
        int width,
        int offset) {

    int count = 0;
    JLabel aliquotLabel = new JLabel(aliquot.getAliquotName());
    aliquotLabel.setBounds(0, (offset + (count ++)) * 20 + 25, width, 15);
    add(aliquotLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
    
    for (ETFractionInterface f : ((ReduxAliquotInterface) aliquot).getAliquotFractions()) {
        JCheckBox temp = new JCheckBox();
        temp.setText(f.getFractionID());
        temp.setBounds(0, (offset + (count ++)) * 20 + 25, width, 15);
        add(temp, javax.swing.JLayeredPane.DEFAULT_LAYER);
    }
    setBounds(
            getX(),
            getY(),
            width,
            (offset + ((ReduxAliquotInterface) aliquot).getAliquotFractions().size() * 20 + 25));
}
 
Example 6
Source File: CustomCheckBoxEditor.java    From dsworkbench with Apache License 2.0 6 votes vote down vote up
/**
 * Use null for default Images
 * 
 * @param checkedImg Image that should be displayed if checked
 * @param uncheckedImg Image that should be displayed if not checked
 */
public CustomCheckBoxEditor(String uncheckedImg, String checkedImg) {
    super(new JCheckBox());
    setClickCountToStart(0);
    
    editorComponent = (JCheckBox) super.editorComponent;
    editorComponent.setHorizontalAlignment(SwingConstants.CENTER);
    editorComponent.setText("");
    
    try {
        unchecked = new ImageIcon(this.getClass().getResource(uncheckedImg));
        checked = new ImageIcon(this.getClass().getResource(checkedImg));
    } catch (Exception e) {
        unchecked = null;
        checked = null;
    }
}
 
Example 7
Source File: IsLikeActionListener.java    From HBaseClient with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void stateChanged(ChangeEvent e)
{
    JCheckBox v_IsLike = (JCheckBox)e.getSource();
    
    if ( v_IsLike.isSelected() )
    {
        v_IsLike.setText("精确");
    }
    else
    {
        v_IsLike.setText("模糊");
    }
}
 
Example 8
Source File: DefaultFoldingOptions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void load() {
    types = new ArrayList<FoldType>(FoldUtilities.getFoldTypes(mimeType).values());
    if ("".equals(mimeType)) { // NOI18N
        filterUsedMimeTypes();
    }

    boolean override = isCollapseRedefined();
    boolean currentOverride = 
            isDefinedLocally(PREF_OVERRIDE_DEFAULTS) ? !preferences.getBoolean(PREF_OVERRIDE_DEFAULTS, true) : false;
    if (override != currentOverride) {
        updateOverrideChanged();
    }
    
    for (FoldType ft : types) {
        String name = ft.getLabel();
        
        JCheckBox cb = createCheckBox(ft);
        cb.setText(name);
        cb.putClientProperty("id", ft.code()); // NOI18N
        cb.putClientProperty("type", ft); // NOI18N
        localSwitchboard.add(cb);
        controls.add(cb);
        cb.addItemListener(this);
    }
    
    // watch out for preferences
    this.preferences.addPreferenceChangeListener(this);
    updateEnabledState();
}
 
Example 9
Source File: LoadFromParalelDialog.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
public LoadFromParalelDialog(final JFrame frame, Engine engine) {
    super(frame, true);
    setTitle("loadFromParalel");

    JPanel qPanel = new JPanel();
    qPanel.setLayout(new BoxLayout(qPanel, BoxLayout.Y_AXIS));
    //qPanel.setLayout(new FlowLayout());

    List<Qualifier> list = engine.getQualifiers();

    for (Qualifier qualifier : list) {
        if (IDEF0Plugin.isFunction(qualifier)) {
            qualifiers.add(qualifier);
            JCheckBox box = new JCheckBox();
            box.setText(qualifier.getName());
            boxes.add(box);
            qPanel.add(box);
        }
    }

    JScrollPane pane = new JScrollPane();


    panel.add(pane, BorderLayout.CENTER);

    JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
    p.add(importAllClasificators);
    panel.add(p, BorderLayout.SOUTH);

    setMainPane(panel);

    ResourceLoader.setJComponentsText(this);
    pane.setViewportView(qPanel);
    pack();
    centerDialog();
    Options.loadOptions("loadFromParalel", this);
}
 
Example 10
Source File: FileCheckList.java    From pumpernickel with MIT License 5 votes vote down vote up
@Override
final protected JComponent createComponent(File file) {
	JCheckBox checkBox = new JCheckBox();
	checkBox.setText(getText(file));
	checkBox.addItemListener(itemListener);
	addContextualMenus(checkBox);
	return checkBox;
}
 
Example 11
Source File: SVGImageExporter.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
public JComponent makeOptions(@Nonnull final PluginContext context) {
  final Options options = new Options(flagExpandAllNodes, flagDrawBackground);
  final JPanel panel = UI_FACTORY.makePanelWithOptions(options);
  final JCheckBox checkBoxExpandAll = UI_FACTORY.makeCheckBox();
  checkBoxExpandAll.setSelected(flagExpandAllNodes);
  checkBoxExpandAll.setText(Texts.getString("SvgExporter.optionUnfoldAll"));
  checkBoxExpandAll.setActionCommand("unfold");

  final JCheckBox checkBoxDrawBackground = UI_FACTORY.makeCheckBox();
  checkBoxDrawBackground.setSelected(flagDrawBackground);
  checkBoxDrawBackground.setText(Texts.getString("SvgExporter.optionDrawBackground"));
  checkBoxDrawBackground.setActionCommand("back");

  panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

  panel.add(checkBoxExpandAll);
  panel.add(checkBoxDrawBackground);

  panel.setBorder(BorderFactory.createEmptyBorder(16, 32, 16, 32));

  final ActionListener actionListener = new ActionListener() {
    @Override
    public void actionPerformed(@Nonnull final ActionEvent e) {
      if (e.getSource() == checkBoxExpandAll) {
        options.setOption(Options.KEY_EXPAND_ALL, Boolean.toString(checkBoxExpandAll.isSelected()));
      }
      if (e.getSource() == checkBoxDrawBackground) {
        options.setOption(Options.KEY_DRAW_BACK, Boolean.toString(checkBoxDrawBackground.isSelected()));
      }
    }
  };

  checkBoxExpandAll.addActionListener(actionListener);
  checkBoxDrawBackground.addActionListener(actionListener);

  return panel;
}
 
Example 12
Source File: PNGImageExporter.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
public JComponent makeOptions(@Nonnull final PluginContext context) {
  final Options options = new Options(flagExpandAllNodes, flagDrawBackground);

  final JPanel panel = UI_FACTORY.makePanelWithOptions(options);
  final JCheckBox checkBoxExpandAll = UI_FACTORY.makeCheckBox();
  checkBoxExpandAll.setSelected(flagExpandAllNodes);
  checkBoxExpandAll.setText(Texts.getString("PNGImageExporter.optionUnfoldAll"));
  checkBoxExpandAll.setActionCommand("unfold");

  final JCheckBox checkBoxDrawBackground = UI_FACTORY.makeCheckBox();
  checkBoxDrawBackground.setSelected(flagDrawBackground);
  checkBoxDrawBackground.setText(Texts.getString("PNGImageExporter.optionDrawBackground"));
  checkBoxDrawBackground.setActionCommand("back");

  panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

  panel.add(checkBoxExpandAll);
  panel.add(checkBoxDrawBackground);

  panel.setBorder(BorderFactory.createEmptyBorder(16, 32, 16, 32));

  final ActionListener actionListener = new ActionListener() {
    @Override
    public void actionPerformed(@Nonnull final ActionEvent e) {
      if (e.getSource() == checkBoxExpandAll) {
        options.setOption(Options.KEY_EXPAND_ALL, Boolean.toString(checkBoxExpandAll.isSelected()));
      }
      if (e.getSource() == checkBoxDrawBackground) {
        options.setOption(Options.KEY_DRAW_BACK, Boolean.toString(checkBoxDrawBackground.isSelected()));
      }
    }
  };

  checkBoxExpandAll.addActionListener(actionListener);
  checkBoxDrawBackground.addActionListener(actionListener);

  return panel;
}
 
Example 13
Source File: JPlagCreator.java    From jplag with GNU General Public License v3.0 4 votes vote down vote up
public static JCheckBox createCheckBox(String title, int width, String toolTip) {
	JCheckBox box = createCheckBox(toolTip);
	box.setText(title);
	box.setPreferredSize(new java.awt.Dimension(width, 20));
	return box;
}
 
Example 14
Source File: CheckboxTreeCellEditor.java    From MogwaiERDesignerNG with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Component getTreeCellEditorComponent(JTree aTree, Object aValue,
                                            boolean isSelected, boolean isExpanded, boolean isLeaf, int isRow) {

    final JCheckBox theEditor = new JCheckBox();
    UIInitializer.getInstance().initializeComponent(theEditor);

    editingNode = (DefaultMutableTreeNode) aValue;
    if (editingNode.getUserObject() instanceof SelectableWrapper) {
        SelectableWrapper theWrapper = (SelectableWrapper) editingNode
                .getUserObject();

        theEditor.setEnabled(true);
        theEditor.setText(objectToString(theWrapper.getValue()));
        theEditor.setSelected(theWrapper.isSelected());

        if (isSelected) {
            theEditor.setBackground(initializer.getConfiguration()
                    .getDefaultListSelectionBackground());
            theEditor.setForeground(initializer.getConfiguration()
                    .getDefaultListSelectionForeground());
        } else {
            theEditor.setBackground(initializer.getConfiguration()
                    .getDefaultListNonSelectionBackground());
            theEditor.setForeground(initializer.getConfiguration()
                    .getDefaultListNonSelectionForeground());
        }

        ItemListener theItemListener = itemEvent -> {
            if (stopCellEditing()) {
                SelectableTableModel theModel = (SelectableTableModel) tree.getModel();
                theModel.setSelected(editingNode, theEditor.isSelected());
                fireEditingStopped();
            }
        };

        theEditor.addItemListener(theItemListener);
        return theEditor;
    }
    throw new IllegalArgumentException("Wrong object type");
}
 
Example 15
Source File: AbstractDataMonitorView.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
/**
 *
 * @param inLiveMode the value of inLiveMode
 */
public void prepareConcordia(boolean inLiveMode) {

    if (concordiaGraphPanel != null) {
        this.remove(concordiaGraphPanel);
    }
    if (kwikiConcordiaToolBar != null) {
        this.remove(kwikiConcordiaToolBar);
    }

    if (savedCountOfFractions == 0) {
        concordiaGraphPanel = new ConcordiaGraphPanel(project.getSuperSample(), getuPbReduxFrame());

        ((ConcordiaGraphPanel) concordiaGraphPanel).setCurrentGraphAxesSetup(new GraphAxesSetup("C", 2));

        ((ConcordiaGraphPanel) concordiaGraphPanel).setShowTitleBox(false);

        ((ConcordiaGraphPanel) concordiaGraphPanel).//
                setYorkFitLine(null);
        ((ConcordiaGraphPanel) concordiaGraphPanel).//
                setFadedDeselectedFractions(true);

        project.getSuperSample().getSampleDateInterpretationGUISettings().//
                setConcordiaOptions(((ConcordiaPlotDisplayInterface) concordiaGraphPanel).getConcordiaOptions());
        probabilityChartOptions = project.getSuperSample().getSampleDateInterpretationGUISettings().getProbabilityChartOptions();

        ((ConcordiaGraphPanel) concordiaGraphPanel).//
                setFadedDeselectedFractions(false);

        ((ConcordiaGraphPanel) concordiaGraphPanel).setShowTightToEdges(true);

    }

    setConcordiaBounds(showSessions ? 725 : leftMargin + 135, showSessions ? 620 : 900, 625);

    kwikiConcordiaToolBar = new KwikiConcordiaToolBar(//
            940, topMargin + concordiaGraphPanel.getHeight() + topMargin + 50, concordiaGraphPanel, null);

    ((ConcordiaGraphPanel) concordiaGraphPanel).setSample(project.getSuperSample());
    ((ConcordiaGraphPanel) concordiaGraphPanel).setViewOptions();
    ((ConcordiaGraphPanel) concordiaGraphPanel).setShowBestDateDivider206_238(true);

    add(concordiaGraphPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);

    try {
        Vector<ETFractionInterface> selectedFractions
                = project.getSuperSample().getFractions();

        ((AliquotDetailsDisplayInterface) concordiaGraphPanel).//
                setSelectedFractions(selectedFractions);
        ((PlottingDetailsDisplayInterface) concordiaGraphPanel).resetPanel(true, inLiveMode);
    } catch (Exception e) {
    }

    add(kwikiConcordiaToolBar, javax.swing.JLayeredPane.DEFAULT_LAYER);

    JCheckBox showFilteredFractions_checkbox = new JCheckBox();
    showFilteredFractions_checkbox.setFont(new java.awt.Font("SansSerif", 1, 10));
    showFilteredFractions_checkbox.setText("<html>Filtering ON<br> </html>");
    showFilteredFractions_checkbox.setBounds(leftMargin + 1075, topMargin + 660, 120, 25);
    showFilteredFractions_checkbox.setOpaque(true);
    showFilteredFractions_checkbox.setBackground(Color.white);
    showFilteredFractions_checkbox.addActionListener((java.awt.event.ActionEvent evt) -> {
        boolean state = ((AliquotDetailsDisplayInterface) concordiaGraphPanel).isShowFilteredEllipses();
        ((AliquotDetailsDisplayInterface) concordiaGraphPanel).setShowFilteredEllipses(!state);
        showFilteredFractions_checkbox.setSelected(!state);
        probabilityChartOptions.put("showFilteredEllipses", Boolean.toString(!state));
        concordiaGraphPanel.repaint();
    });

    if (probabilityChartOptions.containsKey("showFilteredEllipses")) {
        showFilteredFractions_checkbox.setSelected(Boolean.valueOf(probabilityChartOptions.get("showFilteredEllipses")));
        ((AliquotDetailsDisplayInterface) concordiaGraphPanel).setShowFilteredEllipses(showFilteredFractions_checkbox.isSelected());
    }

    this.add(showFilteredFractions_checkbox, LAYER_FIVE);

}
 
Example 16
Source File: GoogleJavaFormatConfigurable.java    From google-java-format with Apache License 2.0 4 votes vote down vote up
/**
 * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR
 * call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
  createUIComponents();
  panel = new JPanel();
  panel.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1));
  enable = new JCheckBox();
  enable.setText("Enable google-java-format");
  panel.add(
      enable,
      new GridConstraints(
          0,
          0,
          1,
          2,
          GridConstraints.ANCHOR_WEST,
          GridConstraints.FILL_NONE,
          GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
          GridConstraints.SIZEPOLICY_FIXED,
          null,
          null,
          null,
          0,
          false));
  final Spacer spacer1 = new Spacer();
  panel.add(
      spacer1,
      new GridConstraints(
          2,
          0,
          1,
          2,
          GridConstraints.ANCHOR_CENTER,
          GridConstraints.FILL_VERTICAL,
          1,
          GridConstraints.SIZEPOLICY_WANT_GROW,
          null,
          null,
          null,
          0,
          false));
  final JLabel label1 = new JLabel();
  label1.setText("Code style");
  panel.add(
      label1,
      new GridConstraints(
          1,
          0,
          1,
          1,
          GridConstraints.ANCHOR_WEST,
          GridConstraints.FILL_NONE,
          GridConstraints.SIZEPOLICY_FIXED,
          GridConstraints.SIZEPOLICY_FIXED,
          null,
          null,
          null,
          0,
          false));
  panel.add(
      styleComboBox,
      new GridConstraints(
          1,
          1,
          1,
          1,
          GridConstraints.ANCHOR_WEST,
          GridConstraints.FILL_HORIZONTAL,
          GridConstraints.SIZEPOLICY_CAN_GROW,
          GridConstraints.SIZEPOLICY_FIXED,
          null,
          null,
          null,
          1,
          false));
}
 
Example 17
Source File: AlertDetailsPanel.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
private void initialize() {

        JPanel optionpanel = new JPanel();
        optionpanel.setLayout(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();

        gbc.fill = GridBagConstraints.HORIZONTAL;

        // Include Description
        description = new JCheckBox();
        description.setText(Constant.messages.getString("customreport.alertdetails.description"));
        gbc.gridy = 0;
        gbc.gridx = 0;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(2, 0, 2, 100);
        optionpanel.add(description, gbc);

        // Include Other Info
        otherInfo = new JCheckBox();
        otherInfo.setText(Constant.messages.getString("customreport.alertdetails.otherinfo"));
        gbc.gridy++;
        optionpanel.add(otherInfo, gbc);

        // Include Solution
        solution = new JCheckBox();
        solution.setText(Constant.messages.getString("customreport.alertdetails.solution"));
        gbc.gridy++;
        optionpanel.add(solution, gbc);

        // Include Reference
        reference = new JCheckBox();
        reference.setText(Constant.messages.getString("customreport.alertdetails.reference"));
        gbc.gridy++;
        optionpanel.add(reference, gbc);

        // Include CWE Id
        cweid = new JCheckBox();
        cweid.setText(Constant.messages.getString("customreport.alertdetails.cweid"));
        gbc.gridy++;
        optionpanel.add(cweid, gbc);

        // Include WASC ID
        wascid = new JCheckBox();
        wascid.setText(Constant.messages.getString("customreport.alertdetails.wascid"));
        gbc.gridy++;
        optionpanel.add(wascid, gbc);

        // Include Request Header
        requestHeader = new JCheckBox();
        requestHeader.setText(
                Constant.messages.getString("customreport.alertdetails.requestheader"));
        gbc.gridx = 1;
        gbc.gridy = 0;
        gbc.anchor = GridBagConstraints.EAST;
        gbc.insets = new Insets(2, 0, 2, 0);
        optionpanel.add(requestHeader, gbc);

        // Include Response Header
        responseHeader = new JCheckBox();
        responseHeader.setText(
                Constant.messages.getString("customreport.alertdetails.responseheader"));
        gbc.gridy++;
        optionpanel.add(responseHeader, gbc);

        // Include Request Body
        requestBody = new JCheckBox();
        requestBody.setText(Constant.messages.getString("customreport.alertdetails.requestbody"));
        gbc.gridy++;
        optionpanel.add(requestBody, gbc);

        // Include Response Body
        responseBody = new JCheckBox();
        responseBody.setText(Constant.messages.getString("customreport.alertdetails.responsebody"));
        gbc.gridy++;
        optionpanel.add(responseBody, gbc);

        this.setLayout(new BorderLayout());
        this.add(
                new JLabel(Constant.messages.getString("customreport.alertdetails.label")),
                BorderLayout.NORTH);
        this.add(new JScrollPane(optionpanel), BorderLayout.CENTER);
    }
 
Example 18
Source File: AlertsPanel.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
private void initialize(List<String> alertTypes) {

        selections = new ArrayList<JCheckBox>();
        // Alert selection Panel
        JPanel selectionPanel = new JPanel();
        selectionPanel.setLayout(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.insets = new Insets(2, 5, 30, 10);

        selectionPanel.add(
                getRiskBox(
                        Constant.messages.getString("customreport.alertspanel.risk.high"), "High"),
                gbc);

        gbc.gridx++;
        selectionPanel.add(
                getRiskBox(
                        Constant.messages.getString("customreport.alertspanel.risk.medium"),
                        "Medium"),
                gbc);

        gbc.gridx++;
        selectionPanel.add(
                getRiskBox(Constant.messages.getString("customreport.alertspanel.risk.low"), "Low"),
                gbc);

        gbc.gridx++;
        selectionPanel.add(
                getRiskBox(
                        Constant.messages.getString("customreport.alertspanel.risk.info"),
                        "Informational"),
                gbc);

        gbc.insets = new Insets(0, 20, 2, 0);
        gbc.gridy = 1;
        gbc.gridwidth = 4;

        for (String alertType : alertTypes) {

            JCheckBox selection = new JCheckBox();
            selection.setText(alertType);
            selection.setSelected(true);
            selection.setName(alertType);

            gbc.gridx = 0;
            gbc.anchor = GridBagConstraints.CENTER;
            selectionPanel.add(selection, gbc);
            this.getSelections().add(selection);
            gbc.gridy += 1;
        }

        this.setLayout(new BorderLayout());
        this.add(
                new JLabel(Constant.messages.getString("customreport.alertspanel.label")),
                BorderLayout.NORTH);
        this.add(new JScrollPane(selectionPanel), BorderLayout.CENTER);
    }
 
Example 19
Source File: ToolAdapterTabbedEditorDialog.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected JPanel createPreProcessingPanel() {
    PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor("preprocessorExternalTool");
    PropertyEditor editor = PropertyEditorRegistry.getInstance().findPropertyEditor(propertyDescriptor);
    JComponent firstEditorComponent = editor.createEditorComponent(propertyDescriptor, bindingContext);
    firstEditorComponent.setMaximumSize(new Dimension(firstEditorComponent.getMaximumSize().width,
                                                      controlHeight));
    firstEditorComponent.setPreferredSize(new Dimension(firstEditorComponent.getPreferredSize().width,
                                                        controlHeight));

    propertyDescriptor = propertyContainer.getDescriptor("processingWriter");
    editor = PropertyEditorRegistry.getInstance().findPropertyEditor(propertyDescriptor);
    JComponent secondEditorComponent = editor.createEditorComponent(propertyDescriptor, bindingContext);
    secondEditorComponent.setMaximumSize(new Dimension(secondEditorComponent.getMaximumSize().width,
                                                       controlHeight));
    secondEditorComponent.setPreferredSize(new Dimension(secondEditorComponent.getPreferredSize().width,
                                                         controlHeight));

    JCheckBox checkBoxComponent =
            (JCheckBox)createCheckboxComponent("preprocessTool", firstEditorComponent,
                                               newOperatorDescriptor.getPreprocessTool());
    checkBoxComponent.setText(Bundle.CTL_Label_PreprocessingTool_Text());

    JCheckBox writeComponent =
            (JCheckBox)createCheckboxComponent("writeForProcessing", secondEditorComponent,
                                               newOperatorDescriptor.shouldWriteBeforeProcessing());
    writeComponent.setText(Bundle.CTL_Label_WriteBefore_Text());

    JPanel preProcessingPanel = new JPanel(new SpringLayout());
    preProcessingPanel.add(checkBoxComponent);
    preProcessingPanel.add(firstEditorComponent);


    preProcessingPanel.add(writeComponent);
    preProcessingPanel.add(secondEditorComponent);

    SpringUtilities.makeCompactGrid(preProcessingPanel, 2, 2,
                                    DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING);

    forwardFocusWhenTabKeyReleased(checkBoxComponent, firstEditorComponent);
    forwardFocusWhenTabKeyReleased(firstEditorComponent, writeComponent);
    forwardFocusWhenTabKeyReleased(writeComponent, secondEditorComponent);
    forwardFocusWhenTabKeyReleased(secondEditorComponent, this.tabbedPane);

    return preProcessingPanel;
}
 
Example 20
Source File: ConfigurationPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void setInfo(FeatureInfo info, String displayName, Collection<UpdateElement> toInstall,
            Collection<FeatureInfo.ExtraModuleInfo> missingModules,
            Map<FeatureInfo.ExtraModuleInfo, FeatureInfo> extrasMap, boolean required) {
        this.extrasFilter = new HashSet<>();
        this.featureInfo = info;
        this.featureInstall = toInstall;
        boolean activateNow = toInstall.isEmpty() && missingModules.isEmpty();
        Set<FeatureInfo.ExtraModuleInfo> extraModules = featureInfo.getExtraModules();
        Collection<? extends ModuleInfo> lookupAll = Lookup.getDefault().lookupAll(ModuleInfo.class);
        FindComponentModules findModules = new FindComponentModules(info);
        Collection<UpdateElement> modulesToInstall = findModules.getModulesForInstall();
        selectionsPanel.removeAll();
        for (FeatureInfo.ExtraModuleInfo extraModule : extraModules) {
            JCheckBox jCheckBox = new JCheckBox(extraModule.displayName());
            for (ModuleInfo moduleInfo : lookupAll) {
                if (extraModule.matches(moduleInfo.getCodeName())) {
                    jCheckBox.setText(moduleInfo.getDisplayName());
                }
            }
            
            for (UpdateElement updateElement : modulesToInstall) {
                if (extraModule.matches(updateElement.getCodeName())){
                    jCheckBox.setText(updateElement.getDisplayName());
                }
            }
            
            if (extraModule.isRequiredFor(jdk)) {
                jCheckBox.setSelected(true);
//                jCheckBox.setEnabled(false);
                extrasFilter.add(extraModule);
            }
            jCheckBox.addActionListener(e -> {
                if (jCheckBox.isSelected()) {
                    extrasFilter.add(extraModule);
                } else {
                    extrasFilter.remove(extraModule);
                }
            });
            selectionsPanel.add(jCheckBox);
        }
        if (activateNow) {
            infoLabel.setVisible(false);
            downloadLabel.setVisible(false);
            activateButton.setVisible(false);
            downloadButton.setVisible(false);
            activateButtonActionPerformed(null);
        } else {
            FeatureManager.logUI("ERGO_QUESTION", featureInfo.clusterName, displayName);
            infoLabel.setVisible(true);
            downloadLabel.setVisible(true);
            activateButton.setVisible(true);
            downloadButton.setVisible(true);
            
            // collect descriptions from features contributing installed extras
            List<String> downloadStringList = collectExtraModulesTextsFromFeatures(extrasMap.values(), required);
            String lblDownloadMsg = generateDownloadMessageFromExtraModulesTexts(downloadStringList);
            
            if (required) {
                activateButton.setEnabled(false);
            } else {
                activateButton.setEnabled(true);
            }

            if (!missingModules.isEmpty()) {
                StringBuilder sb = new StringBuilder();
                for (FeatureInfo.ExtraModuleInfo s : missingModules) {
                    if (sb.length() > 0) {
                        sb.append(", "); // NOI18N
                    }
                    sb.append(s.displayName());
                }
                String list = sb.toString();
                if (required) {
                    lblDownloadMsg = NbBundle.getMessage(ConfigurationPanel.class, "MSG_MissingRequiredModules", displayName, list);
                    activateButton.setEnabled(false);
                } else {
                    lblDownloadMsg = NbBundle.getMessage(ConfigurationPanel.class, "MSG_MissingRecommendedModules", displayName, list);
                }
                downloadButton.setEnabled(false);
            } else {
                downloadButton.setEnabled(true);
            }

            String lblActivateMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_EnableInfo", displayName);
            String btnActivateMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_Enable");
            String btnDownloadMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_Download");
            org.openide.awt.Mnemonics.setLocalizedText(infoLabel, lblActivateMsg);
            org.openide.awt.Mnemonics.setLocalizedText(activateButton, btnActivateMsg);
            org.openide.awt.Mnemonics.setLocalizedText(downloadLabel, lblDownloadMsg);
            org.openide.awt.Mnemonics.setLocalizedText(downloadButton, btnDownloadMsg);
        }
    }