下面列出了java.awt.GridBagConstraints#LINE_START 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static JComponent pair(JComponent l, JComponent r) {
JPanel pan = new JPanel(new GridBagLayout());
GridBagConstraints c2 = new GridBagConstraints();
c2.fill = GridBagConstraints.HORIZONTAL;
c2.anchor = GridBagConstraints.LINE_START;
c2.weightx = 1.0;
GridBagConstraints c1 = new GridBagConstraints();
c1.anchor = GridBagConstraints.WEST;
c1.fill = GridBagConstraints.NONE;
c1.weightx = 1.0;
// JPanel ppp = new JPanel(new GridLayout(1, 1));
// ppp.add(pan);
pan.add(l, c2);
pan.add(r, c1);
return pan;
}
/**
* Construct the panel components.
*/
private void constructContents() {
GridBagConstraints constraints = new GridBagConstraints(
0, 0, 1, 1, 1, 0,
GridBagConstraints.LINE_START, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 0), 0, 0);
// Text
String message = GT._T("The following links seem to be dead:");
labelMessage = new JLabel(message);
add(labelMessage, constraints);
constraints.gridy++;
// List of detections
DeadLinkListTableModel modelErrors =
new DeadLinkListTableModel(wiki, errors, textPane);
JTable tableErrors = new JTable(modelErrors);
modelErrors.configureColumnModel(tableErrors.getColumnModel());
JScrollPane scrollErrors = new JScrollPane(tableErrors);
scrollErrors.setMinimumSize(new Dimension(500, 100));
scrollErrors.setPreferredSize(new Dimension(800, 200));
scrollErrors.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
constraints.weighty = 1;
add(scrollErrors, constraints);
constraints.gridy++;
}
public DataObjectsPanel()
{
super();
showCollectionAccessorsOnly.addActionListener(this);
addButton.addActionListener(this);
showCollectionAccessorsOnly.setSelected(true);
addButton.setToolTipText("Add new data object");
setLayout(new GridBagLayout());
// add(new JLabel("Data Objects"),
this.add(instruction,
new GridBagConstraints(0, 0, 6, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 0, 0));
add(showCollectionAccessorsOnly,
new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE,
new Insets(5, 5, 5, 5), 0, 0));
add(addButton,
new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE,
new Insets(5, 5, 5, 5), 0, 0));
GridBagConstraints gbcScrollPane =
new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0);
// JPanel tablePanel = new JPanel();
// tablePanel.add(scrollPane);
// add(tablePanel, gbcScrollPane);
add(scrollPane, gbcScrollPane);
}
public CRUDMethodsPanelOld()
{
// GridBagConstraints(int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty
// , int anchor, int fill, Insets insets, int ipadx, int ipady)
// Insets(int top, int left, int bottom, int right)
setLayout(new GridBagLayout());
add(instruction,
new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
GridBagConstraints.NONE,
new Insets(5, 0, 0, 0), 0, 0));
GridBagConstraints gbcScrollPane =
new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0,
GridBagConstraints.LINE_START,
GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0);
add(scrollPane, gbcScrollPane);
}
private JPanel getSqlLitePanel() {
final JPanel panel = new JPanel(new GridBagLayout());
final GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 0;
constraints.anchor = GridBagConstraints.LINE_START;
constraints.insets = new Insets(5, 5, 5, 5);
constraints.weightx = 1.0;
constraints.fill = GridBagConstraints.HORIZONTAL;
final Border border = new TitledBorder(new BevelBorder(BevelBorder.RAISED),
Messages.getString("OptionWizard.30")); //$NON-NLS-1$
panel.setBorder(border);
panel.add(propertyToComponent.get(EarthProperty.AUTOMATIC_BACKUP)[0], constraints);
constraints.gridx++;
panel.add(getOpenBackupFolderButton());
return panel;
}
private void buildHeadersDialog()
{
headersDialog = JEWTDialog.createDialog(this, "Set Request Header Parameters", JEWTDialog.BUTTON_DEFAULT);
JPanel headersPanel = new JPanel();
headersDialog.setContent(headersPanel);
headersDialog.setPreferredSize(500, 300);
headersDialog.setResizable(true);
headersDialog.setModal(true);
headersDialog.setButtonMask((JEWTDialog.BUTTON_OK | JEWTDialog.BUTTON_CANCEL));
headersDialog.setDefaultButton(JEWTDialog.BUTTON_OK);
GridBagLayout containerLayout = new GridBagLayout();
headersPanel.setLayout(containerLayout);
headersPanel.add(addHeaderParamButton,
new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE,
new Insets(5, 0, 0, 0), 0, 0));
headersPanel.add(removeHeaderParamButton,
new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE,
new Insets(5, 5, 0, 0), 0, 0));
GridBagConstraints gbcScrollPane =
new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH,
new Insets(0, 0, 5, 0), 0, 0);
headersPanel.add(headerScrollPane, gbcScrollPane);
}
public CustomPayloadsOptionsPanel() {
this.tableModel = new CustomPayloadMultipleOptionsTableModel();
this.tablePanel = new CustomPayloadsMultipleOptionsTablePanel(tableModel);
this.setName(OPTIONS_TITLE);
this.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.LINE_START;
gbc.fill = GridBagConstraints.BOTH;
this.add(new JLabel(OPTIONS_TITLE), gbc);
gbc.weighty = 1.0;
this.add(tablePanel, gbc);
}
private JPanel initUISettingsSection() {
autoFormatOnBlur = new JCheckBox("Auto-format build files in editor (using buildifier)");
showDebug = new JCheckBox("Show debug in tool window");
JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(IdeBorderFactory.createTitledBorder("UI Settings", true));
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.LINE_START;
constraints.weightx = 1;
constraints.gridy = 0;
panel.add(autoFormatOnBlur, constraints);
constraints.gridy = 1;
panel.add(showDebug, constraints);
return panel;
}
public AttributesPanel()
{
super();
addButton.setToolTipText("Add a new attribute");
removeButton.setToolTipText("Remove selected attribute");
doilist.addActionListener(this);
setLayout(new GridBagLayout());
this.add(instruction,
new GridBagConstraints(0, 0, 6, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 0, 0));
this.add(doiLabel,
new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE,
new Insets(5, 0, 0, 0), 0, 0));
this.add(doilist,
new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE,
new Insets(5, 5, 0, 0), 0, 0));
this.add(addButton,
new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE,
new Insets(5, 5, 0, 0), 0, 0));
this.add(removeButton,
new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE,
new Insets(5, 5, 0, 0), 0, 0));
doilist.addActionListener(this);
addButton.addActionListener(this);
removeButton.addActionListener(this);
removeButton.setEnabled(false);
GridBagConstraints gbcScrollPane =
new GridBagConstraints(0, 2, 6, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH,
new Insets(5, 0, 5, 0), 0, 0);
add(scrollPane, gbcScrollPane);
buildNewAttributeDialog();
}
private GridBagConstraints constraintsForSecondColumn() {
GridBagConstraints gbc;
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 1;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(INNER_GAP, INDENT, 0, 0);
gbc.anchor = GridBagConstraints.LINE_START;
return gbc;
}
public JobAttributesPanel() {
super();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
setBorder(BorderFactory.createTitledBorder(strTitle));
c.fill = GridBagConstraints.NONE;
c.insets = compInsets;
c.weighty = 1.0;
cbJobSheets = createCheckBox("checkbox.jobsheets", this);
c.anchor = GridBagConstraints.LINE_START;
addToGB(cbJobSheets, this, gridbag, c);
JPanel pnlTop = new JPanel();
lblPriority = new JLabel(getMsg("label.priority"), JLabel.TRAILING);
lblPriority.setDisplayedMnemonic(getMnemonic("label.priority"));
pnlTop.add(lblPriority);
snModel = new SpinnerNumberModel(1, 1, 100, 1);
spinPriority = new JSpinner(snModel);
lblPriority.setLabelFor(spinPriority);
// REMIND
((JSpinner.NumberEditor)spinPriority.getEditor()).getTextField().setColumns(3);
spinPriority.addChangeListener(this);
pnlTop.add(spinPriority);
c.anchor = GridBagConstraints.LINE_END;
c.gridwidth = GridBagConstraints.REMAINDER;
pnlTop.getAccessibleContext().setAccessibleName(
getMsg("label.priority"));
addToGB(pnlTop, this, gridbag, c);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.CENTER;
c.weightx = 0.0;
c.gridwidth = 1;
char jmnemonic = getMnemonic("label.jobname");
lblJobName = new JLabel(getMsg("label.jobname"), JLabel.TRAILING);
lblJobName.setDisplayedMnemonic(jmnemonic);
addToGB(lblJobName, this, gridbag, c);
c.weightx = 1.0;
c.gridwidth = GridBagConstraints.REMAINDER;
tfJobName = new JTextField();
lblJobName.setLabelFor(tfJobName);
tfJobName.addFocusListener(this);
tfJobName.setFocusAccelerator(jmnemonic);
tfJobName.getAccessibleContext().setAccessibleName(
getMsg("label.jobname"));
addToGB(tfJobName, this, gridbag, c);
c.weightx = 0.0;
c.gridwidth = 1;
char umnemonic = getMnemonic("label.username");
lblUserName = new JLabel(getMsg("label.username"), JLabel.TRAILING);
lblUserName.setDisplayedMnemonic(umnemonic);
addToGB(lblUserName, this, gridbag, c);
c.gridwidth = GridBagConstraints.REMAINDER;
tfUserName = new JTextField();
lblUserName.setLabelFor(tfUserName);
tfUserName.addFocusListener(this);
tfUserName.setFocusAccelerator(umnemonic);
tfUserName.getAccessibleContext().setAccessibleName(
getMsg("label.username"));
addToGB(tfUserName, this, gridbag, c);
}
public JobAttributesPanel() {
super();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
setBorder(BorderFactory.createTitledBorder(strTitle));
c.fill = GridBagConstraints.NONE;
c.insets = compInsets;
c.weighty = 1.0;
cbJobSheets = createCheckBox("checkbox.jobsheets", this);
c.anchor = GridBagConstraints.LINE_START;
addToGB(cbJobSheets, this, gridbag, c);
JPanel pnlTop = new JPanel();
lblPriority = new JLabel(getMsg("label.priority"), JLabel.TRAILING);
lblPriority.setDisplayedMnemonic(getMnemonic("label.priority"));
pnlTop.add(lblPriority);
snModel = new SpinnerNumberModel(1, 1, 100, 1);
spinPriority = new JSpinner(snModel);
lblPriority.setLabelFor(spinPriority);
// REMIND
((JSpinner.NumberEditor)spinPriority.getEditor()).getTextField().setColumns(3);
spinPriority.addChangeListener(this);
pnlTop.add(spinPriority);
c.anchor = GridBagConstraints.LINE_END;
c.gridwidth = GridBagConstraints.REMAINDER;
pnlTop.getAccessibleContext().setAccessibleName(
getMsg("label.priority"));
addToGB(pnlTop, this, gridbag, c);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.CENTER;
c.weightx = 0.0;
c.gridwidth = 1;
char jmnemonic = getMnemonic("label.jobname");
lblJobName = new JLabel(getMsg("label.jobname"), JLabel.TRAILING);
lblJobName.setDisplayedMnemonic(jmnemonic);
addToGB(lblJobName, this, gridbag, c);
c.weightx = 1.0;
c.gridwidth = GridBagConstraints.REMAINDER;
tfJobName = new JTextField();
lblJobName.setLabelFor(tfJobName);
tfJobName.addFocusListener(this);
tfJobName.setFocusAccelerator(jmnemonic);
tfJobName.getAccessibleContext().setAccessibleName(
getMsg("label.jobname"));
addToGB(tfJobName, this, gridbag, c);
c.weightx = 0.0;
c.gridwidth = 1;
char umnemonic = getMnemonic("label.username");
lblUserName = new JLabel(getMsg("label.username"), JLabel.TRAILING);
lblUserName.setDisplayedMnemonic(umnemonic);
addToGB(lblUserName, this, gridbag, c);
c.gridwidth = GridBagConstraints.REMAINDER;
tfUserName = new JTextField();
lblUserName.setLabelFor(tfUserName);
tfUserName.addFocusListener(this);
tfUserName.setFocusAccelerator(umnemonic);
tfUserName.getAccessibleContext().setAccessibleName(
getMsg("label.username"));
addToGB(tfUserName, this, gridbag, c);
}
public JobAttributesPanel() {
super();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
setBorder(BorderFactory.createTitledBorder(strTitle));
c.fill = GridBagConstraints.NONE;
c.insets = compInsets;
c.weighty = 1.0;
cbJobSheets = createCheckBox("checkbox.jobsheets", this);
c.anchor = GridBagConstraints.LINE_START;
addToGB(cbJobSheets, this, gridbag, c);
JPanel pnlTop = new JPanel();
lblPriority = new JLabel(getMsg("label.priority"), JLabel.TRAILING);
lblPriority.setDisplayedMnemonic(getMnemonic("label.priority"));
pnlTop.add(lblPriority);
snModel = new SpinnerNumberModel(1, 1, 100, 1);
spinPriority = new JSpinner(snModel);
lblPriority.setLabelFor(spinPriority);
// REMIND
((JSpinner.NumberEditor)spinPriority.getEditor()).getTextField().setColumns(3);
spinPriority.addChangeListener(this);
pnlTop.add(spinPriority);
c.anchor = GridBagConstraints.LINE_END;
c.gridwidth = GridBagConstraints.REMAINDER;
pnlTop.getAccessibleContext().setAccessibleName(
getMsg("label.priority"));
addToGB(pnlTop, this, gridbag, c);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.CENTER;
c.weightx = 0.0;
c.gridwidth = 1;
char jmnemonic = getMnemonic("label.jobname");
lblJobName = new JLabel(getMsg("label.jobname"), JLabel.TRAILING);
lblJobName.setDisplayedMnemonic(jmnemonic);
addToGB(lblJobName, this, gridbag, c);
c.weightx = 1.0;
c.gridwidth = GridBagConstraints.REMAINDER;
tfJobName = new JTextField();
lblJobName.setLabelFor(tfJobName);
tfJobName.addFocusListener(this);
tfJobName.setFocusAccelerator(jmnemonic);
tfJobName.getAccessibleContext().setAccessibleName(
getMsg("label.jobname"));
addToGB(tfJobName, this, gridbag, c);
c.weightx = 0.0;
c.gridwidth = 1;
char umnemonic = getMnemonic("label.username");
lblUserName = new JLabel(getMsg("label.username"), JLabel.TRAILING);
lblUserName.setDisplayedMnemonic(umnemonic);
addToGB(lblUserName, this, gridbag, c);
c.gridwidth = GridBagConstraints.REMAINDER;
tfUserName = new JTextField();
lblUserName.setLabelFor(tfUserName);
tfUserName.addFocusListener(this);
tfUserName.setFocusAccelerator(umnemonic);
tfUserName.getAccessibleContext().setAccessibleName(
getMsg("label.username"));
addToGB(tfUserName, this, gridbag, c);
}
public JobAttributesPanel() {
super();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
setBorder(BorderFactory.createTitledBorder(strTitle));
c.fill = GridBagConstraints.NONE;
c.insets = compInsets;
c.weighty = 1.0;
cbJobSheets = createCheckBox("checkbox.jobsheets", this);
c.anchor = GridBagConstraints.LINE_START;
addToGB(cbJobSheets, this, gridbag, c);
JPanel pnlTop = new JPanel();
lblPriority = new JLabel(getMsg("label.priority"), JLabel.TRAILING);
lblPriority.setDisplayedMnemonic(getMnemonic("label.priority"));
pnlTop.add(lblPriority);
snModel = new SpinnerNumberModel(1, 1, 100, 1);
spinPriority = new JSpinner(snModel);
lblPriority.setLabelFor(spinPriority);
// REMIND
((JSpinner.NumberEditor)spinPriority.getEditor()).getTextField().setColumns(3);
spinPriority.addChangeListener(this);
pnlTop.add(spinPriority);
c.anchor = GridBagConstraints.LINE_END;
c.gridwidth = GridBagConstraints.REMAINDER;
pnlTop.getAccessibleContext().setAccessibleName(
getMsg("label.priority"));
addToGB(pnlTop, this, gridbag, c);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.CENTER;
c.weightx = 0.0;
c.gridwidth = 1;
char jmnemonic = getMnemonic("label.jobname");
lblJobName = new JLabel(getMsg("label.jobname"), JLabel.TRAILING);
lblJobName.setDisplayedMnemonic(jmnemonic);
addToGB(lblJobName, this, gridbag, c);
c.weightx = 1.0;
c.gridwidth = GridBagConstraints.REMAINDER;
tfJobName = new JTextField();
lblJobName.setLabelFor(tfJobName);
tfJobName.addFocusListener(this);
tfJobName.setFocusAccelerator(jmnemonic);
tfJobName.getAccessibleContext().setAccessibleName(
getMsg("label.jobname"));
addToGB(tfJobName, this, gridbag, c);
c.weightx = 0.0;
c.gridwidth = 1;
char umnemonic = getMnemonic("label.username");
lblUserName = new JLabel(getMsg("label.username"), JLabel.TRAILING);
lblUserName.setDisplayedMnemonic(umnemonic);
addToGB(lblUserName, this, gridbag, c);
c.gridwidth = GridBagConstraints.REMAINDER;
tfUserName = new JTextField();
lblUserName.setLabelFor(tfUserName);
tfUserName.addFocusListener(this);
tfUserName.setFocusAccelerator(umnemonic);
tfUserName.getAccessibleContext().setAccessibleName(
getMsg("label.username"));
addToGB(tfUserName, this, gridbag, c);
}
public JobAttributesPanel() {
super();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
setBorder(BorderFactory.createTitledBorder(strTitle));
c.fill = GridBagConstraints.NONE;
c.insets = compInsets;
c.weighty = 1.0;
cbJobSheets = createCheckBox("checkbox.jobsheets", this);
c.anchor = GridBagConstraints.LINE_START;
addToGB(cbJobSheets, this, gridbag, c);
JPanel pnlTop = new JPanel();
lblPriority = new JLabel(getMsg("label.priority"), JLabel.TRAILING);
lblPriority.setDisplayedMnemonic(getMnemonic("label.priority"));
pnlTop.add(lblPriority);
snModel = new SpinnerNumberModel(1, 1, 100, 1);
spinPriority = new JSpinner(snModel);
lblPriority.setLabelFor(spinPriority);
// REMIND
((JSpinner.NumberEditor)spinPriority.getEditor()).getTextField().setColumns(3);
spinPriority.addChangeListener(this);
pnlTop.add(spinPriority);
c.anchor = GridBagConstraints.LINE_END;
c.gridwidth = GridBagConstraints.REMAINDER;
pnlTop.getAccessibleContext().setAccessibleName(
getMsg("label.priority"));
addToGB(pnlTop, this, gridbag, c);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.CENTER;
c.weightx = 0.0;
c.gridwidth = 1;
char jmnemonic = getMnemonic("label.jobname");
lblJobName = new JLabel(getMsg("label.jobname"), JLabel.TRAILING);
lblJobName.setDisplayedMnemonic(jmnemonic);
addToGB(lblJobName, this, gridbag, c);
c.weightx = 1.0;
c.gridwidth = GridBagConstraints.REMAINDER;
tfJobName = new JTextField();
lblJobName.setLabelFor(tfJobName);
tfJobName.addFocusListener(this);
tfJobName.setFocusAccelerator(jmnemonic);
tfJobName.getAccessibleContext().setAccessibleName(
getMsg("label.jobname"));
addToGB(tfJobName, this, gridbag, c);
c.weightx = 0.0;
c.gridwidth = 1;
char umnemonic = getMnemonic("label.username");
lblUserName = new JLabel(getMsg("label.username"), JLabel.TRAILING);
lblUserName.setDisplayedMnemonic(umnemonic);
addToGB(lblUserName, this, gridbag, c);
c.gridwidth = GridBagConstraints.REMAINDER;
tfUserName = new JTextField();
lblUserName.setLabelFor(tfUserName);
tfUserName.addFocusListener(this);
tfUserName.setFocusAccelerator(umnemonic);
tfUserName.getAccessibleContext().setAccessibleName(
getMsg("label.username"));
addToGB(tfUserName, this, gridbag, c);
}
public JobAttributesPanel() {
super();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
setBorder(BorderFactory.createTitledBorder(strTitle));
c.fill = GridBagConstraints.NONE;
c.insets = compInsets;
c.weighty = 1.0;
cbJobSheets = createCheckBox("checkbox.jobsheets", this);
c.anchor = GridBagConstraints.LINE_START;
addToGB(cbJobSheets, this, gridbag, c);
JPanel pnlTop = new JPanel();
lblPriority = new JLabel(getMsg("label.priority"), JLabel.TRAILING);
lblPriority.setDisplayedMnemonic(getMnemonic("label.priority"));
pnlTop.add(lblPriority);
snModel = new SpinnerNumberModel(1, 1, 100, 1);
spinPriority = new JSpinner(snModel);
lblPriority.setLabelFor(spinPriority);
// REMIND
((JSpinner.NumberEditor)spinPriority.getEditor()).getTextField().setColumns(3);
spinPriority.addChangeListener(this);
pnlTop.add(spinPriority);
c.anchor = GridBagConstraints.LINE_END;
c.gridwidth = GridBagConstraints.REMAINDER;
pnlTop.getAccessibleContext().setAccessibleName(
getMsg("label.priority"));
addToGB(pnlTop, this, gridbag, c);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.CENTER;
c.weightx = 0.0;
c.gridwidth = 1;
char jmnemonic = getMnemonic("label.jobname");
lblJobName = new JLabel(getMsg("label.jobname"), JLabel.TRAILING);
lblJobName.setDisplayedMnemonic(jmnemonic);
addToGB(lblJobName, this, gridbag, c);
c.weightx = 1.0;
c.gridwidth = GridBagConstraints.REMAINDER;
tfJobName = new JTextField();
lblJobName.setLabelFor(tfJobName);
tfJobName.addFocusListener(this);
tfJobName.setFocusAccelerator(jmnemonic);
tfJobName.getAccessibleContext().setAccessibleName(
getMsg("label.jobname"));
addToGB(tfJobName, this, gridbag, c);
c.weightx = 0.0;
c.gridwidth = 1;
char umnemonic = getMnemonic("label.username");
lblUserName = new JLabel(getMsg("label.username"), JLabel.TRAILING);
lblUserName.setDisplayedMnemonic(umnemonic);
addToGB(lblUserName, this, gridbag, c);
c.gridwidth = GridBagConstraints.REMAINDER;
tfUserName = new JTextField();
lblUserName.setLabelFor(tfUserName);
tfUserName.addFocusListener(this);
tfUserName.setFocusAccelerator(umnemonic);
tfUserName.getAccessibleContext().setAccessibleName(
getMsg("label.username"));
addToGB(tfUserName, this, gridbag, c);
}
/**
* Construct panel contents.
*/
private void constructContents() {
GridBagConstraints constraints = new GridBagConstraints(
0, 0, 1, 1, 1, 0,
GridBagConstraints.LINE_START, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 0), 0, 0);
Configuration config = Configuration.getConfiguration();
// Dump file
String lastDumpFile = config.getString(wiki, ConfigurationValueString.LAST_DUMP_FILE);
txtDumpFile = Utilities.createJTextField(lastDumpFile, 40);
JLabel labelDumpFile = Utilities.createJLabel(GT._T("Dump file:"));
labelDumpFile.setLabelFor(txtDumpFile);
JButton buttonDumpFile = Utilities.createJButton(
"gnome-logviewer.png", EnumImageSize.SMALL,
GT._T("Dump file"), false, null);
buttonDumpFile.addActionListener(
EventHandler.create(ActionListener.class, this, "actionDumpFile"));
constraints.gridx = 0;
constraints.weightx = 0;
add(labelDumpFile, constraints);
constraints.gridx++;
constraints.weightx = 1;
add(txtDumpFile, constraints);
constraints.gridx++;
constraints.weightx = 0;
add(buttonDumpFile, constraints);
constraints.gridy++;
// Type of export
ButtonGroup groupExport = new ButtonGroup();
boolean exportOnWiki = config.getBoolean(wiki, ConfigurationValueBoolean.DUMP_ON_WIKI);
// Export directory
String lastExportDir = config.getString(wiki, ConfigurationValueString.LAST_EXPORT_DIRECTORY);
txtExportDir = Utilities.createJTextField(lastExportDir, 40);
radExportDir = Utilities.createJRadioButton(GT._T("Export directory:"), !exportOnWiki);
radExportDir.addItemListener(EventHandler.create(
ItemListener.class, this, "updateComponentState"));
groupExport.add(radExportDir);
buttonExportDir = Utilities.createJButton(
"gnome-folder.png", EnumImageSize.SMALL,
GT._T("Export directory"), false, null);
buttonExportDir.addActionListener(
EventHandler.create(ActionListener.class, this, "actionExportDir"));
constraints.gridx = 0;
constraints.weightx = 0;
add(radExportDir, constraints);
constraints.gridx++;
constraints.weightx = 1;
add(txtExportDir, constraints);
constraints.gridx++;
constraints.weightx = 0;
add(buttonExportDir, constraints);
constraints.gridy++;
// Export page
String lastExportPage = config.getString(wiki, ConfigurationValueString.LAST_EXPORT_PAGE);
txtExportPage = Utilities.createJTextField(lastExportPage, 40);
radExportPage = Utilities.createJRadioButton(GT._T("Export pages:"), exportOnWiki);
radExportPage.addItemListener(EventHandler.create(
ItemListener.class, this, "updateComponentState"));
groupExport.add(radExportPage);
constraints.gridx = 0;
constraints.weightx = 0;
add(radExportPage, constraints);
constraints.gridx++;
constraints.weightx = 1;
add(txtExportPage, constraints);
constraints.gridy++;
// Check wiki
boolean checkWiki = config.getBoolean(wiki, ConfigurationValueBoolean.DUMP_CHECK_WIKI);
chkCheckWiki = Utilities.createJCheckBox(
GT._T("Check last version of article before reporting an error"), checkWiki);
constraints.gridx = 0;
constraints.gridwidth = 3;
constraints.weightx = 1;
add(chkCheckWiki, constraints);
constraints.gridy++;
// Only check articles previously reported
chkOnlyRecheck = Utilities.createJCheckBox(
GT._T("Only check articles previously reported"), false);
constraints.gridx = 0;
constraints.gridwidth = 3;
constraints.weightx = 1;
add(chkOnlyRecheck, constraints);
constraints.gridy++;
updateComponentState();
}
@Override
public void defaultConstraints() {
c.anchor = GridBagConstraints.LINE_START;
c.fill = GridBagConstraints.HORIZONTAL;
c.insets.set( 2, 1, 2, 1 );
}
/**
* Builds the GUI of the rep info box.
*
* @param fileChooser file chooser whose selected file to listen
*/
private void buildGui( final XFileChooser fileChooser ) {
final Dimension mindim = new Dimension( 16, 16 );
final GridBagConstraints c = this.c;
c.insets.set( 1, 1, 0, 1 );
nextRow();
addDouble( RepUtils.createRepFoldersShortcutCombo( fileChooser ) );
nextRow();
addDouble( new JSeparator() );
nextRow();
addDouble( GuiUtils.boldFont( repInfoLabel ) );
nextRow();
addSingle( new XLabel( "Date:" ) );
c.weightx = 1; // Specify that the first column is compact and 2nd column gets the extra space
addSingle( dateLabel );
c.weightx = 0;
nextRow();
addSingle( new XLabel( "Version:" ) );
versionLabel.setPreferredSize( mindim );
versionLabel.setMaximumSize( mindim );
versionLabel.setMinimumSize( mindim );
addSingle( versionLabel );
nextRow();
addSingle( new XLabel( "Mode:" ) );
addSingle( modeLabel );
nextRow();
addSingle( new XLabel( "Length:" ) );
addSingle( lengthLabel );
nextRow();
addSingle( new XLabel( "Avg League:" ) );
avgLeagueLabel.setPreferredSize( mindim );
avgLeagueLabel.setMaximumSize( mindim );
avgLeagueLabel.setMinimumSize( mindim );
addSingle( avgLeagueLabel );
nextRow();
addSingle( new XLabel( "Matchup:" ) );
addSingle( matchupLabel );
nextRow();
addSingle( new XLabel( "Region:" ) );
addSingle( regionLabel );
nextRow();
c.anchor = GridBagConstraints.NORTHWEST;
addSingle( new XLabel( "Players:" ) );
addSingle( playersLabel );
c.anchor = GridBagConstraints.LINE_START;
nextRow();
addSingle( new XLabel( "Map:" ) );
addSingle( mapTitleLabel );
nextRow();
c.weighty = 1; // Remaining space for the map image
addDouble( mapImageLabel );
c.weighty = 0;
}
public JobAttributesPanel() {
super();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
setBorder(BorderFactory.createTitledBorder(strTitle));
c.fill = GridBagConstraints.NONE;
c.insets = compInsets;
c.weighty = 1.0;
cbJobSheets = createCheckBox("checkbox.jobsheets", this);
c.anchor = GridBagConstraints.LINE_START;
addToGB(cbJobSheets, this, gridbag, c);
JPanel pnlTop = new JPanel();
lblPriority = new JLabel(getMsg("label.priority"), JLabel.TRAILING);
lblPriority.setDisplayedMnemonic(getMnemonic("label.priority"));
pnlTop.add(lblPriority);
snModel = new SpinnerNumberModel(1, 1, 100, 1);
spinPriority = new JSpinner(snModel);
lblPriority.setLabelFor(spinPriority);
// REMIND
((JSpinner.NumberEditor)spinPriority.getEditor()).getTextField().setColumns(3);
spinPriority.addChangeListener(this);
pnlTop.add(spinPriority);
c.anchor = GridBagConstraints.LINE_END;
c.gridwidth = GridBagConstraints.REMAINDER;
pnlTop.getAccessibleContext().setAccessibleName(
getMsg("label.priority"));
addToGB(pnlTop, this, gridbag, c);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.CENTER;
c.weightx = 0.0;
c.gridwidth = 1;
char jmnemonic = getMnemonic("label.jobname");
lblJobName = new JLabel(getMsg("label.jobname"), JLabel.TRAILING);
lblJobName.setDisplayedMnemonic(jmnemonic);
addToGB(lblJobName, this, gridbag, c);
c.weightx = 1.0;
c.gridwidth = GridBagConstraints.REMAINDER;
tfJobName = new JTextField();
lblJobName.setLabelFor(tfJobName);
tfJobName.addFocusListener(this);
tfJobName.setFocusAccelerator(jmnemonic);
tfJobName.getAccessibleContext().setAccessibleName(
getMsg("label.jobname"));
addToGB(tfJobName, this, gridbag, c);
c.weightx = 0.0;
c.gridwidth = 1;
char umnemonic = getMnemonic("label.username");
lblUserName = new JLabel(getMsg("label.username"), JLabel.TRAILING);
lblUserName.setDisplayedMnemonic(umnemonic);
addToGB(lblUserName, this, gridbag, c);
c.gridwidth = GridBagConstraints.REMAINDER;
tfUserName = new JTextField();
lblUserName.setLabelFor(tfUserName);
tfUserName.addFocusListener(this);
tfUserName.setFocusAccelerator(umnemonic);
tfUserName.getAccessibleContext().setAccessibleName(
getMsg("label.username"));
addToGB(tfUserName, this, gridbag, c);
}