Java Code Examples for javax.swing.GroupLayout#setAutoCreateGaps()

The following examples show how to use javax.swing.GroupLayout#setAutoCreateGaps() . 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: PrefixStringProcessorUIHandler.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
public PrefixStringProcessorUIPanel() {
    fieldsPanel = new JPanel();

    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    JLabel valueLabel = new JLabel(VALUE_FIELD_LABEL);
    valueLabel.setLabelFor(getValueTextField());

    layout.setHorizontalGroup(
            layout.createSequentialGroup()
                    .addComponent(valueLabel)
                    .addComponent(getValueTextField()));

    layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(valueLabel)
                    .addComponent(getValueTextField()));
}
 
Example 2
Source File: PostfixStringProcessorUIHandler.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
public PostfixStringProcessorUIPanel() {
    fieldsPanel = new JPanel();

    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    JLabel valueLabel = new JLabel(VALUE_FIELD_LABEL);
    valueLabel.setLabelFor(getValueTextField());

    layout.setHorizontalGroup(
            layout.createSequentialGroup()
                    .addComponent(valueLabel)
                    .addComponent(getValueTextField()));

    layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(valueLabel)
                    .addComponent(getValueTextField()));
}
 
Example 3
Source File: CELabelsPanel.java    From open-ig with GNU Lesser General Public License v3.0 6 votes vote down vote up
/** @return the bottom panel. */
JComponent createBottomPanel() {
	bottomPanel = new JPanel();
	
	GroupLayout gl = new GroupLayout(bottomPanel);
	bottomPanel.setLayout(gl);
	gl.setAutoCreateContainerGaps(true);
	gl.setAutoCreateGaps(true);

	keyField = new JTextField();
	keyLabel = new JLabel(get("label.key"));
	
	
	JScrollPane sp = new JScrollPane(bottomPanel);
	sp.getVerticalScrollBar().setUnitIncrement(30);
	sp.getVerticalScrollBar().setBlockIncrement(90);
	
	
	return sp;
}
 
Example 4
Source File: FuzzerHttpMessageScriptProcessorAdapterUIHandler.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
private void setupFieldsPanel() {
    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    JLabel scriptLabel = new JLabel(SCRIPT_FIELD_LABEL);
    scriptLabel.setLabelFor(scriptComboBox);

    JScrollPane parametersScrollPane = new JScrollPane(scriptParametersPanel);

    layout.setHorizontalGroup(
            layout.createParallelGroup()
                    .addGroup(
                            layout.createSequentialGroup()
                                    .addComponent(scriptLabel)
                                    .addComponent(scriptComboBox))
                    .addComponent(parametersScrollPane));

    layout.setVerticalGroup(
            layout.createSequentialGroup()
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(scriptLabel)
                                    .addComponent(scriptComboBox))
                    .addComponent(parametersScrollPane));
}
 
Example 5
Source File: DefaultEmptyPayloadGeneratorUIHandler.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
public DefaultEmptyPayloadGeneratorUIPanel() {
    fieldsPanel = new JPanel();

    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    JLabel valueLabel = new JLabel(NUMBER_REPETITIONS_FIELD_LABEL);
    valueLabel.setLabelFor(getRepetitionsNumberSpinner());

    layout.setHorizontalGroup(
            layout.createSequentialGroup()
                    .addComponent(valueLabel)
                    .addComponent(getRepetitionsNumberSpinner()));

    layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(valueLabel)
                    .addComponent(getRepetitionsNumberSpinner()));
}
 
Example 6
Source File: StockpileDialog.java    From jeveassets with GNU General Public License v2.0 5 votes vote down vote up
private void doLayout() {
	autoValidate();
	jFilters.removeAll();
	
	GroupLayout layout = new GroupLayout(jFilters);
	jFilters.setLayout(layout);
	layout.setAutoCreateGaps(true);
	layout.setAutoCreateContainerGaps(false);

	ParallelGroup horizontalGroup = layout.createParallelGroup();
	SequentialGroup verticalGroup = layout.createSequentialGroup();
	for (FilterPanel ownerPanel : ownerPanels) {
		horizontalGroup.addComponent(ownerPanel.getPanel());
		verticalGroup.addComponent(ownerPanel.getPanel());
	}

	for (FilterPanel flagPanel : flagPanels) {
		horizontalGroup.addComponent(flagPanel.getPanel());
		verticalGroup.addComponent(flagPanel.getPanel());
	}

	for (FilterPanel containerPanel : containerPanels) {
		horizontalGroup.addComponent(containerPanel.getPanel());
		verticalGroup.addComponent(containerPanel.getPanel());
	}
	if (singletonPanel != null) {
		horizontalGroup.addComponent(singletonPanel.getPanel());
		verticalGroup.addComponent(singletonPanel.getPanel());
	}

	layout.setVerticalGroup(verticalGroup);
	layout.setHorizontalGroup(horizontalGroup);
	getDialog().pack();
}
 
