本文整理匯總了Java中java.awt.GridBagConstraints.BOTH屬性的典型用法代碼示例。如果您正苦於以下問題:Java GridBagConstraints.BOTH屬性的具體用法?Java GridBagConstraints.BOTH怎麽用?Java GridBagConstraints.BOTH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.GridBagConstraints
的用法示例。
在下文中一共展示了GridBagConstraints.BOTH屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createView
private void createView() {
this.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
c.insets = new Insets(5, 5, 5, 5);
GridLayout layout = new GridLayout(1, 2);
this.inner = new JPanel(layout);
this.add(inner, c);
this.inner.add(createTree());
this.inner.add(currentView);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(new Dimension(800, 600));
this.setLocation(0, 25);
this.setResizable(true);
this.setTitle("101implementation:Swing");
this.setVisible(true);
}
示例2: setWeightX
final public ExtendedGridBagConstraints setWeightX(double dblPweightX) {
if (dblPweightX >= 0) {
this.weightx = dblPweightX;
this.fill =
this.weighty > 0 ? dblPweightX > 0 ? GridBagConstraints.BOTH : GridBagConstraints.VERTICAL
: dblPweightX > 0 ? GridBagConstraints.HORIZONTAL : GridBagConstraints.NONE;
} else {
Tools.err("bad weight x value : ", dblPweightX);
}
return this;
}
示例3: addConfigureButton
/**
* @param button
* adds a button the the right side of the ComboBox.
*/
protected void addConfigureButton(JButton button) {
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.weighty = 1;
c.weightx = 0;
c.insets = new Insets(0, 5, 0, 0);
container.add(button, c);
}
示例4: 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);
}
示例5: showNotificationLabel
/**
* Shows a central label displaying a notification to the user (e.g. for errors or during
* loading).
*
* @param i18nKey
* the notification I18N key to lookup the label text and icon
* @param arguments
* the I18N arguments
*/
private void showNotificationLabel(String i18nKey, Object... arguments) {
upperPanel.setVisible(false);
collapsibleErrorTable.setVisible(false);
GridBagConstraints constraint = new GridBagConstraints();
constraint.fill = GridBagConstraints.BOTH;
constraint.weightx = 1.0;
constraint.weighty = 1.0;
centerPanel.removeAll();
centerPanel.add(new JPanel(), constraint);
constraint.weightx = 0.0;
constraint.weighty = 0.0;
constraint.fill = GridBagConstraints.NONE;
constraint.anchor = GridBagConstraints.CENTER;
centerPanel.add(new ResourceLabel(i18nKey, arguments), constraint);
constraint.weightx = 1.0;
constraint.weighty = 1.0;
constraint.fill = GridBagConstraints.BOTH;
centerPanel.add(new JPanel(), constraint);
centerPanel.revalidate();
centerPanel.repaint();
}
示例6: createComponents
@Override
protected void createComponents() {
super.createComponents();
{
final JLabel binCountLabel = new ResourceLabel("plotter.configuration_dialog.bin_count");
// create input text field
binCountSpinner = new JSpinner(new SpinnerNumberModel(5, 1, null, 1));
binCountLabel.setLabelFor(binCountSpinner);
binCountSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
binCountChanged();
}
});
addTwoComponentRow(this, binCountLabel, binCountSpinner);
}
final JPanel spacerPanel = new JPanel();
final GridBagConstraints itemConstraint = new GridBagConstraints();
itemConstraint.fill = GridBagConstraints.BOTH;
itemConstraint.weightx = 1;
itemConstraint.weighty = 1;
itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
this.add(spacerPanel, itemConstraint);
}
示例7: initialize
/**
* This method initializes this
* @return void
*/
private void initialize() {
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.gridy = 0;
gridBagConstraints.ipadx = 0;
gridBagConstraints.ipady = 0;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new Insets(0, 0, 0, 0);
gridBagConstraints.gridx = 0;
this.setLayout(new GridBagLayout());
this.setSize(421, 239);
this.add(getJTabbedPane(), gridBagConstraints);
}
示例8: addFakeButton
private void addFakeButton () {
/* i don't know a better workaround */
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.gridy = 0;
pCategories2.add (new javax.swing.JLabel (""), gbc);
}
示例9: getPlotter
/**
* Returns this. Subclasses which do not want to use this object (JPanel) for plotting should
* directly implement {@link Plotter}.
*/
@Override
public JComponent getPlotter() {
if (this.plotpanel == null) {
this.plotpanel = createPlotPanel();
if (hasLegend()) {
this.plotpanel.addLegend(LEGEND_POSITION);
}
GridBagLayout layout = new GridBagLayout();
this.setLayout(layout);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
if (hasRapidMinerValueLegend()) {
legend = new PlotterLegend(this);
c.weighty = 0;
JPanel legendPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
legendPanel.setBackground(Color.white);
legendPanel.add(legend);
layout.setConstraints(legendPanel, c);
add(legendPanel);
}
c.weighty = 1;
layout.setConstraints(plotpanel, c);
add(plotpanel);
}
return this;
}
示例10: SettingsPanel
public SettingsPanel(MainPanel r) {
this.mainP = r;
initializeComponents();
addActionListeners();
setSource(mainP.getAnimation().getSource());
setOpaque(false);
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.weightx = 1;
gbc.weighty = 0;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.BOTH;
add(gifFrameWrap, gbc);
gbc.gridy++;
add(animateBox, gbc);
gbc.gridy++;
add(animationControlP, gbc);
gbc.gridy++;
add(channelBox, gbc);
gbc.gridy++;
gbc.weighty = 1;
add(cardPanel, gbc);
gbc.gridy++;
gbc.weighty = 0;
add(saveButton, gbc);
}
示例11: PrintPageSetupJPanel
public PrintPageSetupJPanel(PrintJDialog objPprintJDialog, ControlJFrame objPcontrolJFrame) {
// Create widgets :
this.objGprintMarginsSubJPanel = new PrintMarginsSubJPanel(objPprintJDialog);
this.objGprintMediaSubJPanel = new PrintMediaSubJPanel(objPprintJDialog, this.objGprintMarginsSubJPanel);
this.objGprintOrientationSubJPanel = new PrintOrientationSubJPanel(objPprintJDialog, objPcontrolJFrame, this.objGprintMarginsSubJPanel);
// Add widgets :
this.setOpaque(true);
this.setLayout(new GridBagLayout());
final ExtendedGridBagConstraints objLextendedGridBagConstraints =
new ExtendedGridBagConstraints( 0,
0,
2,
1,
GridBagConstraints.CENTER,
6,
6,
6,
6,
GridBagConstraints.BOTH,
1.0F,
1.0F);
this.add(this.objGprintMediaSubJPanel, objLextendedGridBagConstraints);
objLextendedGridBagConstraints.setGridBounds(GridBagConstraints.RELATIVE, 1, 1, 1);
this.add(this.objGprintOrientationSubJPanel, objLextendedGridBagConstraints);
this.add(this.objGprintMarginsSubJPanel, objLextendedGridBagConstraints);
}
示例12: initializePanels
private void initializePanels(){
/* PANELFIRST INITIALIZATION */
this.panelFirst = new JPanel();
this.panelFirst.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
GridBagConstraints gbc_panel = new GridBagConstraints();
gbc_panel.fill = GridBagConstraints.BOTH;
gbc_panel.insets = new Insets(0, 0, 5, 0);
gbc_panel.gridx = 0;
gbc_panel.gridy = 0;
this.contentPane.add(this.panelFirst, gbc_panel);
GridBagLayout gbl_panel = new GridBagLayout();
gbl_panel.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0};
gbl_panel.rowHeights = new int[]{0, 0, 0, 0};
gbl_panel.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
this.panelFirst.setLayout(gbl_panel);
Component verticalStrut_1 = Box.createVerticalStrut(20);
GridBagConstraints gbc_verticalStrut_1 = new GridBagConstraints();
gbc_verticalStrut_1.insets = new Insets(0, 0, 5, 5);
gbc_verticalStrut_1.gridx = 5;
gbc_verticalStrut_1.gridy = 0;
this.panelFirst.add(verticalStrut_1, gbc_verticalStrut_1);
Component horizontalStrut = Box.createHorizontalStrut(20);
GridBagConstraints gbc_horizontalStrut = new GridBagConstraints();
gbc_horizontalStrut.insets = new Insets(0, 0, 5, 5);
gbc_horizontalStrut.gridx = 0;
gbc_horizontalStrut.gridy = 1;
this.panelFirst.add(horizontalStrut, gbc_horizontalStrut);
/* END PANELFIRST INITIALIZATION */
/* PANELSECOND INITIALIZATION */
this.panelSecond = new JPanel();
this.panelSecond.setSize(282, 300);
GridBagConstraints gbc_panel_1 = new GridBagConstraints();
gbc_panel_1.anchor = GridBagConstraints.NORTH;
gbc_panel_1.fill = GridBagConstraints.HORIZONTAL;
gbc_panel_1.gridx = 0;
gbc_panel_1.gridy = 1;
this.contentPane.add(this.panelSecond, gbc_panel_1);
GridBagLayout gbl_panel_1 = new GridBagLayout();
gbl_panel_1.columnWidths = new int[]{60, 77, 0};
gbl_panel_1.rowHeights = new int[]{36, 0, 0, 0, 0, 0, 0, 0, 15, 0};
gbl_panel_1.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
gbl_panel_1.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
this.panelSecond.setLayout(gbl_panel_1);
Component verticalStrut = Box.createVerticalStrut(20);
GridBagConstraints gbc_verticalStrut = new GridBagConstraints();
gbc_verticalStrut.insets = new Insets(0, 0, 5, 0);
gbc_verticalStrut.gridx = 1;
gbc_verticalStrut.gridy = 3;
this.panelSecond.add(verticalStrut, gbc_verticalStrut);
Component verticalStrut_2 = Box.createVerticalStrut(20);
GridBagConstraints gbc_verticalStrut_2 = new GridBagConstraints();
gbc_verticalStrut_2.insets = new Insets(0, 0, 5, 0);
gbc_verticalStrut_2.gridx = 1;
gbc_verticalStrut_2.gridy = 4;
this.panelSecond.add(verticalStrut_2, gbc_verticalStrut_2);
/* END PANELSECOND INITIALIZATION */
}
示例13: KeHuChaXun
public KeHuChaXun() {
super();
setIconifiable(true);
setClosable(true);
setTitle("�ͻ���Ϣ��ѯ");
getContentPane().setLayout(new GridBagLayout());
setBounds(100, 100, 640, 375);
table = new JTable();
table.setEnabled(false);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
String[] tableHeads = new String[]{"�ͻ�ID", "�ͻ�ȫ��", "�ͻ���ַ", "�ͻ����",
"��������", "�硡����", "��������", "�� ϵ ��", "��ϵ�綽", "E-Mail", "��������",
"�����˺�"};
final DefaultTableModel dftm = (DefaultTableModel) table.getModel();
dftm.setColumnIdentifiers(tableHeads);
final JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setAutoscrolls(true);
final GridBagConstraints gridBagConstraints_6 = new GridBagConstraints();
gridBagConstraints_6.weighty = 1.0;
gridBagConstraints_6.insets = new Insets(0, 10, 5, 10);
gridBagConstraints_6.fill = GridBagConstraints.BOTH;
gridBagConstraints_6.gridwidth = 6;
gridBagConstraints_6.gridy = 1;
gridBagConstraints_6.gridx = 0;
getContentPane().add(scrollPane, gridBagConstraints_6);
setupComponet(new JLabel(" ѡ���ѯ������"), 0, 0, 1, 1, false);
conditionBox1 = new JComboBox();
conditionBox1.setModel(new DefaultComboBoxModel(new String[]{"�ͻ�ȫ��",
"�ͻ����"}));
setupComponet(conditionBox1, 1, 0, 1, 30, true);
conditionBox2 = new JComboBox();
conditionBox2.setModel(new DefaultComboBoxModel(
new String[]{"����", "����"}));
setupComponet(conditionBox2, 2, 0, 1, 30, true);
conditionContent = new JTextField();
setupComponet(conditionContent, 3, 0, 1, 140, true);
final JButton queryButton = new JButton();
queryButton.addActionListener(new queryAction(dftm));
queryButton.setText("��ѯ");
setupComponet(queryButton, 4, 0, 1, 1, false);
showAllButton = new JButton();
showAllButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
conditionContent.setText("");
List list = Dao.getKhInfos();
updateTable(list, dftm);
}
});
setupComponet(showAllButton, 5, 0, 1, 1, false);
showAllButton.setText("��ʾȫ������");
}
示例14: createEntriesPanel
/** Updates the contents of the entries panel. */
private JPanel createEntriesPanel() {
GridBagLayout layout = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
JPanel entriesPanel = new JPanel();
entriesPanel.setLayout(layout);
List<String> keys = new ArrayList<>(map.getAll().keySet());
Collections.sort(keys);
boolean alternatingRow = true;
for (String key : keys) {
IOObject object = map.get(key);
if (object == null) {
// do not display empty results
continue;
}
// look up icon
Icon icon = RendererService.getIcon(object.getClass());
if (icon == null) {
icon = UNKNOWN_TYPE;
}
// look up name
String type = RendererService.getName(object.getClass());
if (type == null) {
type = object.getClass().getSimpleName();
}
Action removeAction = new RemoveCacheEntryAction(map, key);
Action openAction = new OpenCacheEntryAction(map, key);
IOObjectCacheEntryPanel entry = new IOObjectCacheEntryPanel(icon, type, openAction, removeAction);
if (alternatingRow) {
entry.setDefaultBackground(Colors.WHITE);
}
alternatingRow = !alternatingRow;
entriesPanel.add(entry, gbc);
gbc.gridy += 1;
}
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
entriesPanel.add(Box.createVerticalGlue(), gbc);
return entriesPanel;
}
示例15: ExpressionTab
public ExpressionTab(AnalyzerModel model) {
this.model = model;
selector = new OutputSelector(model);
model.getOutputExpressions().addOutputExpressionsListener(myListener);
selector.addItemListener(myListener);
clear.addActionListener(myListener);
revert.addActionListener(myListener);
enter.addActionListener(myListener);
field.setLineWrap(true);
field.setWrapStyleWord(true);
field.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), myListener);
field.getDocument().addDocumentListener(myListener);
field.setFont(new Font("sans serif", Font.PLAIN, 14));
JPanel buttons = new JPanel();
buttons.add(clear);
buttons.add(revert);
buttons.add(enter);
GridBagLayout gb = new GridBagLayout();
GridBagConstraints gc = new GridBagConstraints();
setLayout(gb);
gc.weightx = 1.0;
gc.gridx = 0;
gc.gridy = GridBagConstraints.RELATIVE;
gc.fill = GridBagConstraints.BOTH;
JPanel selectorPanel = selector.createPanel();
gb.setConstraints(selectorPanel, gc);
add(selectorPanel);
gb.setConstraints(prettyView, gc);
add(prettyView);
gc.insets = new Insets(10, 10, 0, 10);
JScrollPane fieldPane = new JScrollPane(field, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
gb.setConstraints(fieldPane, gc);
add(fieldPane);
gb.setConstraints(buttons, gc);
add(buttons);
gc.fill = GridBagConstraints.BOTH;
gb.setConstraints(error, gc);
add(error);
myListener.insertUpdate(null);
setError(null);
}