本文整理汇总了Java中java.awt.GridBagConstraints.CENTER属性的典型用法代码示例。如果您正苦于以下问题:Java GridBagConstraints.CENTER属性的具体用法?Java GridBagConstraints.CENTER怎么用?Java GridBagConstraints.CENTER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.GridBagConstraints
的用法示例。
在下文中一共展示了GridBagConstraints.CENTER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PrintPreviewPanel
/**
* Creates a preview panel for the specified {@link PrintableComponent}.
*
* @param comp
* the {@link PrintableComponent} the preview panel should be created for.
*/
public PrintPreviewPanel(PrintableComponent comp, PageFormat pageFormat) {
this.printer = new ComponentPrinter(comp);
this.cardLayout = new CardLayout();
this.pageFormat = pageFormat;
setLayout(cardLayout);
GridBagConstraints gbc = new GridBagConstraints();
gbc.weightx = 1;
gbc.weighty = 1;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.CENTER;
landscapePanel = new JPanel(new GridBagLayout());
landscapePreview = new ComponentPreviewPanel(Orientation.LANDSCAPE);
landscapePanel.add(landscapePreview, gbc);
add(landscapePanel, Orientation.LANDSCAPE.toString());
portraitPanel = new JPanel(new GridBagLayout());
portraitPreview = new ComponentPreviewPanel(Orientation.PORTRAIT);
portraitPanel.add(portraitPreview, gbc);
add(portraitPanel, Orientation.PORTRAIT.toString());
// set page format
setPageFormat(pageFormat);
}
示例2: addFontChooser
private void addFontChooser(JComponent c, String displayName, FontChooser chooser) {
GridBagLayout layout = (GridBagLayout)c.getLayout();
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(3, 3, 3, 3);
constraints.weightx = 0.0;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
JLabel label = new JLabel(displayName, JLabel.TRAILING);
layout.setConstraints(label, constraints);
c.add(label);
constraints.insets = new Insets(3, 3, 3, 1);
constraints.weightx = 1.0;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.CENTER;
layout.setConstraints(chooser.getPreview(), constraints);
c.add(chooser.getPreview());
constraints.insets = new Insets(3, 1, 3, 3);
constraints.weightx = 0.0;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
constraints.gridwidth = GridBagConstraints.REMAINDER;
layout.setConstraints(chooser.getButton(), constraints);
c.add(chooser.getButton());
elements.add(chooser);
label.setLabelFor(chooser.getButton());
}
示例3: setInsideLocation
final public ExtendedGridBagConstraints setInsideLocation(int intPinsideLocation) {
switch (intPinsideLocation) {
case GridBagConstraints.PAGE_START:
case GridBagConstraints.PAGE_END:
case GridBagConstraints.LINE_START:
case GridBagConstraints.LINE_END:
case GridBagConstraints.FIRST_LINE_START:
case GridBagConstraints.FIRST_LINE_END:
case GridBagConstraints.LAST_LINE_START:
case GridBagConstraints.LAST_LINE_END:
case GridBagConstraints.BASELINE:
case GridBagConstraints.BASELINE_LEADING:
case GridBagConstraints.BASELINE_TRAILING:
case GridBagConstraints.ABOVE_BASELINE:
case GridBagConstraints.ABOVE_BASELINE_LEADING:
case GridBagConstraints.ABOVE_BASELINE_TRAILING:
case GridBagConstraints.BELOW_BASELINE:
case GridBagConstraints.BELOW_BASELINE_LEADING:
case GridBagConstraints.BELOW_BASELINE_TRAILING:
Tools.err("strange grid anchor value : ", intPinsideLocation);
//$FALL-THROUGH$
case GridBagConstraints.CENTER:
case GridBagConstraints.NORTH:
case GridBagConstraints.NORTHWEST:
case GridBagConstraints.NORTHEAST:
case GridBagConstraints.SOUTH:
case GridBagConstraints.SOUTHWEST:
case GridBagConstraints.SOUTHEAST:
case GridBagConstraints.WEST:
case GridBagConstraints.EAST:
this.anchor = intPinsideLocation;
break;
default:
Tools.err("bad grid anchor value : ", intPinsideLocation);
}
return this;
}
示例4: getArrowButtonBorderPanel
public JPanel getArrowButtonBorderPanel() {
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints(0, 0, GridBagConstraints.RELATIVE, 1, 1.0, 1.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0);
panel.add(mainButton, gbc); // , BorderLayout.CENTER);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 0;
panel.add(arrowButton, gbc); // , BorderLayout.EAST);
mainButton.setBorder(null);
arrowButton.setBorder(null);
panel.setBackground(UIManager.getColor("Button.background"));
return panel;
}
示例5: init
@Override
public void init() {
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 1;
gridBagConstraints2.gridy = 1;
gridBagConstraints2.anchor = GridBagConstraints.CENTER;
gridBagConstraints2.fill = GridBagConstraints.VERTICAL;
this.add( this.getJComboBox() , gridBagConstraints2 );
}
示例6: addSpacer
public static void addSpacer(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;
c.gridy++;
panel.add(Box.createVerticalStrut(20), c);
c.insets = orig_insets;
return;
}
示例7: initialize
/**
* This method initializes this
*
*/
private void initialize() {
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.anchor = GridBagConstraints.CENTER;
gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
this.setLayout(new GridBagLayout());
this.add(getStopButton(), gridBagConstraints1);
}
示例8: getDevelopmentDialog
final private JDialog getDevelopmentDialog( ControlJFrame objPcontrolJFrame,
JTextArea objPdevelopmentJTextArea,
ExtendedJButton objPdevelopmentCloseExtendedJButton) {
// Development scrollpane :
final JScrollPane objLdevelopmentJScrollPane =
new JScrollPane(objPdevelopmentJTextArea,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
objLdevelopmentJScrollPane.setOpaque(true);
// Development dialog :
final JDialog objLdevelopmentJDialog =
new JDialog(objPcontrolJFrame,
objPcontrolJFrame.getLanguageString(Language.intS_TITLE_DEVELOPMENT),
true);
objLdevelopmentJDialog.setLayout(new GridBagLayout());
final ExtendedGridBagConstraints objLextendedGridBagConstraints =
new ExtendedGridBagConstraints( 0,
GridBagConstraints.RELATIVE,
1,
1,
GridBagConstraints.CENTER,
0,
0,
0,
10,
0,
0,
GridBagConstraints.BOTH,
1.0F,
1.0F);
// Add content :
objLdevelopmentJDialog.add(objLdevelopmentJScrollPane, objLextendedGridBagConstraints);
objLextendedGridBagConstraints.setFilling(GridBagConstraints.NONE, 0.0F, 0.0F);
objLdevelopmentJDialog.add(objPdevelopmentCloseExtendedJButton, objLextendedGridBagConstraints);
objLdevelopmentJDialog.addWindowListener(new JDialogWindowListener(objPcontrolJFrame, objLdevelopmentJDialog, false));
return objLdevelopmentJDialog;
}
示例9: FiltersJDialog
/**
* Constructs
*
* @param objPcontrolJFrame
*/
public FiltersJDialog(ControlJFrame objPcontrolJFrame) {
super(objPcontrolJFrame);
this.bolGactivated = false;
this.lngGlastActionTimestamp = Constants.bytS_UNCLASS_NO_VALUE;
this.objGclearJButton = new CriteriaJButton(this.objGcontrolJFrame, Language.intS_TOOLTIP_RESET_FILTERS, this);
this.objGactivateJButton = new CriteriaJButton(this.objGcontrolJFrame, Language.intS_TOOLTIP_APPLY_FILTERS, this);
this.objGdeactivateJButton = new CriteriaJButton(this.objGcontrolJFrame, Language.intS_TOOLTIP_DEACTIVATE_FILTERS, this);
this.objGcloseJButton = new CriteriaJButton(this.objGcontrolJFrame, Language.intS_TOOLTIP_CLOSE_FILTERS, this);
this.objGpatternTokensJLabel =
new ExtendedJLabel( this.objGcontrolJFrame,
Strings.strS_SPACE,
Language.intS_TOOLTIP_PATTERN_NAME_PART_APPLIED);
this.objGsynchroTokensJLabel =
new ExtendedJLabel( this.objGcontrolJFrame,
Strings.strS_SPACE,
Language.intS_TOOLTIP_SYNCHRO_SITESWAP_PART_APPLIED);
this.objGasynchroTokensJLabel =
new ExtendedJLabel( this.objGcontrolJFrame,
Strings.strS_SPACE,
Language.intS_TOOLTIP_ASYNCHRO_SITESWAP_PART_APPLIED);
this.objGstyleTokensJLabel = new ExtendedJLabel(this.objGcontrolJFrame, Strings.strS_SPACE, Language.intS_TOOLTIP_STYLE_NAME_PART_APPLIED);
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(this.objGcriteriaJPanel, objLextendedGridBagConstraints);
objLextendedGridBagConstraints.setFilling(GridBagConstraints.NONE, 0.0F, 0.0F);
this.add(objLbuttonsJPanel, objLextendedGridBagConstraints);
}
示例10: MinimizedTab
public MinimizedTab(AnalyzerModel model) {
this.outputExprs = model.getOutputExpressions();
outputExprs.addOutputExpressionsListener(myListener);
selector = new OutputSelector(model);
selector.addItemListener(myListener);
karnaughMap = new KarnaughMapPanel(model);
karnaughMap.addMouseListener(new TruthTableMouseListener());
setAsExpr.addActionListener(myListener);
formatChoice.addItemListener(myListener);
JPanel buttons = new JPanel(new GridLayout(1, 1));
buttons.add(setAsExpr);
JPanel formatPanel = new JPanel();
formatPanel.add(formatLabel);
formatPanel.add(formatChoice);
GridBagLayout gb = new GridBagLayout();
GridBagConstraints gc = new GridBagConstraints();
setLayout(gb);
gc.gridx = 0;
gc.gridy = 0;
addRow(gb, gc, selector.getLabel(), selector.getComboBox());
addRow(gb, gc, formatLabel, formatChoice);
gc.weightx = 0.0;
gc.gridx = 0;
gc.gridwidth = 2;
gc.gridy = GridBagConstraints.RELATIVE;
gc.fill = GridBagConstraints.BOTH;
gc.anchor = GridBagConstraints.CENTER;
gb.setConstraints(karnaughMap, gc);
add(karnaughMap);
Insets oldInsets = gc.insets;
gc.insets = new Insets(20, 0, 0, 0);
gb.setConstraints(minimizedExpr, gc);
add(minimizedExpr);
gc.insets = oldInsets;
gc.fill = GridBagConstraints.NONE;
gb.setConstraints(buttons, gc);
add(buttons);
String selected = selector.getSelectedOutput();
setAsExpr.setEnabled(selected != null && !outputExprs.isExpressionMinimal(selected));
}
示例11: initialize
/**
* This method initializes this
*/
private void initialize() {
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 2;
gridBagConstraints2.gridy = 0;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.fill = GridBagConstraints.BOTH;
gridBagConstraints1.insets = new Insets(10, 0, 10, 10);
gridBagConstraints1.weightx = 1.0;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.insets = new Insets(10, 10, 10, 5);
gridBagConstraints.gridy = 0;
GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
gridBagConstraints6.fill = GridBagConstraints.BOTH;
gridBagConstraints6.gridwidth = 5;
gridBagConstraints6.gridx = 0;
gridBagConstraints6.gridy = 1;
gridBagConstraints6.weightx = 1.0;
gridBagConstraints6.weighty = 1.0;
gridBagConstraints6.insets = new Insets(0, 10, 0, 10);
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.fill = GridBagConstraints.BOTH;
gridBagConstraints5.gridx = 1;
gridBagConstraints5.gridy = 0;
gridBagConstraints5.weightx = 1.0;
gridBagConstraints5.anchor = GridBagConstraints.CENTER;
gridBagConstraints5.weighty = 0.0;
gridBagConstraints5.insets = new Insets(10, 0, 10, 10);
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.insets = new Insets(10, 10, 10, 5);
gridBagConstraints4.gridy = 0;
gridBagConstraints4.anchor = GridBagConstraints.WEST;
gridBagConstraints4.gridx = 0;
jLabelDummy = new JLabel();
jLabelDummy.setText(" ");
jLabelClassDescCaption = new JLabel();
jLabelClassDescCaption.setText("Text");
jLabelClassDescCaption.setVisible(false);
jLabelClassNameCaption = new JLabel();
jLabelClassNameCaption.setText("Name:");
jLabelClassNameCaption.setFont(new Font("Dialog", Font.BOLD, 12));
this.setSize(392, 238);
this.setLayout(new GridBagLayout());
this.add(jLabelClassNameCaption, gridBagConstraints4);
this.add(getJTextFieldClassName(), gridBagConstraints5);
this.add(getJScrollPaneClassSlots(), gridBagConstraints6);
this.add(jLabelClassDescCaption, gridBagConstraints);
this.add(getJTextFieldClassDescription1(), gridBagConstraints1);
this.add(jLabelDummy, gridBagConstraints2);
}
示例12: ProgressDialog
/**
* @param parentFrame The parent frame.
* @param title The dialog title.
* @param modal True if you want a modal dialog.
*/
private ProgressDialog(Frame parentFrame, String title) {
//----------------------- modal
super(parentFrame, title, true);
setLocationRelativeTo(parentFrame);
getOkButton().setVisible(false);
JPanel mainPanel = new JPanel(new GridBagLayout());
progressBar = new JProgressBar();
label = new JLabel(resourceBundle.getMessage(Tags.PROGRESS_DIALOG_LABEL));
progressBar.setValue(0);
progressBar.setStringPainted(true);
progressBar.setSize(300, 100);
GridBagConstraints gbc1 = new GridBagConstraints();
gbc1.gridx = 0;
gbc1.gridy = 0;
gbc1.gridwidth = 1;
gbc1.gridheight = 1;
gbc1.weightx = 1;
gbc1.weighty = 1;
gbc1.fill = GridBagConstraints.BOTH;
gbc1.anchor = GridBagConstraints.CENTER;
gbc1.ipadx = 10;
gbc1.ipady = 10;
GridBagConstraints gbc2 = new GridBagConstraints();
gbc2.gridx = 0;
gbc2.gridy = 1;
gbc2.gridwidth = 1;
gbc2.gridheight = 1;
gbc2.weightx = 1;
gbc2.weighty = 1;
gbc2.fill = GridBagConstraints.BOTH;
gbc2.anchor = GridBagConstraints.CENTER;
gbc2.ipadx = 10;
gbc2.ipady = 10;
mainPanel.add(label, gbc1);
mainPanel.add(progressBar, gbc2);
getContentPane().add(mainPanel, BorderLayout.CENTER);
pack();
setResizable(true);
scheduleStart();
}
示例13: JobAttributesPanel
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);
}
示例14: updateCharts
/**
* Updates the charts.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
for (int i = 0; i < listOfChartPanels.size(); i++) {
JPanel panel = listOfChartPanels.get(i);
panel.removeAll();
final ChartPanel chartPanel = new ChartPanel(getModel().getChartOrNull(i)) {
private static final long serialVersionUID = -6953213567063104487L;
@Override
public Dimension getPreferredSize() {
return DIMENSION_CHART_PANEL_ENLARGED;
}
};
chartPanel.setPopupMenu(null);
chartPanel.setBackground(COLOR_TRANSPARENT);
chartPanel.setOpaque(false);
chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
panel.add(chartPanel, BorderLayout.CENTER);
JPanel openChartPanel = new JPanel(new GridBagLayout());
openChartPanel.setOpaque(false);
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
JButton openChartButton = new JButton(OPEN_CHART_ACTION);
openChartButton.setOpaque(false);
openChartButton.setContentAreaFilled(false);
openChartButton.setBorderPainted(false);
openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
openChartButton.setIcon(null);
Font font = openChartButton.getFont();
Map attributes = font.getAttributes();
attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));
openChartPanel.add(openChartButton, gbc);
panel.add(openChartPanel, BorderLayout.SOUTH);
panel.revalidate();
panel.repaint();
}
}
示例15: PrintSidesSubJPanel
public PrintSidesSubJPanel(PrintJDialog objPprintJDialog, ControlJFrame objPcontrolJFrame) {
this.objGprintJDialog = objPprintJDialog;
// Create widgets :
final ButtonGroup objLbuttonGroup = new ButtonGroup();
this.objGoneSidePrintIconRadioJButton =
new PrintIconRadioJButton( objPcontrolJFrame,
"radiobutton.oneside",
Constants.strS_FILE_NAME_A[Constants.intS_FILE_ICON_ONE_SIDE],
true,
objLbuttonGroup,
this);
this.objGoneSidePrintIconRadioJButton.addActionListener(this);
this.objGtumblePrintIconRadioJButton =
new PrintIconRadioJButton( objPcontrolJFrame,
"radiobutton.tumble",
Constants.strS_FILE_NAME_A[Constants.intS_FILE_ICON_TUMBLE],
false,
objLbuttonGroup,
this);
this.objGtumblePrintIconRadioJButton.addActionListener(this);
this.objGduplexPrintIconRadioJButton =
new PrintIconRadioJButton( objPcontrolJFrame,
"radiobutton.duplex",
Constants.strS_FILE_NAME_A[Constants.intS_FILE_ICON_DUPLEX],
false,
objLbuttonGroup,
this);
this.objGduplexPrintIconRadioJButton.addActionListener(this);
this.setOpaque(true);
this.setBorder(Tools.getTitledBorder(Tools.getLocaleString("border.sides"), this.objGprintJDialog.getControlJFrame().getFont()));
this.setLayout(new GridBagLayout());
final ExtendedGridBagConstraints objLextendedGridBagConstraints =
new ExtendedGridBagConstraints( 0,
GridBagConstraints.RELATIVE,
1,
1,
GridBagConstraints.CENTER,
3,
3,
6,
6,
GridBagConstraints.BOTH,
0.0F,
1.0F);
this.add(this.objGoneSidePrintIconRadioJButton, objLextendedGridBagConstraints);
this.add(this.objGtumblePrintIconRadioJButton, objLextendedGridBagConstraints);
this.add(this.objGduplexPrintIconRadioJButton, objLextendedGridBagConstraints);
}