Example 7
Source File: FilterPanelSeparator.java    From jeveassets with GNU General Public License v2.0 5 votes vote down vote up
public FilterPanelSeparator(int group) {
	this.group = group;

	jPanel = new JPanel();

	GroupLayout layout = new GroupLayout(jPanel);
	jPanel.setLayout(layout);
	layout.setAutoCreateGaps(true);
	layout.setAutoCreateContainerGaps(false);

	BufferedImageOp lookup = new LookupOp(new ColorMapper(Color.WHITE, getColor("nimbusBlueGrey", "Separator.foreground")), null);
	BufferedImage convertedImage = lookup.filter((BufferedImage)Images.MISC_AND.getImage(), null);
	JLabel jIcon = new JLabel(new ImageIcon(convertedImage));

	layout.setHorizontalGroup(
		layout.createSequentialGroup()
			.addGap(30)
			.addComponent(jIcon, 12, 12, 12)
	);

	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addGap(1)
			.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
				.addComponent(jIcon, 4, 4, 4)
			)
			.addGap(1)
	);
}
 
Example 8
Source File: JsonPayloadGeneratorAdapterUIHandler.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
public JsonPayloadGeneratorUIPanel() {
    fieldsPanel = new JPanel();

    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    numberOfPayloadsSpinner = new ZapNumberSpinner(1, 1, Integer.MAX_VALUE);
    JLabel numberOfPayloadsLabel = new JLabel(NUMBER_PAYLOADS_LABEL);
    numberOfPayloadsLabel.setLabelFor(numberOfPayloadsSpinner);

    JLabel jsonFieldLabel = new JLabel(JSON_FIELD_LABEL);
    jsonFieldLabel.setLabelFor(getJsonTextArea());
    JScrollPane jsonFieldScrollPane = new JScrollPane(getJsonTextArea());

    layout.setHorizontalGroup(
            layout.createSequentialGroup()
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                                    .addComponent(numberOfPayloadsLabel)
                                    .addComponent(jsonFieldLabel))
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                    .addComponent(numberOfPayloadsSpinner)
                                    .addComponent(jsonFieldScrollPane)));

    layout.setVerticalGroup(
            layout.createSequentialGroup()
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(numberOfPayloadsLabel)
                                    .addComponent(numberOfPayloadsSpinner))
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(jsonFieldLabel)
                                    .addComponent(jsonFieldScrollPane)));
}
 
Example 9
Source File: WebSocketMessageSelectorPanel.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
public WebSocketMessageSelectorPanel() {
    panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    JLabel label =
            new JLabel(
                    Constant.messages.getString(
                            "websocket.fuzzer.select.message.dialogue.warn"));

    layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(label));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(label));
}
 
