本文整理匯總了Java中java.awt.GridBagConstraints.HORIZONTAL屬性的典型用法代碼示例。如果您正苦於以下問題:Java GridBagConstraints.HORIZONTAL屬性的具體用法?Java GridBagConstraints.HORIZONTAL怎麽用?Java GridBagConstraints.HORIZONTAL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.GridBagConstraints
的用法示例。
在下文中一共展示了GridBagConstraints.HORIZONTAL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initialize
/**
* This method initializes this
*/
private void initialize() {
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
gridBagConstraints1.gridy = 1;
gridBagConstraints1.weightx = 1.0;
gridBagConstraints1.insets = new Insets(2, 2, 2, 2);
gridBagConstraints1.gridx = 0;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.insets = new Insets(2, 2, 2, 2);
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.gridy = 2;
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 0;
gridBagConstraints2.insets = new Insets(2, 2, 2, 2);
gridBagConstraints2.fill = GridBagConstraints.VERTICAL;
gridBagConstraints2.gridy = 3;
this.setLayout(new GridBagLayout());
this.add(getExecuteButton(), gridBagConstraints1);
this.add(new JLabel("Node query:"), gridBagConstraints);
this.add(getQueryField(), gridBagConstraints2);
}
示例2: addLeftRightComponents
private void addLeftRightComponents(JComponent[] ComponentLeft,
JComponent[] ComponentRight,
GridBagLayout gridbag,
Container container) {
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.NORTHEAST;
int numLabels = ComponentLeft.length;
for (int i = 0; i < numLabels; i++) {
c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
c.fill = GridBagConstraints.NONE; //reset to default
c.weightx = 0.0;
c.insets = new Insets(0,10,0,0);//reset to default
container.add(ComponentLeft[i], c);
c.gridwidth = GridBagConstraints.REMAINDER; //end row
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0.0;
c.insets = new Insets(0,10,3,0);
container.add(ComponentRight[i], c);
}
}
示例3: initialize
/**
* This method initializes this
* @return void
*/
private void initialize() {
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.gridx = 0;
gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints11.weightx = 1.0;
gridBagConstraints11.gridy = 1;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.gridwidth = 1;
this.setSize(300, 200);
this.setLayout(new GridBagLayout());
this.add(getJScrollPaneTextVersion(), gridBagConstraints);
this.add(getJPanelBottom(), gridBagConstraints11);
}
示例4: initialize
/**
* Initialize.
*/
private void initialize() {
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[] { 0, 0 };
gridBagLayout.rowHeights = new int[] { 0, 0, 0 };
gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
gridBagLayout.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
setLayout(gridBagLayout);
GridBagConstraints gbc_jPanelSimulationEnvironment = new GridBagConstraints();
gbc_jPanelSimulationEnvironment.insets = new Insets(10, 10, 0, 0);
gbc_jPanelSimulationEnvironment.anchor = GridBagConstraints.NORTH;
gbc_jPanelSimulationEnvironment.fill = GridBagConstraints.HORIZONTAL;
gbc_jPanelSimulationEnvironment.gridx = 0;
gbc_jPanelSimulationEnvironment.gridy = 0;
add(getJPanelSimulationEnvironment(), gbc_jPanelSimulationEnvironment);
GridBagConstraints gbc_jPanelTimeModelSelection = new GridBagConstraints();
gbc_jPanelTimeModelSelection.anchor = GridBagConstraints.WEST;
gbc_jPanelTimeModelSelection.insets = new Insets(10, 10, 0, 0);
gbc_jPanelTimeModelSelection.fill = GridBagConstraints.VERTICAL;
gbc_jPanelTimeModelSelection.gridx = 0;
gbc_jPanelTimeModelSelection.gridy = 1;
add(getJPanelTimeModelSelection(), gbc_jPanelTimeModelSelection);
}
示例5: initComponents
private void initComponents(String text, Font font) {
setBorder(BorderFactory.createEmptyBorder());
setLayout(new GridBagLayout());
setOpaque(false);
label = new JLabel(text);
label.setForeground(getForeground());
if (font != null) label.setFont(font);
else label.setFont(label.getFont().deriveFont(Font.BOLD));
GridBagConstraints c1 = new GridBagConstraints();
c1.weighty = 1d;
add(label, c1);
GridBagConstraints c2 = new GridBagConstraints();
c2.weightx = 1d;
c2.fill = GridBagConstraints.HORIZONTAL;
c2.insets = new Insets(0, 4, 0, 0);
add(new Separator(), c2);
}
示例6: addSeperator
public static void addSeperator(JPanel panel, GridBagConstraints c) {
Insets orig_insets = c.insets;
c.insets = new Insets(0, 0, 0, 0);
c.gridwidth = 2;
c.gridheight = 1;
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.CENTER;
c.gridx = 0;
panel.add(Box.createVerticalStrut(5), c);
c.gridx = 0;
c.gridy++;
panel.add(new JSeparator(), c);
c.gridx = 0;
c.gridy++;
panel.add(Box.createVerticalStrut(5), c);
c.insets = orig_insets;
return;
}
示例7: addProbability
/**
* Add a probability to an interval Panel If the probability is for
* interval B the value is displayed as 1-probability
*
* @param intervalPanel
* the intervalPanel
* @param intervalA
* if the probability is for interval A or B
*/
protected void addProbability(Container intervalPanel, boolean intervalA) {
JLabel probLabel = new JLabel(PROBABILITY);
JTextField probValue = new JTextField();
Double probability = (Double) current.getParameter(0).getValue();
// If the interval is interval A display value directly
// Otherwise display 1-probability
if (intervalA) {
probValue.setName(PROBABILITY_INTERVAL_A);
} else {
probability = new Double(1 - probability.doubleValue());
probValue.setName(PROBABILITY_INTERVAL_B);
}
probValue.setText(probability.toString());
probLabel.setLabelFor(probValue);
probValue.addFocusListener(new ProbabilityAdapter());
probValue.addKeyListener(new ProbabilityAdapter());
GridBagConstraints c = new GridBagConstraints();
c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
c.fill = GridBagConstraints.NONE; // reset to default
c.weightx = 0.0; // reset to default
c.weighty = 1.0;
intervalPanel.add(probLabel, c);
c.gridwidth = GridBagConstraints.REMAINDER; // end row
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
c.weighty = 1.0;
intervalPanel.add(probValue, c);
}
示例8: setupComponet
private void setupComponet(JComponent component, int gridx, int gridy,
int gridwidth, int ipadx, boolean fill) {
final GridBagConstraints gridBagConstrains = new GridBagConstraints();
gridBagConstrains.gridx = gridx;
gridBagConstrains.gridy = gridy;
if (gridwidth > 1)
gridBagConstrains.gridwidth = gridwidth;
if (ipadx > 0)
gridBagConstrains.ipadx = ipadx;
gridBagConstrains.insets = new Insets(5, 1, 3, 1);
if (fill)
gridBagConstrains.fill = GridBagConstraints.HORIZONTAL;
add(component, gridBagConstrains);
}
示例9: CopiesPanel
public CopiesPanel() {
super();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
setBorder(BorderFactory.createTitledBorder(strTitle));
c.fill = GridBagConstraints.HORIZONTAL;
c.insets = compInsets;
lblCopies = new JLabel(getMsg("label.numcopies"), JLabel.TRAILING);
lblCopies.setDisplayedMnemonic(getMnemonic("label.numcopies"));
lblCopies.getAccessibleContext().setAccessibleName(
getMsg("label.numcopies"));
addToGB(lblCopies, this, gridbag, c);
snModel = new SpinnerNumberModel(1, 1, 999, 1);
spinCopies = new JSpinner(snModel);
lblCopies.setLabelFor(spinCopies);
// REMIND
((JSpinner.NumberEditor)spinCopies.getEditor()).getTextField().setColumns(3);
spinCopies.addChangeListener(this);
c.gridwidth = GridBagConstraints.REMAINDER;
addToGB(spinCopies, this, gridbag, c);
cbCollate = createCheckBox("checkbox.collate", this);
cbCollate.setEnabled(false);
addToGB(cbCollate, this, gridbag, c);
}
示例10: setupComponet
private void setupComponet(JComponent component, int gridx, int gridy,
int gridwidth, int ipadx, boolean fill) {
final GridBagConstraints gridBagConstrains = new GridBagConstraints();
gridBagConstrains.gridx = gridx;
gridBagConstrains.gridy = gridy;
if (gridwidth > 1)
gridBagConstrains.gridwidth = gridwidth;
if (ipadx > 0)
gridBagConstrains.ipadx = ipadx;
gridBagConstrains.insets = new Insets(5, 1, 3, 1);
if (fill)
gridBagConstrains.fill = GridBagConstraints.HORIZONTAL;
getContentPane().add(component, gridBagConstrains);
}
示例11: initializeComboBoxes
private void initializeComboBoxes() {
this.cbxTipo = new JComboBox<String>();
this.setComboBoxContent(this.cbxTipo);
this.cbxTipo.addActionListener(this);
GridBagConstraints gbc_comboBox = new GridBagConstraints();
gbc_comboBox.fill = GridBagConstraints.HORIZONTAL;
gbc_comboBox.gridx = 3;
gbc_comboBox.gridy = 4;
this.panelSecond.add(this.cbxTipo, gbc_comboBox);
}
示例12: insertValue
private void insertValue(JComponent value) {
GridBagConstraints c = new GridBagConstraints();
c.gridy = nextrow++;
c.anchor = GridBagConstraints.PAGE_START;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 1;
c.weightx = 1.0;
c.ipady = 5;
c.ipadx = 10;
add(value, c);
}
示例13: createBottom
private Component createBottom() {
final JPanel panel = new JPanel(new GridLayout(1, 4, 5, 0));
panel.add(bBack);
panel.add(bNext);
panel.add(bCancel);
panel.add(bFinish);
final JPanel p = new JPanel(new FlowLayout());
p.add(panel);
final JPanel res = new JPanel(new GridBagLayout());
final GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
final JPanel p1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
p1.add(etap);
c.weightx = 1.0;
c.gridx = 0;
c.gridy = 0;
res.add(p1, c);
c.weightx = 0;
c.gridx = 1;
c.gridy = 0;
res.add(p, c);
return res;
}
示例14: setupComponet
private void setupComponet(JComponent component, int gridx, int gridy,
int gridwidth, int ipadx, boolean fill) {
final GridBagConstraints gridBagConstrains = new GridBagConstraints();
gridBagConstrains.gridx = gridx;
gridBagConstrains.gridy = gridy;
gridBagConstrains.insets = new Insets(5, 1, 3, 1);
if (gridwidth > 1)
gridBagConstrains.gridwidth = gridwidth;
if (ipadx > 0)
gridBagConstrains.ipadx = ipadx;
if (fill)
gridBagConstrains.fill = GridBagConstraints.HORIZONTAL;
add(component, gridBagConstrains);
}
示例15: addCommentField
private void addCommentField(String text, int gridwidth) {
commentField = new JTextField(text);
commentField.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
commentUpdated();
}
});
GridBagConstraints gridConstraints = new GridBagConstraints();
gridConstraints.gridy = 1;
gridConstraints.gridwidth = gridwidth;
gridConstraints.fill = GridBagConstraints.HORIZONTAL;
add(commentField, gridConstraints);
}