List of usage examples for java.awt GridBagConstraints REMAINDER
int REMAINDER
To view the source code for java.awt GridBagConstraints REMAINDER.
Click Source Link
From source file:com.excilys.ebi.gatling.recorder.ui.component.RunningFrame.java
public RunningFrame() { /* Initialization of the frame */ setTitle("Gatling Recorder - Running..."); setMinimumSize(new Dimension(800, 640)); setLocationRelativeTo(null);//w w w . j av a 2s. com setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); setIconImages(Commons.getIconList()); /* Declaration & initialization of components */ JButton btnClear = new JButton("Clear"); final JButton btnStop = new JButton("Stop !"); btnStop.setSize(120, 30); JScrollPane panelFilters = new JScrollPane(executedEvents); panelFilters.setPreferredSize(new Dimension(300, 100)); stringRequest.setPreferredSize(new Dimension(330, 100)); JSplitPane requestResponsePane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(stringRequest), new JScrollPane(stringResponse)); final JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, requestResponsePane, stringRequestBody); JScrollPane panelHostsCertificate = new JScrollPane(requiredHostsCertificate); panelHostsCertificate.setPreferredSize(new Dimension(300, 100)); /* Layout */ GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(10, 5, 0, 0); gbc.gridx = 0; gbc.anchor = GridBagConstraints.LINE_START; gbc.gridy = 0; add(new JLabel("Tag :"), gbc); gbc.gridx = 1; add(txtTag, gbc); gbc.gridx = 2; gbc.weightx = 0.5; add(btnTag, gbc); gbc.gridx = 3; gbc.anchor = GridBagConstraints.CENTER; gbc.weightx = 0.25; add(btnClear, gbc); gbc.gridx = 4; gbc.anchor = GridBagConstraints.LINE_END; add(btnStop, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.weightx = 0; gbc.anchor = GridBagConstraints.LINE_START; gbc.gridwidth = GridBagConstraints.REMAINDER; add(new JLabel("Executed Events:"), gbc); gbc.gridy = 2; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1; gbc.weighty = 0.20; gbc.fill = GridBagConstraints.BOTH; add(panelFilters, gbc); gbc.gridy = 4; gbc.weightx = 1; gbc.weighty = 0.75; gbc.fill = GridBagConstraints.BOTH; add(sp, gbc); gbc.gridy = 5; gbc.weighty = 0; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.anchor = GridBagConstraints.CENTER; add(new JLabel("Secured hosts requiring accepting a certificate:"), gbc); gbc.gridy = 6; gbc.weighty = 0.05; gbc.gridwidth = GridBagConstraints.REMAINDER; add(panelHostsCertificate, gbc); /* Listeners */ btnTag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!txtTag.getText().equals(EMPTY)) { TagEvent tag = new TagEvent(txtTag.getText()); events.addElement(tag.toString()); executedEvents.ensureIndexIsVisible(events.getSize() - 1); listEvents.add(tag); txtTag.setText(EMPTY); } } }); executedEvents.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (executedEvents.getSelectedIndex() >= 0) { Object obj = listEvents.get(executedEvents.getSelectedIndex()); if (obj instanceof ResponseReceivedEvent) { ResponseReceivedEvent event = (ResponseReceivedEvent) obj; stringRequest.txt.setText(event.getRequest().toString()); stringResponse.txt.setText(event.getResponse().toString()); stringRequestBody.txt.setText(new String(event.getRequest().getContent().array())); } else { stringRequest.txt.setText(EMPTY); stringResponse.txt.setText(EMPTY); stringRequestBody.txt.setText(EMPTY); } } } }); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clearOldRunning(); } }); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveScenario(); proxy.shutdown(); proxy = null; if (!Configuration.getInstance().isConfigurationSkipped()) getEventBus().post(new ShowConfigurationFrameEvent()); else System.exit(0); } }); }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java
private GridBagConstraints constraintsForSecondColumnCheckbox() { GridBagConstraints gbc;/*from ww w . j a v a 2 s . c o m*/ gbc = new java.awt.GridBagConstraints(); gbc.gridx = 1; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets = new Insets(INNER_GAP, INDENT, 0, 0); gbc.anchor = GridBagConstraints.LINE_START; return gbc; }
From source file:com.intel.stl.ui.monitor.view.PSNodesDetailsPanel.java
/** * Description:/*ww w.ja va2 s .c o m*/ * * @param name */ protected void initComponent() { setLayout(new BorderLayout(0, 0)); setOpaque(false); setBorder(BorderFactory.createTitledBorder((Border) null)); JPanel titlePanel = new JPanel(new BorderLayout(5, 1)); titlePanel.setOpaque(false); numberLabel = ComponentFactory.getH1Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN); numberLabel.setHorizontalAlignment(JLabel.RIGHT); titlePanel.add(numberLabel, BorderLayout.CENTER); nameLabel = ComponentFactory.getH3Label("", Font.PLAIN); nameLabel.setHorizontalAlignment(JLabel.LEFT); nameLabel.setVerticalAlignment(JLabel.BOTTOM); titlePanel.add(nameLabel, BorderLayout.EAST); add(titlePanel, BorderLayout.NORTH); JPanel mainPanel = new JPanel(); mainPanel.setOpaque(false); mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); GridBagLayout gridBag = new GridBagLayout(); mainPanel.setLayout(gridBag); GridBagConstraints gc = new GridBagConstraints(); gc.weighty = 0; gc.insets = new Insets(8, 2, 2, 2); gc.weightx = 1; gc.gridwidth = 1; gc.gridheight = 2; // gc.gridheight = 3; // Should change to 3 if we add Route typeChartPanel = new ChartPanel(null); typeChartPanel.setPreferredSize(new Dimension(80, 60)); mainPanel.add(typeChartPanel, gc); gc.fill = GridBagConstraints.BOTH; gc.insets = new Insets(12, 2, 2, 2); gc.weightx = 0; gc.gridheight = 1; swNumberLabel = createNumberLabel(); mainPanel.add(swNumberLabel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; swNameLabel = createNameLabel(STLConstants.K0048_SWITCHES.getValue()); mainPanel.add(swNameLabel, gc); gc.insets = new Insets(2, 2, 6, 2); gc.gridwidth = 1; fiNumberLabel = createNumberLabel(); mainPanel.add(fiNumberLabel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; fiNameLabel = createNameLabel(STLConstants.K0052_HOSTS.getValue()); mainPanel.add(fiNameLabel, gc); // gc.gridwidth = 1; // rtNumberLabel = ComponentFactory.getH4Label( // STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN); // rtNumberLabel.setHorizontalAlignment(JLabel.CENTER); // mainPanel.add(rtNumberLabel, gc); // // gc.gridwidth = GridBagConstraints.REMAINDER; // rtNameLabel = ComponentFactory.getH5Label( // STLConstants.K0050_ROUTERS.getValue(), Font.PLAIN); // rtNameLabel.setVerticalAlignment(JLabel.BOTTOM); // mainPanel.add(rtNameLabel, gc); add(mainPanel, BorderLayout.CENTER); JPanel bottomPanel = new JPanel(new GridBagLayout()); bottomPanel.setOpaque(false); bottomPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIConstants.INTEL_BORDER_GRAY)); gc = new GridBagConstraints(); gc.insets = new Insets(0, 5, 1, 5); gc.fill = GridBagConstraints.BOTH; gc.weightx = 1; gc.gridheight = 2; otherPortsLabel = ComponentFactory.getH1Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN); otherPortsLabel.setForeground(UIConstants.INTEL_GRAY); otherPortsLabel.setHorizontalAlignment(JLabel.RIGHT); bottomPanel.add(otherPortsLabel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; gc.gridheight = 1; gc.weightx = 0; gc.weighty = 1; JLabel label = ComponentFactory.getH4Label(STLConstants.K1026_PORT_RESOURCE.getValue(), Font.PLAIN); label.setHorizontalAlignment(JLabel.LEFT); label.setVerticalAlignment(JLabel.BOTTOM); bottomPanel.add(label, gc); gc.weighty = 0; label = ComponentFactory.getH4Label(STLConstants.K2077_NOT_IN_FABRIC.getValue(), Font.PLAIN); label.setHorizontalAlignment(JLabel.LEFT); label.setVerticalAlignment(JLabel.BOTTOM); bottomPanel.add(label, gc); add(bottomPanel, BorderLayout.SOUTH); }
From source file:org.ut.biolab.medsavant.client.view.list.MasterView.java
public MasterView(String page, DetailedListModel model, DetailedView view, DetailedListEditor editor) { pageName = page;/*from w ww. j a v a2 s . c o m*/ detailedModel = model; detailedView = view; detailedEditor = editor; setLayout(new CardLayout()); WaitPanel wp = new WaitPanel("Getting list"); wp.setBackground(ViewUtil.getTertiaryMenuColor()); add(wp, CARD_WAIT); showCard = new JPanel(); add(showCard, CARD_SHOW); JPanel errorPanel = new JPanel(); errorPanel.setLayout(new BorderLayout()); errorMessage = new JLabel("An error occurred:"); errorPanel.add(errorMessage, BorderLayout.NORTH); add(errorPanel, CARD_ERROR); buttonPanel = ViewUtil.getClearPanel(); buttonPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = GridBagConstraints.RELATIVE; gbc.gridy = 0; gbc.insets = new Insets(3, 3, 3, 3); if (detailedEditor.doesImplementAdding()) { JLabel butt = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.ADD_ON_TOOLBAR)); butt.setToolTipText("Add"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { detailedEditor.addItems(); // In some cases, such as uploading/publishing variants, the addItems() method may have logged us out. if (LoginController.getInstance().isLoggedIn()) { refreshList(); } } }); buttonPanel.add(butt, gbc); } if (detailedEditor.doesImplementImporting()) { JLabel butt = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.IMPORT)); butt.setToolTipText("Import"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { detailedEditor.importItems(); refreshList(); } }); buttonPanel.add(butt, gbc); } if (detailedEditor.doesImplementExporting()) { JLabel butt = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.EXPORT)); butt.setToolTipText("Export"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { detailedEditor.exportItems(); refreshList(); } }); buttonPanel.add(butt, gbc); } if (detailedEditor.doesImplementDeleting()) { JLabel butt = ViewUtil.createIconButton( IconFactory.getInstance().getIcon(IconFactory.StandardIcon.REMOVE_ON_TOOLBAR)); butt.setToolTipText("Remove selected"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { detailedEditor.deleteItems(selectionGrabber.getSelectedItems()); // In some cases, such as removing/publishing variants, the deleteItems() method may have logged us out. if (LoginController.getInstance().isLoggedIn()) { refreshList(); } } }); buttonPanel.add(butt, gbc); } if (detailedEditor.doesImplementEditing()) { JLabel butt = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.EDIT)); butt.setToolTipText("Edit selected"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (selectionGrabber.getSelectedItems().size() > 0) { detailedEditor.editItem(selectionGrabber.getSelectedItems().get(0)); refreshList(); } else { DialogUtils.displayMessage("Please choose one item to edit."); } } }); buttonPanel.add(butt, gbc); } // Only for SavedFiltersPanel if (detailedEditor.doesImplementLoading()) { JLabel butt = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.LOAD_ON_TOOLBAR)); butt.setToolTipText("Load selected"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { detailedEditor.loadItems(selectionGrabber.getSelectedItems()); } }); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.anchor = GridBagConstraints.EAST; buttonPanel.add(butt, gbc); } showWaitCard(); fetchList(); }
From source file:de.codesourcery.threadwatcher.ui.StatisticsPanel.java
public StatisticsPanel(FileReader reader) { this.reader = reader; table.setDefaultRenderer(TableEntry.class, new CellRenderer()); table.addMouseMotionListener(mouseListener); table.setBackground(Color.WHITE); table.setFillsViewportHeight(true);/* w w w. jav a 2 s. co m*/ setLayout(new GridBagLayout()); GridBagConstraints cnstrs = new GridBagConstraints(); cnstrs.gridheight = GridBagConstraints.REMAINDER; cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.fill = GridBagConstraints.BOTH; cnstrs.weightx = 1.0; cnstrs.weighty = 1.0; JScrollPane pane = new JScrollPane(table); pane.setBackground(Color.WHITE); add(pane, cnstrs); }
From source file:org.executequery.gui.ExecuteProcedurePanel.java
private void init() throws Exception { tableModel = new ParameterTableModel(); table = new DefaultTable(tableModel); table.getTableHeader().setReorderingAllowed(false); table.setCellSelectionEnabled(true); table.setColumnSelectionAllowed(false); table.setRowSelectionAllowed(false); connectionsCombo = WidgetFactory.createComboBox(); schemaCombo = WidgetFactory.createComboBox(); combosGroup = new TableSelectionCombosGroup(connectionsCombo, schemaCombo, null); combosGroup.addItemSelectionListener(this); objectTypeCombo = WidgetFactory.createComboBox(createAvailableObjectTypes()); objectTypeCombo.setToolTipText("Select the database object type"); objectTypeCombo.addItemListener(this); proceduresModel = new DynamicComboBoxModel(); procedureCombo = WidgetFactory.createComboBox(proceduresModel); procedureCombo.setActionCommand("procedureSelectionChanged"); procedureCombo.setToolTipText("Select the database object name"); procedureCombo.addActionListener(this); JPanel base = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 7, 5, 8); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.BOTH; gbc.gridy++;// w ww . j a v a 2 s.c o m base.add(new JLabel("Connection:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.insets.left = 0; base.add(connectionsCombo, gbc); gbc.gridx = 0; gbc.weightx = 0; gbc.gridy++; gbc.insets.left = 7; gbc.insets.top = 0; base.add(new JLabel("Schema:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.insets.left = 0; base.add(schemaCombo, gbc); gbc.gridx = 0; gbc.weightx = 0; gbc.gridy++; gbc.insets.left = 7; gbc.insets.top = 0; base.add(new JLabel("Object Type:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.insets.left = 0; base.add(objectTypeCombo, gbc); gbc.gridx = 0; gbc.weightx = 0; gbc.gridy++; gbc.insets.left = 7; base.add(new JLabel("Object Name:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.insets.left = 0; base.add(procedureCombo, gbc); resultsPanel = new QueryEditorResultsPanel(); JPanel resultsBase = new JPanel(new BorderLayout()); resultsBase.add(resultsPanel, BorderLayout.CENTER); JSplitPane splitPane = new SplitPaneFactory().create(JSplitPane.VERTICAL_SPLIT, new JScrollPane(table), resultsBase); splitPane.setResizeWeight(0.5); splitPane.setDividerLocation(0.75); splitPane.setDividerSize(5); gbc.gridy++; gbc.gridx = 0; gbc.weighty = 1.0; gbc.insets.left = 7; gbc.gridwidth = GridBagConstraints.REMAINDER; base.add(splitPane, gbc); JButton executeButton = ActionUtilities.createButton(this, "Execute", "execute"); gbc.gridy++; gbc.weighty = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; gbc.insets.top = 0; gbc.insets.bottom = 20; base.add(executeButton, gbc); base.setBorder(BorderFactory.createEtchedBorder()); setBorder(BorderFactory.createEmptyBorder(5, 5, 7, 5)); add(base, BorderLayout.CENTER); EventMediator.registerListener(this); connectionSelectionMade(); }
From source file:org.intermine.install.swing.CreatePropertiesDialog.java
/** * Common initialisation: lays out the child components and wires up the necessary * event listeners. /*from w ww . ja v a 2s. c om*/ */ private void init() { setName("Create Properties Dialog"); setTitle(Messages.getMessage("mineinfo.title")); setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); Container cp = getContentPane(); GridBagConstraints cons = GridBagHelper.setup(cp); cons.weightx = 1; cons.gridwidth = GridBagConstraints.REMAINDER; cp.add(new JLabel(Messages.getMessage("properties.project.header")), cons); cons.weightx = 0; cons.gridwidth = 1; cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.project.title")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.project.subtitle")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.project.releaseversion")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.project.siteprefix")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.project.helplocation")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.project.feedback")), cons); cons.gridy++; cons.weightx = 1; cons.gridwidth = GridBagConstraints.REMAINDER; cp.add(new JLabel(Messages.getMessage("properties.webapp.header")), cons); cons.gridy++; cons.weightx = 0; cons.gridwidth = 1; cp.add(new JLabel(Messages.getMessage("properties.webapp.deploy")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.webapp.path")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.webapp.baseurl")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.webapp.manager")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.webapp.manager.password")), cons); cons.gridy++; cons.weightx = 1; cons.gridwidth = GridBagConstraints.REMAINDER; cp.add(new JLabel(Messages.getMessage("properties.mail.header")), cons); cons.gridy++; cons.weightx = 0; cons.gridwidth = 1; cp.add(new JLabel(Messages.getMessage("properties.mail.host")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.mail.from")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.mail.subject")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.mail.text")), cons); cons.gridy++; cons.weightx = 1; cons.gridwidth = GridBagConstraints.REMAINDER; cp.add(new JLabel(Messages.getMessage("properties.superuser.header")), cons); cons.gridy++; cons.weightx = 0; cons.gridwidth = 1; cp.add(new JLabel(Messages.getMessage("properties.superuser")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("properties.superuser.password")), cons); cons.gridy++; cons.weightx = 1; cons.gridwidth = GridBagConstraints.REMAINDER; cp.add(new JLabel(Messages.getMessage("properties.misc.header")), cons); cons.gridy++; cp.add(verboseLogCheck, cons); // Record the next free row for the button panel. int rowIndex = cons.gridy + 1; cons.gridx++; cons.gridy = 1; cons.weightx = 1; cons.gridwidth = 1; cp.add(titleField, cons); cons.gridy++; cp.add(subtitleField, cons); cons.gridy++; cp.add(versionField, cons); cons.gridy++; cp.add(prefixField, cons); cons.gridy++; cp.add(helpField, cons); cons.gridy++; cp.add(feedbackField, cons); cons.gridy += 2; cp.add(webDeployUrlField, cons); cons.gridy++; cp.add(webPathField, cons); cons.gridy++; cp.add(webBaseUrlField, cons); cons.gridy++; cp.add(webManagerField, cons); cons.gridy++; cp.add(webPasswordField, cons); cons.gridy += 2; cp.add(mailHostField, cons); cons.gridy++; cp.add(mailFromField, cons); cons.gridy++; cp.add(mailSubjectField, cons); cons.gridy++; cp.add(mailTextField, cons); cons.gridy += 2; cp.add(superuserField, cons); cons.gridy++; cp.add(superuserPasswordField, cons); cons.gridy = rowIndex; cons.gridx = 0; cons.gridwidth = GridBagConstraints.REMAINDER; cons.weightx = 1.0; cp.add(new ButtonPanel(getRootPane(), 0, nextAction, new CancelAction()), cons); standardBackground = webBaseUrlField.getBackground(); errorBackground = new Color(255, 232, 232); verboseLogCheck.setToolTipText(Messages.getMessage("properties.misc.verboselog.tooltip")); new EmailFieldListener(superuserField, true); new EmailFieldListener(mailFromField, true); new EmailFieldListener(feedbackField, true); new UrlFieldListener(webDeployUrlField, false); new UrlFieldListener(webBaseUrlField, false); new UrlFieldListener(prefixField, false); new UrlFieldListener(helpField, true); pack(); }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java
private GridBagConstraints constraintsForGroupLabel(boolean first) { GridBagConstraints gbc = new java.awt.GridBagConstraints(); gbc.gridx = 0;/*from w w w. j a v a 2s.co m*/ gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = (first) ? new Insets(OUTER_GAP, OUTER_GAP, 0, OUTER_GAP) : new Insets(GROUP_SPACE, OUTER_GAP, 0, OUTER_GAP); return gbc; }
From source file:com.intel.stl.ui.monitor.view.PSPortsDetailsPanel.java
protected JPanel createDeviceTypePanel() { JPanel panel = new JPanel(); panel.setOpaque(false);/*from w w w .j a v a2 s .c om*/ panel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); GridBagLayout gridBag = new GridBagLayout(); panel.setLayout(gridBag); GridBagConstraints gc = new GridBagConstraints(); gc.insets = new Insets(8, 2, 2, 2); gc.weighty = 0; gc.weightx = 1; gc.gridwidth = GridBagConstraints.REMAINDER; gc.gridheight = 1; deviceTypeChartPanel = new ChartPanel(null); deviceTypeChartPanel.setPreferredSize(new Dimension(80, 60)); panel.add(deviceTypeChartPanel, gc); typeNumberLabels = new JLabel[nodeTypes.length]; typeNameLabels = new JLabel[nodeTypes.length]; gc.fill = GridBagConstraints.BOTH; gc.insets = new Insets(2, 2, 2, 2); for (int i = 0; i < nodeTypes.length; i++) { gc.weightx = 1; gc.gridwidth = 1; typeNumberLabels[i] = createNumberLabel(); panel.add(typeNumberLabels[i], gc); gc.weightx = 0; gc.gridwidth = GridBagConstraints.REMAINDER; typeNameLabels[i] = createNameLabel(nodeTypes[i].getName()); panel.add(typeNameLabels[i], gc); } return panel; }