Example 10
Source File: NumberPayloadGeneratorAdapterUIHandler.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
public NumberPayloadGeneratorUIPanel() {

            fieldsPanel = new JPanel();

            GroupLayout layout = new GroupLayout(fieldsPanel);
            fieldsPanel.setLayout(layout);
            layout.setAutoCreateGaps(true);

            fromField = new ZapNumberSpinner(Integer.MIN_VALUE, 0, Integer.MAX_VALUE);
            toField = new ZapNumberSpinner(Integer.MIN_VALUE, 0, Integer.MAX_VALUE);
            stepField = new ZapNumberSpinner(Integer.MIN_VALUE, 1, Integer.MAX_VALUE);

            JLabel fromLabel = new JLabel(PAYLOADS_FROM_LABEL);
            fromLabel.setLabelFor(fromField);

            JLabel toLabel = new JLabel(PAYLOADS_TO_LABEL);
            toLabel.setLabelFor(toField);

            JLabel stepLabel = new JLabel(PAYLOADS_INCREMENT_LABEL);
            stepLabel.setLabelFor(stepField);

            JLabel payloadsPreviewLabel = new JLabel(PAYLOADS_PREVIEW_FIELD_LABEL);
            payloadsPreviewLabel.setLabelFor(getPayloadsPreviewTextArea());
            JScrollPane payloadsPreviewScrollPane = new JScrollPane(getPayloadsPreviewTextArea());

            setPreviewAndSaveButtonsEnabled(true);
            layout.setHorizontalGroup(
                    layout.createSequentialGroup()
                            .addGroup(
                                    layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                                            .addComponent(fromLabel)
                                            .addComponent(toLabel)
                                            .addComponent(stepLabel)
                                            .addComponent(payloadsPreviewLabel))
                            .addGroup(
                                    layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                            .addComponent(fromField)
                                            .addComponent(toField)
                                            .addComponent(stepField)
                                            .addGroup(
                                                    layout.createSequentialGroup()
                                                            .addComponent(
                                                                    getPayloadsPreviewGenerateButton())
                                                            .addComponent(getSaveButton()))
                                            .addComponent(payloadsPreviewScrollPane)));
            layout.setVerticalGroup(
                    layout.createSequentialGroup()
                            .addGroup(
                                    layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(fromLabel)
                                            .addComponent(fromField))
                            .addGroup(
                                    layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(toLabel)
                                            .addComponent(toField))
                            .addGroup(
                                    layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(stepLabel)
                                            .addComponent(stepField))
                            .addGroup(
                                    layout.createParallelGroup()
                                            .addComponent(getPayloadsPreviewGenerateButton())
                                            .addComponent(getSaveButton()))
                            .addGroup(
                                    layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(payloadsPreviewLabel)
                                            .addComponent(payloadsPreviewScrollPane)));
        }
 
Example 11
Source File: ModifyFuzzerMessageProcessorDialog.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
@Override
protected JPanel getFieldsPanel() {
    JPanel fieldsPanel = new JPanel();

    GroupLayout groupLayout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(groupLayout);
    groupLayout.setAutoCreateGaps(true);
    groupLayout.setAutoCreateContainerGaps(true);

    JLabel typeLabel = new JLabel(TYPE_LABEL);
    JLabel nameTypeLabel = new JLabel(nameType);

    groupLayout.setHorizontalGroup(
            groupLayout
                    .createParallelGroup()
                    .addGroup(
                            groupLayout
                                    .createSequentialGroup()
                                    .addGroup(
                                            groupLayout
                                                    .createParallelGroup(
                                                            GroupLayout.Alignment.TRAILING)
                                                    .addComponent(typeLabel))
                                    .addGroup(
                                            groupLayout
                                                    .createParallelGroup(
                                                            GroupLayout.Alignment.LEADING)
                                                    .addComponent(nameTypeLabel)))
                    .addComponent(contentPanel.getComponent()));

    groupLayout.setVerticalGroup(
            groupLayout
                    .createSequentialGroup()
                    .addGroup(
                            groupLayout
                                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(typeLabel)
                                    .addComponent(nameTypeLabel))
                    .addComponent(contentPanel.getComponent()));

    return fieldsPanel;
}
 
