下面列出了怎么用javax.swing.LayoutStyle的API类实例代码及写法,或者点击链接到github查看源代码。
protected Component createCustomEditorGUI(Component resourcePanelGUI) {
if (resourcePanelGUI == null)
return delegateEditor.getCustomEditor();
JPanel panel = new JPanel();
Component delComp = delegateEditor.getCustomEditor();
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup()
.addComponent(delComp)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(resourcePanelGUI)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)));
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(delComp).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(resourcePanelGUI));
return panel;
}
private static JPanel searchingPanel(JLabel progressLabel, JComponent progressComponent) {
JPanel panel = new JPanel();
progressLabel.setLabelFor(progressComponent);
javax.swing.GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(progressLabel, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(progressComponent, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(96, 96, 96)
.addComponent(progressLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(progressComponent, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addContainerGap(109, Short.MAX_VALUE))
);
return panel;
}
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);
}
}
@Override
protected Component createCustomEditorGUI(Component resourcePanelGUI) {
if (resourcePanelGUI == null && ResourceSupport.isResourceableProperty(property)) {
// not usable for full resourcing, only for internationalization
// add a NOI18N checkbox so the user can mark the property as not to be internationalized
Component customEd = delegateEditor.getCustomEditor();
JPanel panel = new JPanel();
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
noI18nCheckbox = new JCheckBox();
Mnemonics.setLocalizedText(noI18nCheckbox, NbBundle.getMessage(StringEditor.class, "CTL_NOI18NCheckBox")); // NOI18N
noI18nCheckbox.getAccessibleContext().setAccessibleDescription(
NbBundle.getBundle(
StringEditor.class).getString("ACD_NOI18NCheckBox")); //NOI18N
layout.setHorizontalGroup(layout.createParallelGroup()
.addComponent(customEd)
.addGroup(layout.createSequentialGroup()
.addContainerGap().addComponent(noI18nCheckbox).addContainerGap()));
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(customEd).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(noI18nCheckbox));
return panel;
}
else {
noI18nCheckbox = null;
return super.createCustomEditorGUI(resourcePanelGUI);
}
}
/**
* 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() {
tasksLabel = new JLabel();
tasksTextField = new JTextField();
tasksInfoLabel = new JLabel();
tasksLabel.setLabelFor(tasksTextField);
Mnemonics.setLocalizedText(tasksLabel, NbBundle.getMessage(GruntCustomizerPanel.class, "GruntCustomizerPanel.tasksLabel.text")); // NOI18N
Mnemonics.setLocalizedText(tasksInfoLabel, NbBundle.getMessage(GruntCustomizerPanel.class, "GruntCustomizerPanel.tasksInfoLabel.text")); // NOI18N
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(tasksLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(tasksInfoLabel)
.addComponent(tasksTextField)))
);
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(tasksLabel)
.addComponent(tasksTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tasksInfoLabel)
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}
/**
* Shows the search panel.
*/
@NbBundle.Messages({
"DependenciesPanel.editDialog.title=Edit npm package",
"DependenciesPanel.editDialog.update=Update",
"DependenciesPanel.editDialog.cancel=Cancel"
})
private void showEditDialog() {
EditPanel panel = new EditPanel();
int border = LayoutStyle.getInstance().getContainerGap(panel, SwingConstants.NORTH, null);
panel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border));
panel.setLibraryProvider(LibraryProvider.forProject(project));
int selectedRow = table.getSelectedRow();
Dependency dependency = dependencies.get(selectedRow);
panel.setDependency(dependency);
String update = Bundle.DependenciesPanel_editDialog_update();
String cancel = Bundle.DependenciesPanel_editDialog_cancel();
DialogDescriptor descriptor = new DialogDescriptor(
panel,
Bundle.DependenciesPanel_editDialog_title(),
true,
new Object[] { update, cancel},
update,
DialogDescriptor.DEFAULT_ALIGN,
HelpCtx.DEFAULT_HELP,
null
);
Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor);
dialog.setVisible(true);
if (update.equals(descriptor.getValue())) {
addLibrary(dependency.getName(), panel.getRequiredVersion(), panel.getInstalledVersion());
}
}
/**
* Shows the search panel.
*/
@NbBundle.Messages({
"DependenciesPanel.editDialog.title=Edit Bower package",
"DependenciesPanel.editDialog.update=Update",
"DependenciesPanel.editDialog.cancel=Cancel"
})
private void showEditDialog() {
EditPanel panel = new EditPanel();
int border = LayoutStyle.getInstance().getContainerGap(panel, SwingConstants.NORTH, null);
panel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border));
panel.setLibraryProvider(LibraryProvider.forProject(project));
int selectedRow = table.getSelectedRow();
Dependency dependency = dependencies.get(selectedRow);
panel.setDependency(dependency);
String update = Bundle.DependenciesPanel_editDialog_update();
String cancel = Bundle.DependenciesPanel_editDialog_cancel();
DialogDescriptor descriptor = new DialogDescriptor(
panel,
Bundle.DependenciesPanel_editDialog_title(),
true,
new Object[] { update, cancel},
update,
DialogDescriptor.DEFAULT_ALIGN,
HelpCtx.DEFAULT_HELP,
null
);
Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor);
dialog.setVisible(true);
if (update.equals(descriptor.getValue())) {
addLibrary(dependency.getName(), panel.getRequiredVersion(), panel.getInstalledVersion());
}
}
/**
* 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() {
providerLabel = new JLabel();
providerComboBox = new JComboBox<JsTestingProvider>();
providerLabel.setLabelFor(providerComboBox);
Mnemonics.setLocalizedText(providerLabel, NbBundle.getMessage(SelectProviderPanel.class, "SelectProviderPanel.providerLabel.text")); // NOI18N
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(providerLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(providerComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(providerLabel)
.addComponent(providerComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
);
}
/**
* 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))
);
}
/**
* 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() {
notActiveLabel = new JLabel();
providerPanel = new JPanel();
Mnemonics.setLocalizedText(notActiveLabel, NbBundle.getMessage(TestingProviderPanel.class, "TestingProviderPanel.notActiveLabel.text")); // NOI18N
providerPanel.setLayout(new BorderLayout());
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(providerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(notActiveLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, 0))
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(notActiveLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(providerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}
/**
* 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() {
namespaceLabel = new JLabel();
namespaceComboBox = new JComboBox<String>();
Mnemonics.setLocalizedText(namespaceLabel, NbBundle.getMessage(NewFileNamespacePanelVisual.class, "NewFileNamespacePanelVisual.namespaceLabel.text")); // NOI18N
namespaceComboBox.setEditable(true);
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(namespaceLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(namespaceComboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(namespaceLabel)
.addComponent(namespaceComboBox, 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() {
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<PhpDocumentationProvider>();
separator = new JSeparator();
providerPanel = new JPanel();
Mnemonics.setLocalizedText(providerLabel, NbBundle.getMessage(CustomizerDocumentation.class, "CustomizerDocumentation.providerLabel.text")); // NOI18N
providerPanel.setLayout(new BorderLayout());
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(separator)
.addGroup(layout.createSequentialGroup()
.addComponent(providerLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(providerComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addComponent(providerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
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))
);
}
/**
* 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() {
commandLabel = new JLabel();
generateComboBox = new JComboBox<Codecept.GenerateCommand>();
suiteLabel = new JLabel();
suitesComboBox = new JComboBox<String>();
commandLabel.setLabelFor(generateComboBox);
Mnemonics.setLocalizedText(commandLabel, NbBundle.getMessage(CodeceptionCreateTestPanel.class, "CodeceptionCreateTestPanel.commandLabel.text")); // NOI18N
suiteLabel.setLabelFor(suitesComboBox);
Mnemonics.setLocalizedText(suiteLabel, NbBundle.getMessage(CodeceptionCreateTestPanel.class, "CodeceptionCreateTestPanel.suiteLabel.text")); // NOI18N
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(commandLabel)
.addComponent(suiteLabel))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(generateComboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(suitesComboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, 0))
);
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(commandLabel)
.addComponent(generateComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(suiteLabel)
.addComponent(suitesComboBox, 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.
*/
// <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)))
);
}
private void createAttachment (AttachmentInfo newAttachment) {
AttachmentPanel attachment = new AttachmentPanel(nbCallback);
attachment.setBackground(UIUtils.getSectionPanelBackground());
horizontalGroup.addComponent(attachment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
verticalGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
verticalGroup.addComponent(attachment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
if (noneLabel.isVisible()) {
noneLabel.setVisible(false);
switchHelper();
updateButtonText(false);
}
attachment.addPropertyChangeListener(getDeletedListener());
if (newAttachment != null) {
attachment.setAttachment(newAttachment.getFile(), newAttachment.getDescription(),
newAttachment.getContentType(), newAttachment.isPatch());
}
if(nbCallback != null) {
File f = new File(Places.getUserDirectory(), nbCallback.getLogFilePath());
if(f.exists()) {
attachment.setAttachment(f, nbCallback.getLogFileDescription(), nbCallback.getLogFileContentType(), false); // NOI18N
}
attachment.browseButton.setEnabled(false);
attachment.fileField.setEnabled(false);
attachment.fileTypeCombo.setEnabled(false);
attachment.patchChoice.setEnabled(false);
} else {
attachment.viewButton.setVisible(false);
}
newAttachments.add(attachment);
UIUtils.keepFocusedComponentVisible(attachment, parentPanel);
revalidate();
attachment.addChangeListener(getChangeListener());
attachment.fileField.requestFocus();
if (nbCallback != null) {
supp.fireChange();
}
}
private Component makeVerticalStrut(JComponent compA,
JComponent compB,
LayoutStyle.ComponentPlacement relatedUnrelated) {
int height = LayoutStyle.getInstance().getPreferredGap(
compA,
compB,
relatedUnrelated,
SOUTH,
this);
return Box.createVerticalStrut(height);
}
private Component makeHorizontalStrut(JComponent compA,
JComponent compB,
LayoutStyle.ComponentPlacement relatedUnrelated) {
int width = LayoutStyle.getInstance().getPreferredGap(
compA,
compB,
relatedUnrelated,
WEST,
this);
return Box.createHorizontalStrut(width);
}
private static Component makeVerticalStrut(JComponent compA,
JComponent compB) {
LayoutStyle layoutStyle = LayoutStyle.getInstance();
return Box.createVerticalStrut(
layoutStyle.getPreferredGap(compA,
compB,
UNRELATED,
SOUTH,
compA.getParent()));
}
static Component makeVerticalStrut(JComponent compA,
JComponent compB,
ComponentPlacement relatedUnrelated,
JPanel parent) {
int height = LayoutStyle.getInstance().getPreferredGap(
compA,
compB,
relatedUnrelated,
SOUTH,
parent);
return Box.createVerticalStrut(height);
}
static Component makeHorizontalStrut(JComponent compA,
JComponent compB,
ComponentPlacement relatedUnrelated,
JPanel parent) {
int width = LayoutStyle.getInstance().getPreferredGap(
compA,
compB,
relatedUnrelated,
WEST,
parent);
return Box.createHorizontalStrut(width);
}
private void layoutHeaderPanel(JPanel headerPanel, JLabel iconLabel, JLabel leftLabel, JLabel commentLabel, JLabel rightLabel, LinkButton replyButton, LinkButton mailtoButton, JLabel stateLabel) {
GroupLayout layout = new GroupLayout(headerPanel);
headerPanel.setLayout(layout);
GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup()
.addComponent(iconLabel)
.addComponent(leftLabel);
if (stateLabel != null) {
hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(stateLabel);
}
hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(commentLabel,0, 0, Short.MAX_VALUE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rightLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(replyButton);
if (mailtoButton != null) {
hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(mailtoButton);
}
layout.setHorizontalGroup(hGroup);
GroupLayout.ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(iconLabel)
.addComponent(leftLabel);
if (stateLabel != null) {
vGroup.addComponent(stateLabel);
}
vGroup.addComponent(commentLabel)
.addComponent(rightLabel)
.addComponent(replyButton);
if (mailtoButton != null) {
vGroup.addComponent(mailtoButton);
}
layout.setVerticalGroup(vGroup);
}
/**
* 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() {
configureButton = new JButton();
mainTabbedPane = new JTabbedPane();
Mnemonics.setLocalizedText(configureButton, NbBundle.getMessage(CssPreprocessorsCustomizerPanel.class, "CssPreprocessorsCustomizerPanel.configureButton.text")); // NOI18N
configureButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
configureButtonActionPerformed(evt);
}
});
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(mainTabbedPane, GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(configureButton))
);
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(configureButton)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(mainTabbedPane, GroupLayout.DEFAULT_SIZE, 269, Short.MAX_VALUE))
);
}
private Component makeVerticalStrut(JComponent compA,
JComponent compB,
LayoutStyle.ComponentPlacement relatedUnrelated) {
int height = LayoutStyle.getInstance().getPreferredGap(
compA,
compB,
relatedUnrelated,
SOUTH,
this);
return Box.createVerticalStrut(height);
}
private Component makeHorizontalStrut(JComponent compA,
JComponent compB,
LayoutStyle.ComponentPlacement relatedUnrelated) {
int width = LayoutStyle.getInstance().getPreferredGap(
compA,
compB,
relatedUnrelated,
WEST,
this);
return Box.createHorizontalStrut(width);
}
public static JComponent addContainerBorder(JComponent comp) {
final LayoutStyle layoutStyle = LayoutStyle.getInstance();
JPanel panel = new JPanel();
panel.add(comp);
panel.setBorder(BorderFactory.createEmptyBorder(
layoutStyle.getContainerGap(comp, SwingConstants.NORTH, null),
layoutStyle.getContainerGap(comp, SwingConstants.WEST, null),
layoutStyle.getContainerGap(comp, SwingConstants.SOUTH, null),
layoutStyle.getContainerGap(comp, SwingConstants.EAST, null)));
return panel;
}
private JPanel createControllerPanel() {
JPanel controllerPanel = new JPanel();
JLabel pane = new JLabel();
pane.setText(NbBundle.getMessage(FakeJiraConnector.class, "MSG_NOT_YET_INSTALLED")); // NOI18N
JButton downloadButton = new JButton();
downloadButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JiraUpdater.getInstance().downloadAndInstall(null);
}
});
org.openide.awt.Mnemonics.setLocalizedText(downloadButton, org.openide.util.NbBundle.getMessage(FakeJiraConnector.class, "MissingJiraSupportPanel.downloadButton.text")); // NOI18N
GroupLayout layout = new GroupLayout(controllerPanel);
controllerPanel.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(pane, GroupLayout.PREFERRED_SIZE, 100, Short.MAX_VALUE))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(downloadButton))
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(pane)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(downloadButton))
.addContainerGap())
);
return controllerPanel;
}