本文整理汇总了Java中java.awt.GridBagConstraints.RELATIVE属性的典型用法代码示例。如果您正苦于以下问题:Java GridBagConstraints.RELATIVE属性的具体用法?Java GridBagConstraints.RELATIVE怎么用?Java GridBagConstraints.RELATIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.GridBagConstraints
的用法示例。
在下文中一共展示了GridBagConstraints.RELATIVE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSoundsJPanel
/**
* @return
*/
final private JPanel getSoundsJPanel() {
final JPanel objLsoundsJCheckBoxesJPanel = new JPanel(new GridBagLayout());
objLsoundsJCheckBoxesJPanel.setOpaque(true);
final ExtendedGridBagConstraints objLjCheckBoxesExtendedGridBagConstraints = new ExtendedGridBagConstraints(GridBagConstraints.RELATIVE, 0);
objLsoundsJCheckBoxesJPanel.add(this.objGbooleanLocalJCheckBoxA[PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_SOUNDS]);
final JPanel objLsoundsJCheckBoxJPanel = new JPanel();
objLsoundsJCheckBoxJPanel.setLayout(new BoxLayout(objLsoundsJCheckBoxJPanel, BoxLayout.LINE_AXIS));
objLsoundsJCheckBoxJPanel.add(this.objGbooleanLocalJLabelA[PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_SOUNDS]);
objLsoundsJCheckBoxJPanel.add(new JLabel(" :"));
objLsoundsJCheckBoxesJPanel.add(objLsoundsJCheckBoxJPanel, objLjCheckBoxesExtendedGridBagConstraints);
byte bytLposY = 1;
for (final byte bytLbooleanLocalIndex : new byte[] { PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_CATCH_SOUNDS,
PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_THROW_SOUNDS, PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_METRONOME }) {
final JPanel objLjPanel = new JPanel();
objLjPanel.setLayout(new BoxLayout(objLjPanel, BoxLayout.LINE_AXIS));
objLjPanel.add(this.objGbooleanLocalJCheckBoxA[bytLbooleanLocalIndex]);
objLjPanel.add(this.objGbooleanLocalJLabelA[bytLbooleanLocalIndex]);
this.setSoundsJLabelsEnabled();
objLjCheckBoxesExtendedGridBagConstraints.setGridLocation(1, bytLposY++);
objLsoundsJCheckBoxesJPanel.add(objLjPanel, objLjCheckBoxesExtendedGridBagConstraints);
}
return objLsoundsJCheckBoxesJPanel;
}
示例2: addComponentLeftRightRows
private void addComponentLeftRightRows(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: getColorsJPanel
final private JPanel getColorsJPanel() {
final JPanel objLpreferencesColorsJPanel = new JPanel(new GridBagLayout());
objLpreferencesColorsJPanel.setOpaque(true);
final ExtendedGridBagConstraints objLcolorsJLabelsExtendedGridBagConstraints =
new ExtendedGridBagConstraints( 0,
GridBagConstraints.RELATIVE,
1,
1,
GridBagConstraints.EAST,
10,
10,
10,
5);
final ExtendedGridBagConstraints objLcolorsJButtonsExtendedGridBagConstraints =
new ExtendedGridBagConstraints( 1,
GridBagConstraints.RELATIVE,
1,
1,
GridBagConstraints.WEST,
Constants.objS_GRAPHICS_FONT_METRICS.getAscent(),
Constants.objS_GRAPHICS_FONT_METRICS.getAscent(),
10,
10,
0,
10);
for (byte bytLpreferenceIndex = 0; bytLpreferenceIndex < PreferencesJDialog.bytS_STRING_LOCAL_PREFERENCES_NUMBER; ++bytLpreferenceIndex) {
if (bytLpreferenceIndex == PreferencesJDialog.bytS_STRING_LOCAL_PREFERENCES_NUMBER / 2) {
objLcolorsJLabelsExtendedGridBagConstraints.setGridBounds(2, GridBagConstraints.RELATIVE, 1, 1);
objLcolorsJButtonsExtendedGridBagConstraints.setGridBounds(3, GridBagConstraints.RELATIVE, 1, 1);
}
objLpreferencesColorsJPanel.add(this.objGstringLocalJLabelA[bytLpreferenceIndex], objLcolorsJLabelsExtendedGridBagConstraints);
objLpreferencesColorsJPanel.add(this.objGstringLocalColorJButtonA[bytLpreferenceIndex], objLcolorsJButtonsExtendedGridBagConstraints);
}
return objLpreferencesColorsJPanel;
}
示例4: addComponent
private static void addComponent (Container container, Component component) {
GridBagConstraints c = new GridBagConstraints();
c.gridx = c.gridy = GridBagConstraints.RELATIVE;
c.gridheight = c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.NORTHWEST;
c.weightx = c.weighty = 1.0;
((GridBagLayout)container.getLayout()).setConstraints (component,c);
container.add (component);
}
示例5: setGridHeight
final public ExtendedGridBagConstraints setGridHeight(int intPgridHeight) {
if (intPgridHeight > 0 || intPgridHeight == GridBagConstraints.REMAINDER || intPgridHeight == GridBagConstraints.RELATIVE) {
this.gridheight = intPgridHeight;
} else {
Tools.err("Bad vertical width value : ", intPgridHeight);
}
return this;
}
示例6: ParmsPanel
ParmsPanel(JList<?> list) {
// set up components
rotateToFit = new JCheckBox();
rotateToFit.setSelected(true);
printerView = new JCheckBox();
printerView.setSelected(true);
header = new JTextField(20);
header.setText("%n (%p of %P)");
// set up panel
gridbag = new GridBagLayout();
gbc = new GridBagConstraints();
setLayout(gridbag);
// now add components into panel
gbc.gridy = 0;
gbc.gridx = GridBagConstraints.RELATIVE;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.insets = new Insets(5, 0, 5, 0);
gbc.fill = GridBagConstraints.NONE;
addGb(new JLabel(Strings.get("labelCircuits") + " "));
gbc.fill = GridBagConstraints.HORIZONTAL;
addGb(new JScrollPane(list));
gbc.fill = GridBagConstraints.NONE;
gbc.gridy++;
addGb(new JLabel(Strings.get("labelHeader") + " "));
addGb(header);
gbc.gridy++;
addGb(new JLabel(Strings.get("labelRotateToFit") + " "));
addGb(rotateToFit);
gbc.gridy++;
addGb(new JLabel(Strings.get("labelPrinterView") + " "));
addGb(printerView);
}
示例7: setGridY
final public ExtendedGridBagConstraints setGridY(int intPgridY) {
if (intPgridY >= 0 || intPgridY == GridBagConstraints.RELATIVE) {
this.gridy = intPgridY;
} else {
Tools.err("bad vertical grid position : ", intPgridY);
}
return this;
}
示例8: FindJDialog
/**
* Constructs
*
* @param objPcontrolJFrame
*/
public FindJDialog(ControlJFrame objPcontrolJFrame) {
super(objPcontrolJFrame);
this.lngGlastActionTimestamp = Constants.bytS_UNCLASS_NO_VALUE;
this.objGnextJButton = new CriteriaJButton(this.objGcontrolJFrame, Language.intS_TOOLTIP_FIND_NEXT, this);
this.objGpreviousJButton = new CriteriaJButton(this.objGcontrolJFrame, Language.intS_TOOLTIP_FIND_PREVIOUS, this);
this.objGcancelJButton = new CriteriaJButton(this.objGcontrolJFrame, Language.intS_TOOLTIP_CANCEL_SEARCH, this);
this.objGcloseJButton = new CriteriaJButton(this.objGcontrolJFrame, Language.intS_TOOLTIP_CLOSE_SEARCH, this);
this.doAddCriteria();
final JPanel objLbuttonsJPanel = this.doAddButtons();
final ExtendedGridBagConstraints objLextendedGridBagConstraints =
new ExtendedGridBagConstraints( GridBagConstraints.RELATIVE,
0,
1,
1,
GridBagConstraints.CENTER,
6,
6,
3,
3,
GridBagConstraints.HORIZONTAL,
1.0F,
0.0F);
this.add(super.objGcriteriaJPanel, objLextendedGridBagConstraints);
objLextendedGridBagConstraints.setFilling(GridBagConstraints.NONE, 0.0F, 0.0F);
this.add(objLbuttonsJPanel, objLextendedGridBagConstraints);
this.setAble();
}
示例9: 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);
}
示例10: PrintAppearanceJPanel
public PrintAppearanceJPanel(PrintJDialog objPprintJDialog, ControlJFrame objPcontrolJFrame) {
this.objGprintChromaticitySubJPanel = new PrintChromaticitySubJPanel(objPprintJDialog, objPcontrolJFrame);
this.objGprintQualitySubJPanel = new PrintQualitySubJPanel(objPprintJDialog);
this.objGprintSidesSubJPanel = new PrintSidesSubJPanel(objPprintJDialog, objPcontrolJFrame);
this.objGprintJobAttributesSubJPanel = new PrintJobAttributesSubJPanel(objPprintJDialog);
this.setOpaque(true);
this.setLayout(new GridBagLayout());
final ExtendedGridBagConstraints objLextendedGridBagConstraints =
new ExtendedGridBagConstraints( GridBagConstraints.RELATIVE,
0,
1,
1,
GridBagConstraints.CENTER,
6,
6,
6,
6,
GridBagConstraints.BOTH,
1.0F,
1.0F);
this.add(this.objGprintChromaticitySubJPanel, objLextendedGridBagConstraints);
this.add(this.objGprintQualitySubJPanel, objLextendedGridBagConstraints);
objLextendedGridBagConstraints.setGridLocation(GridBagConstraints.RELATIVE, 1);
this.add(this.objGprintSidesSubJPanel, objLextendedGridBagConstraints);
this.add(this.objGprintJobAttributesSubJPanel, objLextendedGridBagConstraints);
}
示例11: 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);
}
示例12: doAddButtons
final private JPanel doAddButtons() {
final JPanel objLjPanel = new JPanel(new GridBagLayout());
objLjPanel.setOpaque(true);
final ExtendedGridBagConstraints objLextendedGridBagConstraints =
new ExtendedGridBagConstraints( 0,
GridBagConstraints.RELATIVE,
1,
1,
GridBagConstraints.CENTER,
7,
7,
0,
0,
GridBagConstraints.HORIZONTAL,
1.0F,
0.0F);
objLjPanel.add(this.objGactivateJButton, objLextendedGridBagConstraints);
objLjPanel.add(this.objGdeactivateJButton, objLextendedGridBagConstraints);
objLjPanel.add(this.objGclearJButton, objLextendedGridBagConstraints);
objLjPanel.add(this.objGcloseJButton, objLextendedGridBagConstraints);
return objLjPanel;
}
示例13: getGridYRelative
public boolean getGridYRelative(Component component) {
GridBagConstraints constraints = getLayout().getConstraints(component);
return constraints.gridy == GridBagConstraints.RELATIVE;
}
示例14: getGridWidthRelative
public boolean getGridWidthRelative(Component component) {
GridBagConstraints constraints = getLayout().getConstraints(component);
return constraints.gridwidth == GridBagConstraints.RELATIVE;
}
示例15: PrintQualitySubJPanel
public PrintQualitySubJPanel(PrintJDialog objPprintJDialog) {
this.objGprintJDialog = objPprintJDialog;
// Set widgets :
this.objGdraftJRadioButton = new JRadioButton(Tools.getLocaleString("radiobutton.draftq"));
this.objGdraftJRadioButton.setFont(this.objGprintJDialog.getControlJFrame().getFont());
this.objGdraftJRadioButton.setOpaque(true);
this.objGdraftJRadioButton.setMnemonic(Tools.getMnemonicChar("radiobutton.draftq"));
this.objGdraftJRadioButton.addActionListener(this);
this.objGnormalJRadioButton = new JRadioButton(Tools.getLocaleString("radiobutton.normalq"));
this.objGnormalJRadioButton.setFont(this.objGprintJDialog.getControlJFrame().getFont());
this.objGnormalJRadioButton.setOpaque(true);
this.objGnormalJRadioButton.setMnemonic(Tools.getMnemonicChar("radiobutton.normalq"));
this.objGnormalJRadioButton.addActionListener(this);
this.objGnormalJRadioButton.setSelected(true);
this.objGhighJRadioButton = new JRadioButton(Tools.getLocaleString("radiobutton.highq"));
this.objGhighJRadioButton.setFont(this.objGprintJDialog.getControlJFrame().getFont());
this.objGhighJRadioButton.setOpaque(true);
this.objGhighJRadioButton.setMnemonic(Tools.getMnemonicChar("radiobutton.highq"));
this.objGhighJRadioButton.addActionListener(this);
final ButtonGroup objLbuttonGroup = new ButtonGroup();
objLbuttonGroup.add(this.objGdraftJRadioButton);
objLbuttonGroup.add(this.objGnormalJRadioButton);
objLbuttonGroup.add(this.objGhighJRadioButton);
// Add widgets :
this.setOpaque(true);
this.setBorder(Tools.getTitledBorder(Tools.getLocaleString("border.quality"), this.objGprintJDialog.getControlJFrame().getFont()));
this.setLayout(new GridBagLayout());
final ExtendedGridBagConstraints objLextendedGridBagConstraints =
new ExtendedGridBagConstraints( 0,
GridBagConstraints.RELATIVE,
1,
1,
GridBagConstraints.CENTER,
6,
6,
6,
6,
GridBagConstraints.BOTH,
0.0F,
1.0F);
this.add(this.objGdraftJRadioButton, objLextendedGridBagConstraints);
this.add(this.objGnormalJRadioButton, objLextendedGridBagConstraints);
this.add(this.objGhighJRadioButton, objLextendedGridBagConstraints);
}