Example 12
Source File: CETechnologyVideosPanel.java    From open-ig with GNU Lesser General Public License v3.0 4 votes vote down vote up
/** Initializes the GUI. */
private void initGUI() {
	JPanel panel = new JPanel();
	GroupLayout gl = new GroupLayout(panel);
	panel.setLayout(gl);
	gl.setAutoCreateContainerGaps(true);
	gl.setAutoCreateGaps(true);
	
	videoField = CEValueBox.of(get("tech.video"), new JTextField());
	
	normalVideo = new CEVideoRef(get("tech.video.normal"));
	wiredVideo = new CEVideoRef(get("tech.video.wired"));
	
	addValidator(videoField, new Action1<Object>() {
		@Override
		public void invoke(Object value) {
			setVideos();
		}
	});
	
	// --------------------------------------------------
	
	int imageSize = 100;
	
	gl.setHorizontalGroup(
		gl.createParallelGroup()
		.addComponent(videoField)
		.addGroup(
			gl.createSequentialGroup()
			.addComponent(normalVideo.image, imageSize, imageSize, imageSize)
			.addComponent(normalVideo.valid)
			.addComponent(normalVideo.label)
			.addComponent(normalVideo.path)
			.addGap(30)
			.addComponent(wiredVideo.image, imageSize, imageSize, imageSize)
			.addComponent(wiredVideo.valid)
			.addComponent(wiredVideo.label)
			.addComponent(wiredVideo.path)
		)
	);
	
	gl.setVerticalGroup(
		gl.createSequentialGroup()
		.addComponent(videoField)
		.addGroup(
			gl.createParallelGroup(Alignment.CENTER)
			.addComponent(normalVideo.image, imageSize, imageSize, imageSize)
			.addComponent(normalVideo.valid)
			.addComponent(normalVideo.label)
			.addComponent(normalVideo.path, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			.addComponent(wiredVideo.image, imageSize, imageSize, imageSize)
			.addComponent(wiredVideo.valid)
			.addComponent(wiredVideo.label)
			.addComponent(wiredVideo.path, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
		)
	);
	
	JScrollPane sp = new JScrollPane(panel);

	sp.getVerticalScrollBar().setUnitIncrement(30);
	sp.getVerticalScrollBar().setBlockIncrement(90);

	setLayout(new BorderLayout());
	add(sp, BorderLayout.CENTER);
}
 
Example 13
Source File: StringEditor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Component getCustomEditor () {
    if (customEditor == null) {
        JTextArea textArea = new JTextArea();
        textArea.setWrapStyleWord(true);
        textArea.setLineWrap(true);
        textArea.setColumns(60);
        textArea.setRows(8);
        textArea.getDocument().addDocumentListener(this);
        textArea.getAccessibleContext().setAccessibleName(
                NbBundle.getBundle(StringEditor.class).getString("ACSN_StringEditorTextArea")); //NOI18N
        textArea.getAccessibleContext().setAccessibleDescription(
                NbBundle.getBundle(StringEditor.class).getString("ACSD_StringEditorTextArea")); //NOI18N

        JScrollPane scroll = new JScrollPane();
        scroll.setViewportView(textArea);

        JLabel htmlTipLabel = new JLabel(NbBundle.getMessage(StringEditor.class, "StringEditor.htmlTipLabel.text")); // NOI18N

        JPanel panel = new JPanel();
        GroupLayout layout = new GroupLayout(panel);
        layout.setAutoCreateGaps(true);
        panel.setLayout(layout);
        layout.setHorizontalGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup()
                    .addComponent(scroll)
                    .addComponent(htmlTipLabel))
                .addContainerGap());
        layout.setVerticalGroup(layout.createSequentialGroup()
                .addContainerGap().addComponent(scroll).addComponent(htmlTipLabel));

        customEditor = panel;
        textComp = textArea;
        htmlTipLabel.setVisible(htmlText);
    }

    textComp.setEditable(editable);
    setValueToCustomEditor();

    return customEditor;
}
 
Example 14
Source File: ScriptStringPayloadGeneratorAdapterUIHandler.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
public ScriptStringPayloadGeneratorAdapterUIPanel(List<ScriptWrapper> scriptWrappers) {
    scriptComboBox = new JComboBox<>(new SortedComboBoxModel<ScriptUIEntry>());
    for (ScriptWrapper scriptWrapper : scriptWrappers) {
        if (scriptWrapper.isEnabled()) {
            scriptComboBox.addItem(new PayloadGeneratorScriptUIEntry(scriptWrapper));
        }
    }
    scriptComboBox.addItemListener(
            new ItemListener() {

                @Override
                public void itemStateChanged(ItemEvent e) {
                    if (e.getStateChange() == ItemEvent.SELECTED) {
                        updatePreviewFor((PayloadGeneratorScriptUIEntry) e.getItem());
                    }
                }
            });
    setPreviewAndSaveButtonsEnabled(scriptComboBox.getSelectedIndex() >= 0);

    fieldsPanel = new JPanel();

    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    JLabel scriptLabel = new JLabel(SCRIPT_FIELD_LABEL);
    scriptLabel.setLabelFor(scriptComboBox);

    JLabel payloadsPreviewLabel = new JLabel(PAYLOADS_PREVIEW_FIELD_LABEL);
    payloadsPreviewLabel.setLabelFor(getPayloadsPreviewTextArea());

    JScrollPane payloadsPreviewScrollPane = new JScrollPane(getPayloadsPreviewTextArea());

    layout.setHorizontalGroup(
            layout.createSequentialGroup()
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                                    .addComponent(scriptLabel)
                                    .addComponent(payloadsPreviewLabel))
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                    .addComponent(scriptComboBox)
                                    .addGroup(
                                            layout.createSequentialGroup()
                                                    .addComponent(
                                                            getPayloadsPreviewGenerateButton())
                                                    .addComponent(getSaveButton()))
                                    .addComponent(payloadsPreviewScrollPane)));

    layout.setVerticalGroup(
            layout.createSequentialGroup()
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(scriptLabel)
                                    .addComponent(scriptComboBox))
                    .addGroup(
                            layout.createParallelGroup()
                                    .addComponent(getPayloadsPreviewGenerateButton())
                                    .addComponent(getSaveButton()))
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(payloadsPreviewLabel)
                                    .addComponent(payloadsPreviewScrollPane)));
}
 
