下面列出了怎么用javax.swing.GroupLayout的API类实例代码及写法,或者点击链接到github查看源代码。
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()));
}
private void updatePanels() {
jFiltersPanel.removeAll();
GroupLayout groupLayout = new GroupLayout(jFiltersPanel);
jFiltersPanel.setLayout(groupLayout);
groupLayout.setAutoCreateGaps(true);
groupLayout.setAutoCreateContainerGaps(false);
ParallelGroup horizontalGroup = groupLayout.createParallelGroup();
SequentialGroup verticalGroup = groupLayout.createSequentialGroup();
for (LocationPanel locationPanel : locationPanels) {
horizontalGroup.addComponent(locationPanel.getPanel());
verticalGroup.addComponent(locationPanel.getPanel());
}
jFiltersPanel.setVisible(!locationPanels.isEmpty());
groupLayout.setHorizontalGroup(horizontalGroup);
groupLayout.setVerticalGroup(verticalGroup);
autoValidate();
this.getDialog().pack();
}
private void initComponents(JScrollPane tablePane, FindInQueryBar findBar) {
GroupLayout layout = new GroupLayout(component);
component.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(findBar, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(tablePane, GroupLayout.DEFAULT_SIZE, 549, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(tablePane, GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE)
.addGap(0, 0, 0)
.addComponent(findBar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
);
}
public FormLayoutHelper(JPanel panel, Column... columns) {
this.panel = panel;
layout = new GroupLayout(panel);
panel.setLayout(layout);
horizontalGroup = layout.createSequentialGroup();
verticalGroup = layout.createSequentialGroup();
this.columns = columns;
columnGroups = new Group[columns.length];
for (int i = 0; i < columns.length; i++) {
Group columnGroup = columns[i].createParallelGroup(layout);
columnGroups[i] = columnGroup;
horizontalGroup.addGroup(columnGroup);
}
layout.setHorizontalGroup(horizontalGroup);
layout.setVerticalGroup(verticalGroup);
}
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));
}
/**
* Create the frame.
*/
public Log() {
setBounds(100, 100, 319, 290);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JScrollPane scrollPane = new JScrollPane();
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE)
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
);
textArea = new JTextArea();
scrollPane.setViewportView(textArea);
textArea.setLineWrap(true);
contentPane.setLayout(gl_contentPane);
}
private GroupLayout.ParallelGroup getVerticalGroup (GroupLayout layout, boolean hasPrimary, boolean hasRequired) {
GroupLayout.ParallelGroup res = layout.createParallelGroup (/* XXX huh? GroupLayout.PREFERRED_SIZE*/);
GroupLayout.SequentialGroup seq = layout.createSequentialGroup ();
if (hasPrimary) {
seq.addComponent (tpPrimaryTitle, GroupLayout.DEFAULT_SIZE, 40, 40)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED)
.addComponent (tpPrimaryPlugins, GroupLayout.PREFERRED_SIZE, tpPrimaryPlugins.getPreferredSize ().height, GroupLayout.PREFERRED_SIZE)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED)
.addGap (0, 30, 30);
}
if (hasRequired) {
seq.addComponent (tpDependingTitle, GroupLayout.DEFAULT_SIZE, 80, 80)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED)
.addComponent (tpDependingPlugins, GroupLayout.PREFERRED_SIZE, tpDependingPlugins.getPreferredSize ().height, GroupLayout.PREFERRED_SIZE)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED);
}
res.addGroup (seq);
return res;
}
private void init() {
errorLabel.setText(" "); // NOI18N
GroupLayout containerPanelLayout = new GroupLayout(containerPanel);
containerPanel.setLayout(containerPanelLayout);
GroupLayout.ParallelGroup horizontalGroup = containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
GroupLayout.SequentialGroup verticalGroup = containerPanelLayout.createSequentialGroup();
containerPanelLayout.setHorizontalGroup(horizontalGroup);
containerPanelLayout.setVerticalGroup(
containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(verticalGroup)
);
for (CssPreprocessorUIImplementation.Options options : allOptions) {
JComponent component = options.getComponent();
Parameters.notNull("component", component); // NOI18N
horizontalGroup.addComponent(component, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
verticalGroup.addComponent(component, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
}
}
private void refresh() {
GroupLayout panelLayout = (GroupLayout) this.getLayout();
panelLayout.setHorizontalGroup(
panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 466, Short.MAX_VALUE)
);
panelLayout.setVerticalGroup(
panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 201, Short.MAX_VALUE)
);
jScrollPane1.setViewportView(panel);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE)
);
validate();
}
public JournalToolSettingsPanel(final Program program, final SettingsDialog settingsDialog) {
super(program, settingsDialog, DialoguesSettings.get().journal(), Images.TOOL_JOURNAL.getIcon());
jSaveHistory = new JCheckBox(DialoguesSettings.get().journalSaveHistory());
JLabelMultiline jSaveHistoryWarning = new JLabelMultiline(DialoguesSettings.get().saveHistoryWarning(), 2);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(jSaveHistory)
.addComponent(jSaveHistoryWarning, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Integer.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createSequentialGroup()
.addComponent(jSaveHistory, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jSaveHistoryWarning, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
);
}
BookPanel(final Book b)
{
setBorder(new EmptyBorder(3, 3, 3, 3));
setBackground(ColorScheme.DARK_GRAY_COLOR);
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
JLabel image = new JLabel();
b.getIcon().addTo(image);
JLabel name = new JLabel(b.getShortName());
location.setFont(FontManager.getRunescapeSmallFont());
layout.setVerticalGroup(layout.createParallelGroup()
.addComponent(image)
.addGroup(layout.createSequentialGroup()
.addComponent(name)
.addComponent(location)
)
);
layout.setHorizontalGroup(layout.createSequentialGroup()
.addComponent(image)
.addGap(8)
.addGroup(layout.createParallelGroup()
.addComponent(name)
.addComponent(location)
)
);
// AWT's Z order is weird. This put image at the back of the stack
setComponentZOrder(image, getComponentCount() - 1);
}
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();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
dummySelectorPanel = new javax.swing.JPanel();
javax.swing.GroupLayout dummySelectorPanelLayout = new javax.swing.GroupLayout(dummySelectorPanel);
dummySelectorPanel.setLayout(dummySelectorPanelLayout);
dummySelectorPanelLayout.setHorizontalGroup(
dummySelectorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
dummySelectorPanelLayout.setVerticalGroup(
dummySelectorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
errorLabel.setIcon(org.openide.util.ImageUtilities.loadImageIcon("/org/netbeans/modules/git/resources/icons/info.png", false)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(errorLabel, org.openide.util.NbBundle.getMessage(SelectTrackedBranchPanel.class, "SelectTrackedBranchPanel.errorLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(errorLabel)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(dummySelectorPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(dummySelectorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(errorLabel)
.addContainerGap())
);
}
public static void main(String[] args) throws Exception {
invokeAndWait(new Runnable() {
@Override
public void run() {
Integer[] items = {null, 1, 2, 3};
JComboBox<Integer> combo = new JComboBox<>(items);
JLabel label = new JLabel("choose:");
JPanel panel = new JPanel();
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
label.setLabelFor(combo);
combo.setSelectedIndex(0);
combo.setRenderer(new ListCellRenderer<Integer>() {
private final BasicComboBoxRenderer renderer = new BasicComboBoxRenderer();
@Override
public Component getListCellRendererComponent(JList<? extends Integer> list, Integer value, int index, boolean isSelected, boolean cellHasFocus) {
return this.renderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
}
});
layout.setAutoCreateContainerGaps(true);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup().addComponent(label))
.addGroup(layout.createParallelGroup().addComponent(combo)));
layout.setVerticalGroup(layout
.createSequentialGroup()
.addGroup(layout
.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(label)
.addComponent(combo)));
JFrame frame = new JFrame(getClass().getSimpleName());
frame.add(panel);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
});
}
WidthHeightPanel(boolean showWidth, boolean showHeight) {
ResourceBundle bundle = NbBundle.getBundle(BoxFillerInitializer.class);
JLabel widthLabel = new JLabel(bundle.getString("BoxFillerInitializer.width")); // NOI18N
JLabel heightLabel = new JLabel(bundle.getString("BoxFillerInitializer.height")); // NOI18N
widthField = new JSpinner(new SpinnerNumberModel());
heightField = new JSpinner(new SpinnerNumberModel());
GroupLayout layout = new GroupLayout(this);
setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(widthLabel)
.addComponent(heightLabel))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(widthField)
.addComponent(heightField))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(widthLabel)
.addComponent(widthField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(heightLabel)
.addComponent(heightField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
widthLabel.setVisible(showWidth);
heightLabel.setVisible(showHeight);
widthField.setVisible(showWidth);
heightField.setVisible(showHeight);
}
ChooseBeanPanel() {
JLabel nameLabel = new JLabel(NbBundle.getMessage(ChooseBeanInitializer.class, "MSG_Choose_Bean")); // NOI18N
nameField = new JTextField(25);
GroupLayout layout = new GroupLayout(this);
layout.setAutoCreateContainerGaps(true);
layout.setAutoCreateGaps(true);
setLayout(layout);
layout.setHorizontalGroup(layout.createSequentialGroup()
.addComponent(nameLabel).addComponent(nameField));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(nameLabel).addComponent(nameField));
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
scrollCategories = new JScrollPane();
listCategories = new JList<String>();
panelContent = new JPanel();
listCategories.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scrollCategories.setViewportView(listCategories);
panelContent.setLayout(new BorderLayout());
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(scrollCategories, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelContent, GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(scrollCategories, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
.addComponent(panelContent, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
}
@Override
protected JPanel getFieldsPanel() {
JPanel fieldsPanel = new JPanel();
GroupLayout layout = new GroupLayout(fieldsPanel);
fieldsPanel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(payloadsPanel));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(payloadsPanel));
return fieldsPanel;
}
public StockpileSelectionDialog(final Program program, String title) {
super(program, title);
ListenerClass listener = new ListenerClass();
jList = new JMultiSelectionList<T>();
jList.addListSelectionListener(listener);
JScrollPane jListScroll = new JScrollPane(jList);
jOK = new JButton(TabsStockpile.get().ok());
jOK.setActionCommand(StockpileSelection.OK.name());
jOK.addActionListener(listener);
jOK.setEnabled(false);
JButton jCancel = new JButton(TabsStockpile.get().cancel());
jCancel.setActionCommand(StockpileSelection.CANCEL.name());
jCancel.addActionListener(listener);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(jListScroll, 300, 300, 300)
.addGroup(layout.createSequentialGroup()
.addComponent(jOK, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
.addComponent(jCancel, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
)
);
layout.setVerticalGroup(
layout.createSequentialGroup()
.addComponent(jListScroll, 200, 200, 200)
.addGroup(layout.createParallelGroup()
.addComponent(jOK, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jCancel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
)
);
}
@Override
protected void addComponent(
JComponent component, Group parallelColumnGroup) {
parallelColumnGroup.addComponent(component,
GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE);
}
private void initComponents() {
this.jScrollPane1 = new JScrollPane();
this.jTextArea1 = new JTextArea();
this.jButton1 = new JButton();
this.jLabel1 = new JLabel();
setDefaultCloseOperation(2);
setTitle("调试窗口");
setResizable(false);
this.jTextArea1.setColumns(20);
this.jTextArea1.setLineWrap(true);
this.jTextArea1.setRows(5);
this.jScrollPane1.setViewportView(this.jTextArea1);
this.jButton1.setText("测试封包");
this.jButton1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
DebugWindow.this.jButton1ActionPerformed(evt);
}
});
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(this.jScrollPane1, -1, 446, 32767).addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(this.jLabel1, -1, -1, 32767).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.jButton1))).addContainerGap()));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(this.jScrollPane1, -1, 253, 32767).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false).addComponent(this.jButton1).addGroup(layout.createSequentialGroup().addGap(0, 0, 0).addComponent(this.jLabel1, -1, -1, 32767))).addContainerGap()));
pack();
}
public FilterSave(final Window window) {
super(null, GuiShared.get().saveFilter(), window);
ListenerClass listener = new ListenerClass();
JLabel jText = new JLabel(GuiShared.get().enterFilterName());
jName = new JComboBox<>();
filters = EventListManager.create();
AutoCompleteSupport.install(jName, EventModels.createSwingThreadProxyList(filters), new Filterator());
jSave = new JButton(GuiShared.get().save());
jSave.setActionCommand(FilterSaveAction.SAVE.name());
jSave.addActionListener(listener);
JButton jCancel = new JButton(GuiShared.get().cancel());
jCancel.setActionCommand(FilterSaveAction.CANCEL.name());
jCancel.addActionListener(listener);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(jText)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(jName, 220, 220, 220)
.addGroup(layout.createSequentialGroup()
.addComponent(jSave, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
.addComponent(jCancel, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
)
)
);
layout.setVerticalGroup(
layout.createSequentialGroup()
.addComponent(jText, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jName, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addGroup(layout.createParallelGroup()
.addComponent(jSave, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jCancel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
)
);
}
public HttpFuzzerHandlerOptionsPanel() {
optionsPanel = new JPanel();
followRedirectsCheckBox = new JCheckBox();
JLabel followRedirectsLabel =
new JLabel(
Constant.messages.getString(
"fuzz.httpfuzzer.options.label.followredirects"));
followRedirectsLabel.setLabelFor(followRedirectsCheckBox);
showRedirectMessagesCheckBox = new JCheckBox();
JLabel showRedirectMessagesLabel =
new JLabel(
Constant.messages.getString("fuzz.httpfuzzer.options.label.showredirects"));
showRedirectMessagesLabel.setLabelFor(showRedirectMessagesCheckBox);
GroupLayout layout = new GroupLayout(optionsPanel);
optionsPanel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(
layout.createSequentialGroup()
.addGroup(
layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(followRedirectsLabel))
.addGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(followRedirectsCheckBox)));
layout.setVerticalGroup(
layout.createSequentialGroup()
.addGroup(
layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(followRedirectsLabel)
.addComponent(followRedirectsCheckBox)));
}
public MyComboBox() {
jPanel = new JPanel();
GroupLayout layout = new GroupLayout(jPanel);
jPanel.setLayout(layout);
layout.setAutoCreateGaps(false);
layout.setAutoCreateContainerGaps(false);
jDefault = new JNullableLabel();
jDefault.setHorizontalAlignment(JLabel.CENTER);
jDefault.setVerticalAlignment(JLabel.CENTER);
jDefault.setOpaque(true);
jPickerIcon = new JLabel(Images.SETTINGS_COLOR_PICKER.getIcon());
jPickerIcon.setHorizontalTextPosition(JLabel.CENTER);
jPickerIcon.setHorizontalAlignment(JLabel.CENTER);
jPickerIcon.setVerticalAlignment(JLabel.CENTER);
jPickerIcon.setOpaque(true);
layout.setHorizontalGroup(
layout.createSequentialGroup()
.addComponent(jDefault, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Integer.MAX_VALUE)
.addComponent(jPickerIcon, 16, 16, 16)
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(jDefault, 0, 0, Integer.MAX_VALUE)
.addComponent(jPickerIcon, 0, 0, Integer.MAX_VALUE)
);
}
/**
* Creates a new {@code DependenciesPanel}.
*/
public DependenciesPanel() {
tableModel = new DependencyTableModel();
initComponents();
table.getSelectionModel().addListSelectionListener(new Listener());
TableCellRenderer versionColumnRenderer = new VersionColumnRenderer();
TableColumnModel tableColumnModel = table.getColumnModel();
tableColumnModel.getColumn(1).setCellRenderer(versionColumnRenderer);
tableColumnModel.getColumn(2).setCellRenderer(versionColumnRenderer);
tableColumnModel.getColumn(3).setCellRenderer(versionColumnRenderer);
GroupLayout layout = (GroupLayout)getLayout();
layout.setHonorsVisibility(dummyButton, false);
updateButtons();
}
/**
* Builds the layout of the rendered component.
*/
private void buildLayout() {
GroupLayout layout = new GroupLayout(renderer);
GroupLayout.Group hGroup = layout.createSequentialGroup()
.addComponent(selectorLabel, 1, 1, Short.MAX_VALUE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup()
.addComponent(matchedNodeLabel, 1, 1, Short.MAX_VALUE)
.addComponent(ruleLocationPanel, 1, 1, Short.MAX_VALUE)
);
GroupLayout.Group vGroup = layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(selectorLabel)
.addGroup(layout.createSequentialGroup()
.addComponent(matchedNodeLabel)
.addComponent(ruleLocationPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
))
.addGap(0, 0, Short.MAX_VALUE);
hGroup = layout.createParallelGroup()
.addComponent(mediaLabel, 1, 1, Short.MAX_VALUE)
.addGroup(hGroup);
vGroup = layout.createSequentialGroup()
.addComponent(mediaLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(vGroup);
layout.setHorizontalGroup(hGroup);
layout.setVerticalGroup(vGroup);
renderer.setLayout(layout);
Color borderColor = UIManager.getColor("Label.background"); // NOI18N
renderer.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(0, 0, 1, 0, borderColor),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
}
/**
* Initializes the "Run File" panel.
*/
private void initRunFilePanel() {
runFilePanel = new JPanel();
JLabel label = new JLabel(NbBundle.getMessage(CssStylesPanelProviderImpl.class, "CssStylesPanelProviderImpl.runFileLabel")); // NOI18N
label.setHorizontalAlignment(SwingConstants.CENTER);
runButton = new JButton();
runButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FileObject lastRelatedFileObject = getLastRelatedFileObject();
if (lastRelatedFileObject != null) {
ActionProvider provider = actionProviderForFileObject(lastRelatedFileObject);
if (provider != null) {
Lookup context = contextForFileObject(lastRelatedFileObject);
if (provider.isActionEnabled(ActionProvider.COMMAND_RUN_SINGLE, context)) {
provider.invokeAction(ActionProvider.COMMAND_RUN_SINGLE, context);
}
}
}
}
});
GroupLayout layout = new GroupLayout(runFilePanel);
runFilePanel.setLayout(layout);
layout.setVerticalGroup(layout.createSequentialGroup()
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(label)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(runButton)
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
layout.setHorizontalGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
.addComponent(label, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(runButton))
.addContainerGap());
}
/**
* This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
standardLabel = new JLabel();
standardComboBox = new JComboBox<>();
enabledCheckBox = new JCheckBox();
Mnemonics.setLocalizedText(standardLabel, NbBundle.getMessage(CodeSnifferCustomizerPanel.class, "CodeSnifferCustomizerPanel.standardLabel.text")); // NOI18N
Mnemonics.setLocalizedText(enabledCheckBox, NbBundle.getMessage(CodeSnifferCustomizerPanel.class, "CodeSnifferCustomizerPanel.enabledCheckBox.text")); // NOI18N
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(standardLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(standardComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addComponent(enabledCheckBox)
);
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(enabledCheckBox)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(standardLabel)
.addComponent(standardComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
);
}
/**
* This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form
* Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
providerLabel = new JLabel();
providerComboBox = new JComboBox<JsTestingProvider>();
separator = new JSeparator();
providerPanel = new JPanel();
providerLabel.setLabelFor(providerComboBox);
Mnemonics.setLocalizedText(providerLabel, NbBundle.getMessage(CustomizerJsTesting.class, "CustomizerJsTesting.providerLabel.text")); // NOI18N
providerPanel.setLayout(new BorderLayout());
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(providerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(providerLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(providerComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addComponent(separator)
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(providerLabel)
.addComponent(providerComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(separator, GroupLayout.PREFERRED_SIZE, 10, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(providerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}
private void switchHelper() {
JLabel temp = new JLabel();
GroupLayout layout = (GroupLayout)getLayout();
layout.replace(dummyCreateLabel, temp);
layout.replace(createNewButton, dummyCreateLabel);
layout.replace(temp, createNewButton);
if(attachLogFileButton != null) {
layout.replace(dummyAttachLabel, temp);
layout.replace(attachLogFileButton, dummyAttachLabel);
layout.replace(temp, attachLogFileButton);
}
}