下面列出了javax.swing.GroupLayout#setHorizontalGroup ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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()));
}
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();
}
private static JPanel createLabelledPanel(JLabel label, JComponent component) {
JPanel panel = new JPanel();
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(label)
.addComponent(component));
layout.setVerticalGroup(
layout.createSequentialGroup().addComponent(label).addComponent(component));
return panel;
}
private void setMainPanel(PDialog dialog) {
curDialog = dialog;
Component display = curDialog.getWindow();
jPanel2.removeAll();
this.repaint();
// set new screen
GroupLayout layout = new GroupLayout(jPanel2);
jPanel2.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(display, 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)
.addComponent(display, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
);
}
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);
}
public ScriptStringPayloadProcessorAdapterUIPanel(List<ScriptWrapper> scriptWrappers) {
scriptComboBox = new JComboBox<>(new SortedComboBoxModel<ScriptUIEntry>());
for (ScriptWrapper scriptWrapper : scriptWrappers) {
if (scriptWrapper.isEnabled()) {
scriptComboBox.addItem(new ScriptUIEntry(scriptWrapper));
}
}
fieldsPanel = new JPanel();
GroupLayout layout = new GroupLayout(fieldsPanel);
fieldsPanel.setLayout(layout);
layout.setAutoCreateGaps(true);
JLabel scriptLabel = new JLabel(SCRIPT_FIELD_LABEL);
scriptLabel.setLabelFor(scriptComboBox);
layout.setHorizontalGroup(
layout.createSequentialGroup()
.addComponent(scriptLabel)
.addComponent(scriptComboBox));
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(scriptLabel)
.addComponent(scriptComboBox));
}
@Override
protected JPanel getFieldsPanel() {
JPanel fieldsPanel = new JPanel();
GroupLayout layout = new GroupLayout(fieldsPanel);
fieldsPanel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);
JLabel nameLabel = new JLabel(NAME_FIELD_LABEL);
JLabel scriptsLabel = new JLabel(SCRIPTS_FIELD_LABEL);
layout.setHorizontalGroup(
layout.createSequentialGroup()
.addGroup(
layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(nameLabel)
.addComponent(scriptsLabel))
.addGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(getNameTextField())
.addComponent(getProcessorComboboxField())));
layout.setVerticalGroup(
layout.createSequentialGroup()
.addGroup(
layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(nameLabel)
.addComponent(getNameTextField()))
.addGroup(
layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(scriptsLabel)
.addComponent(getProcessorComboboxField())));
return fieldsPanel;
}
public HttpMessageSelectorPanel() {
panel = new JPanel();
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateGaps(true);
SiteNode root =
new SiteNode(
null,
-1,
Constant.messages.getString(
"fuzz.httpfuzzer.select.message.dialogue.rootNode"));
SiteNode mainTreeRoot = Model.getSingleton().getSession().getSiteTree().getRoot();
copyTree(mainTreeRoot, root);
messagesTreeModel = new DefaultTreeModel(root);
messagesTree = new JTree(messagesTreeModel);
messagesTree.setVisibleRowCount(10);
messagesTree.setShowsRootHandles(true);
messagesTree.setName("HttpMessageSelectorTree");
messagesTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
messagesTree.setCellRenderer(
new SiteMapTreeCellRenderer(Collections.<SiteMapListener>emptyList()));
messagesTree.expandRow(0);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(messagesTree);
layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(scrollPane));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(scrollPane));
}
public JLockWindow(final Window parent) {
this.parent = parent;
jWindow = new JWindow(parent);
jProgress = new JProgressBar(0, 100);
JPanel jPanel = new JPanel();
jPanel.setBorder(BorderFactory.createRaisedBevelBorder());
GroupLayout layout = new GroupLayout(jPanel);
jPanel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);
jWindow.add(jPanel);
jLabel = new JLabel();
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.CENTER)
.addComponent(jLabel)
.addComponent(jProgress)
);
layout.setVerticalGroup(
layout.createSequentialGroup()
.addComponent(jLabel)
.addComponent(jProgress)
);
}
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));
}
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;
}
/**
* 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() {
runOnNodeJsLabel = new JLabel();
startFileLabel = new JLabel();
startFileTextField = new JTextField();
startFileBrowseButton = new JButton();
argsLabel = new JLabel();
argsTextField = new JTextField();
restartCheckBox = new JCheckBox();
Mnemonics.setLocalizedText(runOnNodeJsLabel, NbBundle.getMessage(NodeJsRunPanel.class, "NodeJsRunPanel.runOnNodeJsLabel.text")); // NOI18N
startFileLabel.setLabelFor(startFileTextField);
Mnemonics.setLocalizedText(startFileLabel, NbBundle.getMessage(NodeJsRunPanel.class, "NodeJsRunPanel.startFileLabel.text")); // NOI18N
Mnemonics.setLocalizedText(startFileBrowseButton, NbBundle.getMessage(NodeJsRunPanel.class, "NodeJsRunPanel.startFileBrowseButton.text")); // NOI18N
startFileBrowseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
startFileBrowseButtonActionPerformed(evt);
}
});
argsLabel.setLabelFor(argsTextField);
Mnemonics.setLocalizedText(argsLabel, NbBundle.getMessage(NodeJsRunPanel.class, "NodeJsRunPanel.argsLabel.text")); // NOI18N
Mnemonics.setLocalizedText(restartCheckBox, NbBundle.getMessage(NodeJsRunPanel.class, "NodeJsRunPanel.restartCheckBox.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(argsLabel)
.addComponent(startFileLabel))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(startFileTextField)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(startFileBrowseButton))
.addComponent(argsTextField)))
.addComponent(runOnNodeJsLabel)
.addComponent(restartCheckBox)
);
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(runOnNodeJsLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(startFileTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(startFileBrowseButton)
.addComponent(startFileLabel))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(argsLabel)
.addComponent(argsTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(restartCheckBox))
);
}
private void initComponents() {
JLabel keyLabel = new JLabel();
JLabel valueLabel = new JLabel();
JLabel commentLabel = new JLabel();
keyText = new JTextField(25);
valueText = new JTextField(25);
commentText = new JTextField(25);
keyLabel.setLabelFor(keyText);
valueLabel.setLabelFor(valueText);
commentLabel.setLabelFor(commentText);
Mnemonics.setLocalizedText(keyLabel, NbBundle.getMessage(getClass(), "LBL_KeyLabel")); // NOI18N
Mnemonics.setLocalizedText(valueLabel, NbBundle.getMessage(getClass(), "LBL_ValueLabel")); // NOI18N
Mnemonics.setLocalizedText(commentLabel, NbBundle.getMessage(getClass(), "LBL_CommentLabel")); // NOI18N
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(LEADING)
.addComponent(keyLabel)
.addComponent(valueLabel)
.addComponent(commentLabel))
.addPreferredGap(RELATED)
.addGroup(layout.createParallelGroup(LEADING)
.addComponent(keyText, DEFAULT_SIZE, PREFERRED_SIZE, Short.MAX_VALUE)
.addComponent(valueText, DEFAULT_SIZE, PREFERRED_SIZE, Short.MAX_VALUE)
.addComponent(commentText, DEFAULT_SIZE, PREFERRED_SIZE, Short.MAX_VALUE))
.addContainerGap()
);
layout.setVerticalGroup(
layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(BASELINE)
.addComponent(keyLabel)
.addComponent(keyText, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
.addPreferredGap(RELATED)
.addGroup(layout.createParallelGroup(BASELINE)
.addComponent(valueText, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
.addComponent(valueLabel))
.addPreferredGap(RELATED)
.addGroup(layout.createParallelGroup(BASELINE)
.addComponent(commentText, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
.addComponent(commentLabel))
.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() {
connectionNameLabel = new JLabel();
connectionNameTextField = new JTextField();
connectionTypeLabel = new JLabel();
connectionTypeComboBox = new JComboBox<String>();
connectionNameLabel.setLabelFor(connectionNameTextField);
Mnemonics.setLocalizedText(connectionNameLabel, NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionNameLabel.text")); // NOI18N
connectionNameTextField.setText(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionNameTextField.text")); // NOI18N
connectionTypeLabel.setLabelFor(connectionTypeComboBox);
Mnemonics.setLocalizedText(connectionTypeLabel, NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionTypeLabel.text")); // NOI18N
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(connectionNameLabel)
.addComponent(connectionTypeLabel))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(Alignment.TRAILING)
.addComponent(connectionTypeComboBox, 0, 221, Short.MAX_VALUE)
.addComponent(connectionNameTextField, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(connectionNameLabel)
.addComponent(connectionNameTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(connectionTypeLabel)
.addComponent(connectionTypeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
connectionNameLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionNameLabel.AccessibleContext.accessibleName")); // NOI18N
connectionNameLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionNameLabel.AccessibleContext.accessibleDescription")); // NOI18N
connectionNameTextField.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionNameTextField.AccessibleContext.accessibleName")); // NOI18N
connectionNameTextField.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionNameTextField.AccessibleContext.accessibleDescription")); // NOI18N
connectionTypeLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionTypeLabel.AccessibleContext.accessibleName")); // NOI18N
connectionTypeLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionTypeLabel.AccessibleContext.accessibleDescription")); // NOI18N
connectionTypeComboBox.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionTypeComboBox.AccessibleContext.accessibleName")); // NOI18N
connectionTypeComboBox.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.connectionTypeComboBox.AccessibleContext.accessibleDescription")); // NOI18N
getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.AccessibleContext.accessibleName")); // NOI18N
getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewRemoteConnectionPanel.class, "NewRemoteConnectionPanel.AccessibleContext.accessibleDescription")); // NOI18N
}
/** @return The referenced main data files panel. */
JPanel createReferencesPanel() {
JPanel p = new JPanel();
GroupLayout gl = new GroupLayout(p);
p.setLayout(gl);
gl.setAutoCreateContainerGaps(true);
gl.setAutoCreateGaps(true);
SequentialGroup rows = gl.createSequentialGroup();
ParallelGroup col1 = gl.createParallelGroup();
ParallelGroup col2 = gl.createParallelGroup();
ParallelGroup col3 = gl.createParallelGroup();
for (String a : ELEMENT_NAMES) {
JLabel indicator = new JLabel();
JLabel caption = new JLabel(get("definition.ref_" + a));
JTextField textField = new JTextField();
indicators.put(a, indicator);
fields.put(a, textField);
ParallelGroup pg = gl.createParallelGroup(Alignment.BASELINE);
col1.addComponent(caption);
col2.addComponent(textField);
col3.addComponent(indicator, 20, 20, 20);
pg.addComponent(caption);
pg.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE);
pg.addComponent(indicator, 20, 20, 20);
rows.addGroup(pg);
}
gl.setHorizontalGroup(
gl.createSequentialGroup()
.addGroup(col1)
.addGroup(col2)
.addGroup(col3)
);
gl.setVerticalGroup(rows);
return p;
}
@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;
}
/**
* @return the properties listing panel
*/
JPanel createPropertiesPanel() {
JPanel p = new JPanel();
GroupLayout gl = new GroupLayout(p);
p.setLayout(gl);
gl.setAutoCreateContainerGaps(true);
gl.setAutoCreateGaps(true);
SequentialGroup rows = gl.createSequentialGroup();
ParallelGroup col1 = gl.createParallelGroup();
ParallelGroup col2 = gl.createParallelGroup();
ParallelGroup col3 = gl.createParallelGroup();
for (String a : PARAM_NAMES) {
JLabel indicator = new JLabel();
JLabel caption = new JLabel(get("definition.refprop_" + a));
JTextField textField = new JTextField(10);
textField.setHorizontalAlignment(JTextField.RIGHT);
caption.setToolTipText(get("definition.refprop_" + a + ".tip"));
textField.setToolTipText(get("definition.refprop_" + a + ".tip"));
indicators.put(a, indicator);
fields.put(a, textField);
ParallelGroup pg = gl.createParallelGroup(Alignment.BASELINE);
col1.addComponent(caption);
col2.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE);
col3.addComponent(indicator, 20, 20, 20);
pg.addComponent(caption);
pg.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE);
pg.addComponent(indicator, 20, 20, 20);
rows.addGroup(pg);
}
gl.setHorizontalGroup(
gl.createSequentialGroup()
.addGroup(col1)
.addGroup(col2)
.addGroup(col3)
);
gl.setVerticalGroup(rows);
return p;
}
private void generate(boolean sizeChangable) {
nameField = new JTextField();
descriptionField = new JTextArea(5, 40);
descriptionField.setLineWrap(true);
descriptionField.setWrapStyleWord(true);
width = new SpinnerNumberModel(DEFAULT_MAPSIZE, MIN_MAPSIZE,
MAX_MAPSIZE, 1);
height = new SpinnerNumberModel(DEFAULT_MAPSIZE, MIN_MAPSIZE,
MAX_MAPSIZE, 1);
minPlayer = new SpinnerNumberModel(1, 1, CommonConstants.MAX_PLAYERS, 1);
maxPlayer = new SpinnerNumberModel(1, 1, CommonConstants.MAX_PLAYERS, 1);
JSpinner widthField = new JSpinner(width);
JSpinner heightField = new JSpinner(height);
JSpinner minPlayerField = new JSpinner(minPlayer);
JSpinner maxPlayerField = new JSpinner(maxPlayer);
JLabel nameLabel = new JLabel(EditorLabels.getLabel("header.map-name"));
JLabel descriptionLabel = new JLabel(EditorLabels.getLabel("header.map-description"));
JLabel widthLabel = new JLabel(EditorLabels.getLabel("header.width"));
JLabel heightLabel = new JLabel(EditorLabels.getLabel("header.height"));
JLabel minPlayerLabel = new JLabel(EditorLabels.getLabel("header.map-min-player"));
JLabel maxPlayerLabel = new JLabel(EditorLabels.getLabel("header.map-max-player"));
add(nameField);
add(descriptionField);
add(heightField);
add(widthField);
add(minPlayerField);
add(maxPlayerField);
add(nameLabel);
add(descriptionLabel);
add(widthLabel);
add(heightLabel);
add(maxPlayerLabel);
add(minPlayerLabel);
GroupLayout layout = new GroupLayout(this);
setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);
// @formatter:off
layout.setHorizontalGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup()
.addComponent(nameLabel)
.addComponent(descriptionLabel)
.addComponent(heightLabel)
.addComponent(widthLabel)
.addComponent(maxPlayerLabel)
.addComponent(minPlayerLabel))
.addGroup(layout.createParallelGroup()
.addComponent(nameField)
.addComponent(descriptionField)
.addComponent(heightField)
.addComponent(widthField)
.addComponent(maxPlayerField)
.addComponent(minPlayerField)));
layout.setVerticalGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup()
.addComponent(nameLabel)
.addComponent(nameField))
.addGroup(layout.createParallelGroup()
.addComponent(descriptionLabel)
.addComponent(descriptionField))
.addGroup(layout.createParallelGroup()
.addComponent(widthLabel)
.addComponent(widthField))
.addGroup(layout.createParallelGroup()
.addComponent(heightLabel)
.addComponent(heightField))
.addGroup(layout.createParallelGroup()
.addComponent(minPlayerLabel)
.addComponent(minPlayerField))
.addGroup(layout.createParallelGroup()
.addComponent(maxPlayerLabel)
.addComponent(maxPlayerField)));
// @formatter:on
if (!sizeChangable) {
widthField.setEnabled(false);
heightField.setEnabled(false);
}
}
private JComponent createProgressComponent() {
progressLabel = new JLabel(getDisplayName());
progressBar = super.getProgressComponent();
stopButton = new JButton(NbBundle.getMessage(WizardStepProgressSupport.class, "BK2022")); // NOI18N
stopButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
cancel();
}
});
JPanel panel = new JPanel();
GroupLayout layout = new GroupLayout(panel);
progressLine = new JPanel();
progressLine.add(progressBar);
progressLine.add(Box.createHorizontalStrut(
LayoutStyle.getInstance()
.getPreferredGap(progressBar,
stopButton,
RELATED,
SwingConstants.EAST,
progressLine)));
progressLine.add(stopButton);
progressLine.setLayout(new BoxLayout(progressLine, BoxLayout.X_AXIS));
progressBar.setAlignmentX(JComponent.CENTER_ALIGNMENT);
stopButton.setAlignmentX(JComponent.CENTER_ALIGNMENT);
layout.setHorizontalGroup(
layout.createParallelGroup(LEADING)
.addComponent(progressLabel)
.addComponent(progressLine));
layout.setVerticalGroup(
layout.createSequentialGroup()
.addComponent(progressLabel)
.addPreferredGap(RELATED)
.addComponent(progressLine));
panel.setLayout(layout);
layout.setHonorsVisibility(false); //hiding should not affect prefsize
progressLabel.setVisible(false);
progressLine.setVisible(false);
return panel;
}
/**
* 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() {
containerPanel = new JPanel();
jPanel1 = new JPanel();
jPanel2 = new JPanel();
errorLabel = new JLabel();
GroupLayout jPanel1Layout = new GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
GroupLayout jPanel2Layout = new GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
GroupLayout containerPanelLayout = new GroupLayout(containerPanel);
containerPanel.setLayout(containerPanelLayout);
containerPanelLayout.setHorizontalGroup(containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
containerPanelLayout.setVerticalGroup(containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(containerPanelLayout.createSequentialGroup()
.addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addGap(0, 166, Short.MAX_VALUE))
);
Mnemonics.setLocalizedText(errorLabel, "ERROR"); // NOI18N
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(errorLabel)
.addGap(0, 380, Short.MAX_VALUE))
.addComponent(containerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(containerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(errorLabel))
);
}