Example 15
Source File: ModifyPayloadDialog.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
@Override
protected JPanel getFieldsPanel() {
    JPanel fieldsPanel = new JPanel();

    GroupLayout groupLayout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(groupLayout);
    groupLayout.setAutoCreateGaps(true);
    groupLayout.setAutoCreateContainerGaps(true);

    JLabel typeLabel = new JLabel(TYPE_LABEL);
    JLabel nameTypeLabel = new JLabel(nameType);

    contentPanel.getComponent().setVisible(true);

    groupLayout.setHorizontalGroup(
            groupLayout
                    .createParallelGroup()
                    .addGroup(
                            groupLayout
                                    .createSequentialGroup()
                                    .addGroup(
                                            groupLayout
                                                    .createParallelGroup(
                                                            GroupLayout.Alignment.TRAILING)
                                                    .addComponent(typeLabel))
                                    .addGroup(
                                            groupLayout
                                                    .createParallelGroup(
                                                            GroupLayout.Alignment.LEADING)
                                                    .addComponent(nameTypeLabel)))
                    .addComponent(contentPanel.getComponent()));

    groupLayout.setVerticalGroup(
            groupLayout
                    .createSequentialGroup()
                    .addGroup(
                            groupLayout
                                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(typeLabel)
                                    .addComponent(nameTypeLabel))
                    .addComponent(contentPanel.getComponent()));

    return fieldsPanel;
}
 
Example 16
Source File: AddProcessorDialog.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
@Override
protected JPanel getFieldsPanel() {
    JPanel fieldsPanel = new JPanel();

    GroupLayout groupLayout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(groupLayout);
    groupLayout.setAutoCreateGaps(true);
    groupLayout.setAutoCreateContainerGaps(true);

    JLabel typeLabel = new JLabel(TYPE_FIELD_LABEL);

    groupLayout.setHorizontalGroup(
            groupLayout
                    .createParallelGroup()
                    .addGroup(
                            groupLayout
                                    .createSequentialGroup()
                                    .addGroup(
                                            groupLayout
                                                    .createParallelGroup(
                                                            GroupLayout.Alignment.TRAILING)
                                                    .addComponent(typeLabel))
                                    .addGroup(
                                            groupLayout
                                                    .createParallelGroup(
                                                            GroupLayout.Alignment.LEADING)
                                                    .addComponent(
                                                            getPayloadUIHandlersComboBox())))
                    .addComponent(contentsPanel)
                    .addComponent(previewPanel.getPanel()));

    groupLayout.setVerticalGroup(
            groupLayout
                    .createSequentialGroup()
                    .addGroup(
                            groupLayout
                                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(typeLabel)
                                    .addComponent(getPayloadUIHandlersComboBox()))
                    .addComponent(contentsPanel)
                    .addComponent(previewPanel.getPanel()));

    return fieldsPanel;
}
 
Example 17
Source File: UserHttpFuzzerMessageProcessorUIHandler.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
public UserHttpFuzzerMessageProcessorUIPanel(
        ExtensionUserManagement extensionUserManagement) {
    this.extensionUserManagement = extensionUserManagement;

    contextsComboBox = new JComboBox<>();
    contextsComboBox.addItem(ContextUI.NO_CONTEXT);
    usersComboBox = new JComboBox<>(ContextUI.NO_CONTEXT);

    contextsComboBox.addItemListener(
            new ItemListener() {

                @Override
                public void itemStateChanged(ItemEvent e) {
                    if (ItemEvent.SELECTED == e.getStateChange()) {
                        usersComboBox.setModel((ContextUI) e.getItem());
                    }
                }
            });

    fieldsPanel = new JPanel();

    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    JLabel contextsLabel = new JLabel(CONTEXT_FIELD_LABEL);
    contextsLabel.setLabelFor(contextsComboBox);

    JLabel usersLabel = new JLabel(USER_FIELD_LABEL);
    usersLabel.setLabelFor(usersComboBox);

    layout.setHorizontalGroup(
            layout.createSequentialGroup()
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                                    .addComponent(contextsLabel)
                                    .addComponent(usersLabel))
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                    .addComponent(contextsComboBox)
                                    .addComponent(usersComboBox)));

    layout.setVerticalGroup(
            layout.createSequentialGroup()
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(contextsLabel)
                                    .addComponent(contextsComboBox))
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(usersLabel)
                                    .addComponent(usersComboBox)));
}
 
