GridBagLayout layout = new GridBagLayout(); GridBagConstraints cons = new GridBagConstraints(); //set the constraints properties layout.addLayoutComponent(JProgressBar, cons);
GridBagLayout layout = new GridBagLayout(); GridBagConstraints cons = new GridBagConstraints(); layout.addLayoutComponent(Component, cons);
/** * {@inheritDoc} */ @Override protected LayoutManager createDetailPanelLayout() { GridBagLayout layout = new GridBagLayout(); layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0)); copyToClipboardButton.setVisible(false); return layout; }
/** * {@inheritDoc} */ @Override protected LayoutManager createDetailPanelLayout() { GridBagLayout layout = new GridBagLayout(); layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0)); copyToClipboardButton.setVisible(false); return layout; }
/** * {@inheritDoc} */ protected LayoutManager createDetailPanelLayout() { GridBagLayout layout = new GridBagLayout(); layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0)); copyToClipboardButton.setVisible(false); return layout; }
/** * {@inheritDoc} */ @Override protected LayoutManager createDetailPanelLayout() { GridBagLayout layout = new GridBagLayout(); layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0)); copyToClipboardButton.setVisible(false); return layout; }
/** * {@inheritDoc} */ @Override protected LayoutManager createDetailPanelLayout() { GridBagLayout layout = new GridBagLayout(); layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,0,0,0),0,0)); copyToClipboardButton.setVisible(false); return layout; }
protected LayoutManager createDetailPanelLayout() { GridBagLayout layout = new GridBagLayout(); layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,0,0,0),0,0)); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = 1; gbc.gridx = 0; gbc.gridy = 1; gbc.weighty = 0.0; gbc.weightx = 1.0; gbc.insets = new Insets(6, 0, 6, 0); layout.addLayoutComponent(copyToClipboardButton, gbc); return layout; }
protected LayoutManager createDetailPanelLayout() { GridBagLayout layout = new GridBagLayout(); layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,0,0,0),0,0)); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = 1; gbc.gridx = 0; gbc.gridy = 1; gbc.weighty = 0.0; gbc.weightx = 1.0; gbc.insets = new Insets(6, 0, 6, 0); layout.addLayoutComponent(copyToClipboardButton, gbc); return layout; }
protected LayoutManager createDetailPanelLayout() { GridBagLayout layout = new GridBagLayout(); layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,0,0,0),0,0)); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = 1; gbc.gridx = 0; gbc.gridy = 1; gbc.weighty = 0.0; gbc.weightx = 1.0; gbc.insets = new Insets(6, 0, 6, 0); layout.addLayoutComponent(copyToClipboardButton, gbc); return layout; }
protected LayoutManager createDetailPanelLayout() { GridBagLayout layout = new GridBagLayout(); layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,0,0,0),0,0)); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = 1; gbc.gridx = 0; gbc.gridy = 1; gbc.weighty = 0.0; gbc.weightx = 1.0; gbc.insets = new Insets(6, 0, 6, 0); layout.addLayoutComponent(copyToClipboardButton, gbc); return layout; }
protected LayoutManager createDetailPanelLayout() { GridBagLayout layout = new GridBagLayout(); layout.addLayoutComponent(detailsScrollPane, new GridBagConstraints(0,0,1,1,1.0,1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6,0,0,0),0,0)); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = 1; gbc.gridx = 0; gbc.gridy = 1; gbc.weighty = 0.0; gbc.weightx = 1.0; gbc.insets = new Insets(6, 0, 6, 0); layout.addLayoutComponent(copyToClipboardButton, gbc); return layout; }
/** * Binds a name in the layout to the specified component. If the name is not * defined in the layout an error message will be send to System.err * * @param name The name in the layout to bind the component to * @param comp The component to bind to the specified name. */ @Override public void addLayoutComponent(String name, Component comp) { GridBagConstraints constraint = (GridBagConstraints) constraints .get(name); if (constraint != null) { layout.addLayoutComponent(comp, constraint); } else { System.err .println("(XMLGridLayout) No constraint defined for name " + name); } }
/** * Binds a name in the layout to the specified component. If the name is not * defined in the layout an error message will be send to System.err * * @param name The name in the layout to bind the component to * @param comp The component to bind to the specified name. */ @Override public void addLayoutComponent(String name, Component comp) { GridBagConstraints constraint = (GridBagConstraints) constraints .get(name); if (constraint != null) { layout.addLayoutComponent(comp, constraint); } else { System.err .println("(XMLGridLayout) No constraint defined for name " + name); } }
/** * {@inheritDoc} */ @Override protected LayoutManager createErrorPaneLayout() { createExtraComponents(); GridBagLayout layout = new GridBagLayout(); try { layout.addLayoutComponent(iconLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 17), 0, 0)); layout.addLayoutComponent(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 12, 0), 0 ,0)); layout.addLayoutComponent(errorScrollPane,new GridBagConstraints(1, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 10, 0), 0, 0)); layout.addLayoutComponent(detailButton, new GridBagConstraints(0, 2, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 6, 0), 0, 0)); layout.addLayoutComponent(detailsPanel, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 6, 0), 0 ,0)); layout.addLayoutComponent(disclaimerText, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0)); layout.addLayoutComponent(closeButton, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0)); layout.addLayoutComponent(reportButton, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } catch (Exception e) { e.printStackTrace(); } return layout; }
/** * {@inheritDoc} */ @Override protected LayoutManager createErrorPaneLayout() { createExtraComponents(); GridBagLayout layout = new GridBagLayout(); try { layout.addLayoutComponent(iconLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 17), 0, 0)); layout.addLayoutComponent(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 12, 0), 0 ,0)); layout.addLayoutComponent(errorScrollPane,new GridBagConstraints(1, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 10, 0), 0, 0)); layout.addLayoutComponent(detailButton, new GridBagConstraints(0, 2, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 6, 0), 0, 0)); layout.addLayoutComponent(detailsPanel, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 6, 0), 0 ,0)); layout.addLayoutComponent(disclaimerText, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0)); layout.addLayoutComponent(closeButton, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0)); layout.addLayoutComponent(reportButton, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } catch (Exception e) { e.printStackTrace(); } return layout; }
/** * {@inheritDoc} */ @Override protected LayoutManager createErrorPaneLayout() { createExtraComponents(); GridBagLayout layout = new GridBagLayout(); try { layout.addLayoutComponent(iconLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 17), 0, 0)); layout.addLayoutComponent(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 12, 0), 0 ,0)); layout.addLayoutComponent(errorScrollPane,new GridBagConstraints(1, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 10, 0), 0, 0)); layout.addLayoutComponent(detailButton, new GridBagConstraints(0, 2, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 6, 0), 0, 0)); layout.addLayoutComponent(detailsPanel, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 6, 0), 0 ,0)); layout.addLayoutComponent(disclaimerText, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0)); layout.addLayoutComponent(closeButton, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0)); layout.addLayoutComponent(reportButton, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } catch (Exception e) { e.printStackTrace(); } return layout; }
public void addLayoutComponent(Component component, Object constraints) { if (constraints instanceof String) { constraints = getGridBagConstraints((String)constraints); if (constraints == null) { usage(); constraints = new GridBagConstraints(); System.err.println("Using Default GridBagConstraints."); } } super.addLayoutComponent(component, constraints); }
public void addLayoutComponent(Component component, Object constraints) { if (constraints instanceof String) { constraints = getGridBagConstraints((String)constraints); if (constraints == null) { usage(); constraints = new GridBagConstraints(); System.err.println("Using Default GridBagConstraints."); } } super.addLayoutComponent(component, constraints); }
public static void addToGridBag(final Component comp, final JPanel panel, final int gridx, final int gridy, final int width, final int height, final int anchor, final int padding, final double weightx, final double weighty, final int fill) { LayoutManager layout = panel.getLayout(); if (!(layout instanceof GridBagLayout)) { layout = new GridBagLayout(); panel.setLayout(layout); } final GridBagLayout gridBagLayout = (GridBagLayout) layout; final GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = gridx; constraints.gridy = gridy; constraints.gridwidth = width; constraints.gridheight = height; constraints.weightx = weightx; constraints.weighty = weighty; constraints.anchor = anchor; constraints.fill = fill; constraints.insets = new Insets(padding, padding, padding, padding); gridBagLayout.addLayoutComponent(comp, constraints); panel.add(comp); }