下面列出了java.awt.GridBagConstraints#FIRST_LINE_START 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private JPanel initUpperPanel() {
JPanel panel = new JPanel(new GridBagLayout());
panel.setOpaque(false);
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.weightx = 0.5;
c.anchor = GridBagConstraints.FIRST_LINE_START;
c.fill = GridBagConstraints.HORIZONTAL;
panel.add(initBrowseTermsPanel(), c);
c.gridx = 1;
c.gridy = 0;
c.weightx = 0.5;
c.anchor = GridBagConstraints.FIRST_LINE_START;
c.fill = GridBagConstraints.HORIZONTAL;
panel.add(initBrowseDocsByTermPanel(), c);
return panel;
}
private void init() {
final GridBagConstraints constraints = new GridBagConstraints();
constraints.anchor = GridBagConstraints.FIRST_LINE_START;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.weightx = 1;
constraints.weighty = 1;
JPanel container = new JPanel(new GridBagLayout());
container.setLayout(new GridBagLayout());
constraints.gridy = 0;
container.add(initUISettingsSection(), constraints);
constraints.gridy = 1;
container.add(initExecutablesSection(), constraints);
constraints.gridy = 2;
container.add(initInstallSettingsSection(), constraints);
constraints.gridy = 3;
container.add(initBuckCellSection(), constraints);
this.setLayout(new BorderLayout());
this.add(container, BorderLayout.NORTH);
}
/**
* Initializes the node chooser panels
*/
private void init() {
nodesPanel = new JPanel();
chooserPanel = new JPanel();
this.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.FIRST_LINE_START;
nodesPanel.setLayout(new BoxLayout(nodesPanel,BoxLayout.Y_AXIS));
nodesPanel.setBorder(BorderFactory.createTitledBorder(getBorder(),
"Nodes"));
if (shownNodes.size() > MAX_NODE_COUNT) {
String[] groupNames = new String[(shownNodes.size()-1)
/ MAX_NODE_COUNT+1];
int last = 0;
for (int i=0, n=shownNodes.size();
i <= (n-1) / MAX_NODE_COUNT; i++) {
int next = MAX_NODE_COUNT * (i+1) - 1;
if (next > n) {
next = n-1;
}
groupNames[i] = (last + "..." + next);
last = next + 1;
}
groupChooser = new JComboBox<String>(groupNames);
groupChooser.addActionListener(this);
chooserPanel.add(groupChooser);
}
setNodes(0);
c.gridy = 0;
this.add(chooserPanel, c);
c.gridy = 1;
this.add(nodesPanel, c);
}
/**
* Creates a new color settings panel.
*
* @param descriptions Descriptions to be configured..
*/
public COptionsPanel(final List<ITypeDescription> descriptions) {
super(new BorderLayout());
Preconditions.checkNotNull(descriptions, "IE00667: Descriptions argument can not be null");
final JPanel mainPanel = new JPanel(new BorderLayout());
final JPanel innerMainPanel = new JPanel(new GridBagLayout());
final JPanel functionTypeColorPanel = new JPanel(new GridLayout(descriptions.size(), 1, 3, 3));
for (final ITypeDescription description : descriptions) {
final ColorPanel colorPanel = new ColorPanel(description.getColor(), true, true);
final InternalColorPanelListener listener = new InternalColorPanelListener(description);
colorPanel.addListener(listener);
m_listenerMap.put(colorPanel, listener);
buildRow(functionTypeColorPanel, description, description.getHint(), colorPanel, false);
}
functionTypeColorPanel.setBorder(new TitledBorder("Colors"));
final GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 0;
constraints.anchor = GridBagConstraints.FIRST_LINE_START;
constraints.weightx = 1;
constraints.fill = GridBagConstraints.HORIZONTAL;
innerMainPanel.add(functionTypeColorPanel, constraints);
mainPanel.add(innerMainPanel, BorderLayout.NORTH);
add(new JScrollPane(mainPanel));
}
public SizeEditor(){
GridBagLayout gridLayout = new GridBagLayout();
editorPane = new JPanel(gridLayout);
GridBagConstraints c = new GridBagConstraints();
perc = new JRadioButton("Percentage");
px = new JRadioButton("Pixel");
fill = new JRadioButton("*");
fill.setToolTipText("Wildcard, leave this value to layoutmanger");
fill.addActionListener(this);
px.addActionListener(this);
perc.addActionListener(this);
group = new ButtonGroup();
group.add(perc);
group.add(px);
group.add(fill);
px.setSelected(true);
c.gridx = 0;
c.anchor = GridBagConstraints.FIRST_LINE_START;
editorPane.add(perc,c);
c.gridx=1;
editorPane.add(percEditor,c);
c.gridx = 0;
c.gridy = 1;
editorPane.add(px,c);
c.gridx = 1;
c.gridy = 1;
editorPane.add(pxEditor,c);
c.gridx = 0;
c.gridy = 2;
editorPane.add(fill,c);
this.percEditor.setEnabled(false);
this.percEditor.setValue(SizeValue.percent(50));
this.pxEditor.setEnabled(true);
percEditor.addPropertyChangeListener(this);
pxEditor.addPropertyChangeListener(this);
}
private void init() {
setLayout(new BorderLayout(0, 5));
setBorder(makeBorder());
add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH);
JPanel mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints labelConstraints = new GridBagConstraints();
labelConstraints.anchor = GridBagConstraints.FIRST_LINE_END;
GridBagConstraints editConstraints = new GridBagConstraints();
editConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
editConstraints.weightx = 1.0;
editConstraints.fill = GridBagConstraints.HORIZONTAL;
editConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
labelConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
addToPanel(mainPanel, labelConstraints, 0, 0, new JLabel("FIFO Queue Name to Get Data From: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 0, queueName = new JTextField(20));
addToPanel(mainPanel, labelConstraints, 0, 1, new JLabel("Variable Name to Store Data: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 1, variableName = new JTextField(20));
addToPanel(mainPanel, labelConstraints, 0, 2, new JLabel("Timeout: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 2, timeout = new JTextField(20));
JPanel container = new JPanel(new BorderLayout());
container.add(mainPanel, BorderLayout.NORTH);
add(container, BorderLayout.CENTER);
}
private void init() {
log.debug("[Lockfile plugin] init");
setLayout(new BorderLayout(0, 5));
setBorder(makeBorder());
add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH);
JPanel mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints labelConstraints = new GridBagConstraints();
labelConstraints.anchor = GridBagConstraints.FIRST_LINE_END;
GridBagConstraints editConstraints = new GridBagConstraints();
editConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
editConstraints.weightx = 1.0;
editConstraints.fill = GridBagConstraints.HORIZONTAL;
editConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
labelConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
addToPanel(mainPanel, labelConstraints, 0, 0, new JLabel("Lock file name: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 0, tfFileName = new JTextField(20));
addToPanel(mainPanel, labelConstraints, 0, 1, new JLabel("Also check filemask: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 1, tfFileMask = new JTextField(20));
JPanel container = new JPanel(new BorderLayout());
container.add(mainPanel, BorderLayout.NORTH);
add(container, BorderLayout.CENTER);
}
private void initLayout() {
GridBagLayout layout = new GridBagLayout();
setLayout(layout);
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.FIRST_LINE_START;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 0;
c.insets = new Insets(13, 13, 0, 13);
add(getLabel(), c);
c.anchor = GridBagConstraints.NORTHWEST;
c.fill = GridBagConstraints.BOTH;
c.gridx = 0;
c.gridy = 1;
c.weightx = 1;
c.weighty = 1;
add(getHistoryContentPanel(), c);
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 2;
c.weighty = 0;
c.insets = new Insets(5, 13, 0, 13);
add(getSizePanel(), c);
c.anchor = GridBagConstraints.LAST_LINE_END;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 3;
c.insets = new Insets(0, 13, 5, 10);
add(getButtonsPanel(), c);
}
Palette(String name, List<Component> buttonComponents) {
super();
this.name = name;
panel = new JPanel();
panel.setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(1, 1, 1, 1);
JideLabel label = new JideLabel("Show");
label.setOrientation(SwingConstants.VERTICAL);
label.setClockwise(false);
label.setMinimumSize(label.getPreferredSize());
constraints.anchor = GridBagConstraints.SOUTH;
panel.add(label, constraints);
label = new JideLabel("Solo");
label.setOrientation(SwingConstants.VERTICAL);
label.setClockwise(false);
label.setMinimumSize(label.getPreferredSize());
panel.add(label, constraints);
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.weightx = 1.0;
panel.add(new JLabel(), constraints);
constraints.anchor = GridBagConstraints.FIRST_LINE_START;
constraints.weightx = 0.0;
LayoutUtils.addRowOfComponents(panel, constraints, buttonComponents);
dockableFrame = new App.DockableFrameBuilder(panel, name, DockContext.DOCK_SIDE_WEST, 3).build();
dockableFrame.setKey("customLayerPalette." + name);
}
void add(CustomLayer layer, List<Component> buttonComponents) {
layers.add(layer);
layerButtonComponents.put(layer, buttonComponents);
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.anchor = GridBagConstraints.FIRST_LINE_START;
constraints.weightx = 0.0;
constraints.insets = new Insets(1, 1, 1, 1);
LayoutUtils.insertRowOfComponents(panel, constraints, panel.getComponentCount() - 3, buttonComponents);
}
private PasswordDialog(Window owner, String i18nKey, UserCredential preset, Object... args) {
super(owner, i18nKey, ModalityType.APPLICATION_MODAL, args);
setModal(true);
if (preset != null && preset.getUsername() != null) {
usernameField.setText(preset.getUsername());
}
if (preset != null && preset.getPassword() != null) {
passwordField.setText(new String(preset.getPassword()));
rememberBox.setSelected(true);
}
String url = preset != null ? preset.getURL() : null;
JPanel main = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.FIRST_LINE_START;
c.insets = new Insets(4, 4, 4, 4);
JLabel label = new ResourceLabel("authentication.username", url);
label.setLabelFor(usernameField);
c.gridwidth = GridBagConstraints.RELATIVE;
main.add(label, c);
c.gridwidth = GridBagConstraints.REMAINDER;
main.add(usernameField, c);
label = new ResourceLabel("authentication.password", url);
label.setLabelFor(passwordField);
c.gridwidth = GridBagConstraints.RELATIVE;
main.add(label, c);
c.gridwidth = GridBagConstraints.REMAINDER;
main.add(passwordField, c);
JPanel rememberPanel = new JPanel();
rememberPanel.add(rememberBox);
if (Boolean.parseBoolean(ParameterService.getParameterValue(RapidMinerGUI.PROPERTY_RAPIDMINER_DISALLOW_REMEMBER_PASSWORD))) {
rememberPanel.add(enforcedIcon);
rememberBox.setSelected(false);
rememberBox.setEnabled(false);
}
main.add(rememberPanel, c);
layoutDefault(main, makeOkButton(), makeCancelButton());
}
@Override
protected void buildChooser() {
final JPanel colorList = new JPanel();
colorList.setLayout(new GridLayout(m_recentColors.length, 1, 1, 1));
for (final Color col : m_recentColors) {
final ColorPanel cp = new ColorPanel(col, false, true);
cp.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
if (e.getButton() != MouseEvent.BUTTON1) {
return;
}
getColorSelectionModel().setSelectedColor(col);
}
});
cp.setPreferredSize(new Dimension(200, 25));
final JPanel p = new JPanel();
p.setBorder(new EmptyBorder(1, 1, 1, 1));
p.add(cp, BorderLayout.PAGE_START);
colorList.add(cp);
}
final GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.anchor = GridBagConstraints.FIRST_LINE_START;
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
final JPanel innerPanel = new JPanel(new GridBagLayout());
innerPanel.add(colorList, c);
final JPanel outerPanel = new JPanel(new BorderLayout());
outerPanel.add(innerPanel, BorderLayout.NORTH);
final JScrollPane sp = new JScrollPane(outerPanel);
sp.setBorder(null);
sp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
sp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
add(sp, BorderLayout.CENTER);
}
private void init() {
setLayout(new BorderLayout(0, 5));
setBorder(makeBorder());
add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH);
JPanel mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints labelConstraints = new GridBagConstraints();
labelConstraints.anchor = GridBagConstraints.FIRST_LINE_END;
GridBagConstraints editConstraints = new GridBagConstraints();
editConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
editConstraints.weightx = 1.0;
editConstraints.fill = GridBagConstraints.HORIZONTAL;
addToPanel(mainPanel, labelConstraints, 0, 1, new JLabel("Filename: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 1, filename = new JTextField(20));
JButton browseButton = new JButton("Browse...");
addToPanel(mainPanel, labelConstraints, 2, 1, browseButton);
GuiBuilderHelper.strechItemToComponent(filename, browseButton);
browseButton.addActionListener(new BrowseAction(filename));
addToPanel(mainPanel, labelConstraints, 0, 2, new JLabel("Overwrite existing file: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 2, overwrite = new JCheckBox());
addToPanel(mainPanel, labelConstraints, 0, 3, new JLabel("Write File Header: ", JLabel.RIGHT));
header = new JTextArea();
header.setLineWrap(true);
addToPanel(mainPanel, editConstraints, 1, 3, GuiBuilderHelper.getTextAreaScrollPaneContainer(header, 3));
editConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
labelConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
addToPanel(mainPanel, labelConstraints, 0, 4, new JLabel("Record each sample as: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 4, columns = new JTextField(20));
editConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
labelConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
addToPanel(mainPanel, labelConstraints, 0, 5, new JLabel("Write File Footer: ", JLabel.RIGHT));
footer = new JTextArea();
footer.setLineWrap(true);
addToPanel(mainPanel, editConstraints, 1, 5, GuiBuilderHelper.getTextAreaScrollPaneContainer(footer, 3));
JPanel container = new JPanel(new BorderLayout());
container.add(mainPanel, BorderLayout.NORTH);
add(container, BorderLayout.CENTER);
add(createHelperPanel(), BorderLayout.SOUTH);
}
private void init() {
setLayout(new BorderLayout(0, 5));
setBorder(makeBorder());
add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH);
JPanel mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints labelConstraints = new GridBagConstraints();
labelConstraints.anchor = GridBagConstraints.FIRST_LINE_END;
GridBagConstraints editConstraints = new GridBagConstraints();
editConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
editConstraints.weightx = 1.0;
editConstraints.fill = GridBagConstraints.HORIZONTAL;
addToPanel(mainPanel, labelConstraints, 0, 0, new JLabel("CSV File: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 0, fileName = new JTextField(20));
addToPanel(mainPanel, labelConstraints, 2, 0, browseButton = new JButton("Browse..."));
GuiBuilderHelper.strechItemToComponent(fileName, browseButton);
editConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
labelConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
browseButton.addActionListener(new BrowseAction(fileName));
addToPanel(mainPanel, labelConstraints, 0, 1, new JLabel(" Variable prefix: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 1, variablePrefix = new JTextField(20));
addToPanel(mainPanel, labelConstraints, 0, 2, new JLabel("Separator (use '\\t' for tab): ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 2, separator = new JTextField(20));
addToPanel(mainPanel, labelConstraints, 0, 3, new JLabel("Skip initial lines: ", JLabel.RIGHT));
skipLines = new JTextField(20);
Color lightRed = new Color(255, 202, 197);
skipLines.setInputVerifier(new IntegerInputVerifier(0, Integer.MAX_VALUE, skipLines.getBackground(), lightRed));
skipLines.setToolTipText("Number of initial lines of input to skip. Must be an integer >= 0.");
addToPanel(mainPanel, editConstraints, 1, 3, skipLines);
addToPanel(mainPanel, labelConstraints, 0, 4, new JLabel("Store variables also in System Properties: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 4, storeSysProp = new JCheckBox());
editConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
labelConstraints.insets = new java.awt.Insets(4, 0, 0, 2);
addToPanel(mainPanel, labelConstraints, 0, 5, checkButton = new JButton("Test CSV File"));
labelConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
checkInfo = new JTextArea();
addToPanel(mainPanel, editConstraints, 1, 5, GuiBuilderHelper.getTextAreaScrollPaneContainer(checkInfo, 10));
checkButton.addActionListener(new TestCsvFileAction(this));
checkInfo.setEditable(false);
checkInfo.setOpaque(false);
JPanel container = new JPanel(new BorderLayout());
container.add(mainPanel, BorderLayout.NORTH);
add(container, BorderLayout.CENTER);
}
private void init() {
setLayout(new BorderLayout(0, 5));
setBorder(makeBorder());
add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH);
JPanel mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints labelConstraints = new GridBagConstraints();
labelConstraints.anchor = GridBagConstraints.FIRST_LINE_END;
GridBagConstraints editConstraints = new GridBagConstraints();
editConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
editConstraints.weightx = 1.0;
editConstraints.fill = GridBagConstraints.HORIZONTAL;
addToPanel(mainPanel, labelConstraints, 0, 0, new JLabel("Rewind on end of file: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 0, rewindOnEOF = new JCheckBox());
addToPanel(mainPanel, labelConstraints, 0, 1, new JLabel("Data file path: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 1, fileName = new JTextField(20));
addToPanel(mainPanel, labelConstraints, 2, 1, browseButton = new JButton("Browse..."));
GuiBuilderHelper.strechItemToComponent(fileName, browseButton);
editConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
labelConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
browseButton.addActionListener(new BrowseAction(fileName));
addToPanel(mainPanel, labelConstraints, 0, 2, new JLabel("Variable name: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 2, variableName = new JTextField(20));
addToPanel(mainPanel, labelConstraints, 0, 3, new JLabel("Encode read data as HEX: ", JLabel.RIGHT));
addToPanel(mainPanel, editConstraints, 1, 3, encodeHex = new JCheckBox());
editConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
labelConstraints.insets = new java.awt.Insets(4, 0, 0, 2);
addToPanel(mainPanel, labelConstraints, 0, 4, checkButton = new JButton("Check File Consistency"));
labelConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
checkInfo = new JTextArea();
addToPanel(mainPanel, editConstraints, 1, 4, GuiBuilderHelper.getTextAreaScrollPaneContainer(checkInfo, 10));
checkButton.addActionListener(new CheckConsistencyAction(fileName, checkInfo));
checkInfo.setEditable(false);
checkInfo.setOpaque(false);
JPanel container = new JPanel(new BorderLayout());
container.add(mainPanel, BorderLayout.NORTH);
add(container, BorderLayout.CENTER);
}