Example 18
Source File: RemotePrinterStatusRefresh.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private JPanel createInfoPanel() {
    JLabel javaLabel = new JLabel("Java version:");
    JTextField javaVersion =
            new JTextField(System.getProperty("java.runtime.version"));
    javaVersion.setEditable(false);
    javaLabel.setLabelFor(javaVersion);

    JLabel refreshTimeLabel = new JLabel("Refresh interval:");
    long minutes = refreshTime / 60;
    long seconds = refreshTime % 60;
    String interval = String.format("%1$d seconds%2$s",
            refreshTime,
            minutes > 0
                ? String.format(" (%1$d %2$s%3$s)",
                    minutes,
                    minutes > 1 ? "minutes" : "minute",
                    seconds > 0
                        ? String.format(" %1$d %2$s",
                            seconds,
                            seconds > 1 ? "seconds" : "second")
                        : "")
                : ""
    );
    JTextField refreshInterval = new JTextField(interval);
    refreshInterval.setEditable(false);
    refreshTimeLabel.setLabelFor(refreshInterval);

    JLabel nextRefreshLabel = new JLabel("Next printer refresh in:");
    nextRefresh = new JTextField();
    nextRefresh.setEditable(false);
    nextRefreshLabel.setLabelFor(nextRefresh);

    JLabel timeoutLabel = new JLabel("Time left:");
    timeLeft = new JTextField();
    timeLeft.setEditable(false);
    timeoutLabel.setLabelFor(timeLeft);

    JPanel infoPanel = new JPanel();
    GroupLayout layout = new GroupLayout(infoPanel);
    infoPanel.setLayout(layout);
    infoPanel.setBorder(BorderFactory.createTitledBorder("Info"));
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(
        layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(javaLabel)
                .addComponent(refreshTimeLabel)
                .addComponent(nextRefreshLabel)
                .addComponent(timeoutLabel)
            )
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, true)
                .addComponent(javaVersion)
                .addComponent(refreshInterval)
                .addComponent(nextRefresh)
                .addComponent(timeLeft)
            )
    );
    layout.setVerticalGroup(
        layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(javaLabel)
                .addComponent(javaVersion)
            )
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(refreshTimeLabel)
                .addComponent(refreshInterval))
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(nextRefreshLabel)
                .addComponent(nextRefresh))
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(timeoutLabel)
                .addComponent(timeLeft))
    );
    return infoPanel;
}
 
Example 19
Source File: AccountImportDialog.java    From jeveassets with GNU General Public License v2.0 4 votes vote down vote up
public JCardPanel() {
	cardLayout = new GroupLayout(this);
	setLayout(cardLayout);
	cardLayout.setAutoCreateGaps(true);
	cardLayout.setAutoCreateContainerGaps(false);
}
 
Example 20
Source File: DefaultStringPayloadGeneratorUIHandler.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
public DefaultStringPayloadGeneratorUIPanel() {
    fieldsPanel = new JPanel();

    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    JLabel contentsLabel = new JLabel(CONTENTS_FIELD_LABEL);
    contentsLabel.setLabelFor(getContentsTextArea());
    JLabel multilineLabel = new JLabel(MULTILINE_FIELD_LABEL);
    multilineLabel.setLabelFor(getMultilineCheckBox());
    multilineLabel.setToolTipText(MULTILINE_FIELD_TOOLTIP);

    JScrollPane contentsScrollPane = new JScrollPane(getContentsTextArea());

    layout.setHorizontalGroup(
            layout.createSequentialGroup()
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                                    .addComponent(contentsLabel)
                                    .addComponent(multilineLabel))
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                    .addComponent(contentsScrollPane)
                                    .addComponent(getMultilineCheckBox())
                                    .addComponent(getSaveButton())));

    layout.setVerticalGroup(
            layout.createSequentialGroup()
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(contentsLabel)
                                    .addComponent(contentsScrollPane))
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(multilineLabel)
                                    .addComponent(getMultilineCheckBox()))
                    .addComponent(getSaveButton()));

    getSaveButton().setEnabled(true);
}