List of usage examples for java.awt GridBagConstraints GridBagConstraints
public GridBagConstraints()
From source file:medsavant.enrichment.app.OntologyAggregatePanel.java
public OntologyAggregatePanel(String page) { super(page);/*from ww w. j a va 2 s. com*/ setLayout(new GridBagLayout()); chooser = new JComboBox(OntologyListItem.DEFAULT_ITEMS); chooser.setMaximumSize(new Dimension(400, chooser.getMaximumSize().height)); progress = new JProgressBar(); progress.setPreferredSize(new Dimension(600, progress.getMaximumSize().height)); progress.setStringPainted(true); JPanel banner = new JPanel(); banner.setLayout(new GridBagLayout()); banner.setBackground(new Color(245, 245, 245)); banner.setBorder(BorderFactory.createTitledBorder("Ontology")); tree = new TreeTable(); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0; gbc.anchor = GridBagConstraints.WEST; banner.add(chooser, gbc); gbc.anchor = GridBagConstraints.EAST; banner.add(progress, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; add(banner, gbc); gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; add(new JScrollPane(tree), gbc); chooser.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (termFetcher != null) { termFetcher.cancel(true); termFetcher = null; } recalculate(); } }); tree.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { createPopup().show(e.getComponent(), e.getX(), e.getY()); } } }); }
From source file:net.chaosserver.timelord.swingui.TaskDayPanel.java
/** * Builds the panel. This uses a GridBag to try and make formatting * grid-like between the unconnected rows. *///from w ww. j av a 2s. c om protected void buildPanel() { GridBagLayout gridBagLayout = new GridBagLayout(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); Insets defaultInsets = gridBagConstraints.insets; setLayout(gridBagLayout); taskName = new JLabel(); if (timelordTask.isHidden()) { Font taskFont = taskName.getFont(); Font italicFont = new Font(taskFont.getName(), Font.ITALIC, taskFont.getSize()); taskName.setFont(italicFont); } updateTaskNameLabel(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = LayoutConstants.HEAVY_WEIGHT; gridBagConstraints.insets = new Insets(0, LayoutConstants.SMALL_INSET, 0, LayoutConstants.BIG_INSET); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagLayout.addLayoutComponent(taskName, gridBagConstraints); add(taskName); minusButton = new JButton("-" + DateUtil.getSmallestTimeInMinutes() + "m"); minusButton.setToolTipText("Remove 15 minutes (0.25 hours) " + "of time from this task."); minusButton.setActionCommand(ACTION_MINUS_15); minusButton.addActionListener(this); gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.insets = defaultInsets; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagLayout.addLayoutComponent(minusButton, gridBagConstraints); add(minusButton); addButton = new JButton("+" + DateUtil.getSmallestTimeInMinutes() + "m"); addButton.setToolTipText("Add 15 minutes (0.25 hours) of " + "time from this task."); addButton.setActionCommand(ACTION_ADD_15); addButton.addActionListener(this); gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.insets = defaultInsets; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagLayout.addLayoutComponent(addButton, gridBagConstraints); add(addButton); timeLabel = new JLabel(); if (todayTaskDay != null) { timeLabel.setText(DateUtil.formatHours(null, todayTaskDay.getHours())); } else { timeLabel.setText(DateUtil.formatHours(null, 0)); } gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagConstraints.insets = new Insets(0, LayoutConstants.BIG_INSET, 0, LayoutConstants.SMALL_INSET); gridBagLayout.addLayoutComponent(timeLabel, gridBagConstraints); add(timeLabel); enabledButtons(); }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanProxySetting.java
private JPanel getJPanelValue() { if (jPanelValue == null) { GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 1;//w w w.j av a 2 s. co m gridBagConstraints3.weighty = 1.0; gridBagConstraints3.weightx = 0.0; gridBagConstraints3.gridy = 4; jLabelEmpty = new JLabel(); jLabelEmpty.setText(""); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.gridy = 3; jPanelValue = new JPanel(); jPanelValue.setLayout(new GridBagLayout()); jPanelValue.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanelValue.setPreferredSize(new Dimension(400, 200)); jPanelValue.add(jLabelEmpty, gridBagConstraints3); JLabel jLabelProxyHost = new JLabel("Proxy Host : ", JLabel.RIGHT); GridBagConstraints gridBagConstraintsjLabelProxyHost = new GridBagConstraints(); gridBagConstraintsjLabelProxyHost.gridx = 0; gridBagConstraintsjLabelProxyHost.insets = new Insets(10, 20, 5, 0); gridBagConstraintsjLabelProxyHost.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelProxyHost.weightx = 0.0; gridBagConstraintsjLabelProxyHost.weighty = 0.0; gridBagConstraintsjLabelProxyHost.gridy = 1; jPanelValue.add(jLabelProxyHost, gridBagConstraintsjLabelProxyHost); GridBagConstraints gridBagConstraintsgetJTextFieldProxyHost = new GridBagConstraints(); gridBagConstraintsgetJTextFieldProxyHost.gridx = 1; gridBagConstraintsgetJTextFieldProxyHost.weightx = 1.0; gridBagConstraintsgetJTextFieldProxyHost.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldProxyHost.insets = new Insets(10, 5, 5, 100); gridBagConstraintsgetJTextFieldProxyHost.gridwidth = 2; gridBagConstraintsgetJTextFieldProxyHost.gridy = 1; jPanelValue.add(getJTextFieldProxyHost(), gridBagConstraintsgetJTextFieldProxyHost); JLabel jLabelProxyPort = new JLabel("Proxy Port : ", JLabel.RIGHT); GridBagConstraints gridBagConstraintsjLabelProxyPort = new GridBagConstraints(); gridBagConstraintsjLabelProxyPort.gridx = 0; gridBagConstraintsjLabelProxyPort.insets = new Insets(0, 20, 0, 0); gridBagConstraintsjLabelProxyPort.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelProxyPort.weighty = 0.0; gridBagConstraintsjLabelProxyPort.gridy = 2; jPanelValue.add(jLabelProxyPort, gridBagConstraintsjLabelProxyPort); GridBagConstraints gridBagConstraintsgetJTextFieldProxyPort = new GridBagConstraints(); gridBagConstraintsgetJTextFieldProxyPort.gridx = 1; gridBagConstraintsgetJTextFieldProxyPort.weightx = 1.0; gridBagConstraintsgetJTextFieldProxyPort.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldProxyPort.insets = new Insets(5, 5, 5, 220); gridBagConstraintsgetJTextFieldProxyPort.weighty = 0.0; gridBagConstraintsgetJTextFieldProxyPort.anchor = GridBagConstraints.CENTER; gridBagConstraintsgetJTextFieldProxyPort.gridy = 2; jPanelValue.add(getJTextFieldProxyPort(), gridBagConstraintsgetJTextFieldProxyPort); JLabel jLabelProxyBypass = new JLabel("Proxy Bypass : ", JLabel.RIGHT); GridBagConstraints gridBagConstraintsjLabelProxyBypass = new GridBagConstraints(); gridBagConstraintsjLabelProxyBypass.gridx = 0; gridBagConstraintsjLabelProxyBypass.insets = new Insets(0, 20, 0, 0); gridBagConstraintsjLabelProxyBypass.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelProxyBypass.weighty = 0.0; gridBagConstraintsjLabelProxyBypass.gridy = 3; jPanelValue.add(jLabelProxyBypass, gridBagConstraintsjLabelProxyBypass); GridBagConstraints gridBagConstraintsgetJTextFieldProxyBypass = new GridBagConstraints(); gridBagConstraintsgetJTextFieldProxyBypass.gridx = 1; gridBagConstraintsgetJTextFieldProxyBypass.weightx = 1.0; gridBagConstraintsgetJTextFieldProxyBypass.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldProxyBypass.insets = new Insets(5, 5, 5, 100); gridBagConstraintsgetJTextFieldProxyBypass.weighty = 0.0; gridBagConstraintsgetJTextFieldProxyBypass.anchor = GridBagConstraints.CENTER; gridBagConstraintsgetJTextFieldProxyBypass.gridy = 3; jPanelValue.add(getJTextFieldProxyBypass(), gridBagConstraintsgetJTextFieldProxyBypass); //jPanelValue.add(getJPanel(), gridBagConstraints2); } return jPanelValue; }
From source file:com.sec.ose.osi.ui.frm.main.report.JPanReportMain.java
/** * This method initializes jPanel //from w w w.java 2s .co m * * @return javax.swing.JPanel */ private JPanel getJPanelbutton() { if (jPanel == null) { GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints4.insets = new Insets(10, 0, 0, 10); gridBagConstraints4.anchor = GridBagConstraints.NORTH; GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints5.insets = new Insets(10, 0, 0, 10); gridBagConstraints5.gridx = 0; gridBagConstraints5.gridy = 1; jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(getJButtonReportExport(), gridBagConstraints4); } return jPanel; }
From source file:com.smart.aqimonitor.client.AqiSettingDialog.java
/** * Create the dialog./*from w ww .j a v a 2 s.co m*/ */ public AqiSettingDialog(Frame owner, final AbstractAqiParser aqiParser) { super(owner); this.aqiParser = aqiParser; setTitle("\u8BBE\u7F6E"); setResizable(false); setBounds(100, 100, 450, 135); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); GridBagLayout gbl_contentPanel = new GridBagLayout(); gbl_contentPanel.columnWidths = new int[] { 33, 48, 66, 41, 48, 66, 0, 0 }; gbl_contentPanel.rowHeights = new int[] { 21, 0, 0 }; gbl_contentPanel.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; contentPanel.setLayout(gbl_contentPanel); { JLabel lblRetryTimes = new JLabel("\u91CD\u8BD5\u6B21\u6570\uFF1A"); GridBagConstraints gbc_lblRetryTimes = new GridBagConstraints(); gbc_lblRetryTimes.anchor = GridBagConstraints.WEST; gbc_lblRetryTimes.insets = new Insets(0, 0, 5, 5); gbc_lblRetryTimes.gridx = 1; gbc_lblRetryTimes.gridy = 0; contentPanel.add(lblRetryTimes, gbc_lblRetryTimes); } { tfRetryTimes = new JTextField(); tfRetryTimes.setPreferredSize(new Dimension(6, 29)); tfRetryTimes.setMinimumSize(new Dimension(60, 29)); GridBagConstraints gbc_tfRetryTimes = new GridBagConstraints(); gbc_tfRetryTimes.anchor = GridBagConstraints.NORTHWEST; gbc_tfRetryTimes.insets = new Insets(0, 0, 5, 5); gbc_tfRetryTimes.gridx = 2; gbc_tfRetryTimes.gridy = 0; contentPanel.add(tfRetryTimes, gbc_tfRetryTimes); tfRetryTimes.setColumns(10); } { JLabel lblRetryGap = new JLabel("\u91CD\u8BD5\u95F4\u9694\uFF1A"); GridBagConstraints gbc_lblRetryGap = new GridBagConstraints(); gbc_lblRetryGap.anchor = GridBagConstraints.WEST; gbc_lblRetryGap.insets = new Insets(0, 0, 5, 5); gbc_lblRetryGap.gridx = 4; gbc_lblRetryGap.gridy = 0; contentPanel.add(lblRetryGap, gbc_lblRetryGap); } { tfRetryGap = new JTextField(); tfRetryGap.setMinimumSize(new Dimension(60, 29)); tfRetryGap.setPreferredSize(new Dimension(60, 29)); GridBagConstraints gbc_tfRetryGap = new GridBagConstraints(); gbc_tfRetryGap.insets = new Insets(0, 0, 5, 5); gbc_tfRetryGap.anchor = GridBagConstraints.NORTHWEST; gbc_tfRetryGap.gridx = 5; gbc_tfRetryGap.gridy = 0; contentPanel.add(tfRetryGap, gbc_tfRetryGap); tfRetryGap.setColumns(10); } { JLabel label = new JLabel("\u5206\u949F"); GridBagConstraints gbc_label = new GridBagConstraints(); gbc_label.insets = new Insets(0, 0, 5, 0); gbc_label.gridx = 6; gbc_label.gridy = 0; contentPanel.add(label, gbc_label); } { JLabel lblExportPath = new JLabel("\u8F93\u51FA\u8DEF\u5F84\uFF1A"); GridBagConstraints gbc_lblExportPath = new GridBagConstraints(); gbc_lblExportPath.anchor = GridBagConstraints.EAST; gbc_lblExportPath.insets = new Insets(0, 0, 0, 5); gbc_lblExportPath.gridx = 1; gbc_lblExportPath.gridy = 1; contentPanel.add(lblExportPath, gbc_lblExportPath); } { tfExportPath = new JTextField(); tfExportPath.setEditable(false); tfExportPath.setPreferredSize(new Dimension(180, 29)); tfExportPath.setMinimumSize(new Dimension(180, 29)); GridBagConstraints gbc_tfExportPath = new GridBagConstraints(); gbc_tfExportPath.gridwidth = 4; gbc_tfExportPath.insets = new Insets(0, 0, 0, 5); gbc_tfExportPath.fill = GridBagConstraints.HORIZONTAL; gbc_tfExportPath.gridx = 2; gbc_tfExportPath.gridy = 1; contentPanel.add(tfExportPath, gbc_tfExportPath); tfExportPath.setColumns(10); } { JButton button = new JButton("..."); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { fDialog = new JFileChooser(); // fDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int result = fDialog.showOpenDialog(contentPanel); if (result == JFileChooser.APPROVE_OPTION) { tfExportPath.setText(fDialog.getSelectedFile().getAbsolutePath()); } } }); GridBagConstraints gbc_button = new GridBagConstraints(); gbc_button.gridx = 6; gbc_button.gridy = 1; contentPanel.add(button, gbc_button); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("\u786E\u5B9A"); okButton.setName("settingOk"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String retryTimes = tfRetryTimes.getText(); if (StringUtils.isEmpty(retryTimes) || !isNumeric(retryTimes)) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } String retryGap = tfRetryGap.getText(); if (StringUtils.isEmpty(retryGap) || !isNumeric(retryGap)) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } String exportPath = tfExportPath.getText(); if (StringUtils.isEmpty(exportPath)) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } File testFile = new File(exportPath); if (!testFile.exists()) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } props.put("query.retryTimes", retryTimes); props.put("query.retryGap", retryGap); props.put("result.path", exportPath); try { props.store(new FileOutputStream(propertiesResource.getFile()), ""); aqiParser.setRetryTimes(Integer.parseInt(retryTimes)); aqiParser.setRetryGap(Integer.parseInt(retryGap)); aqiParser.setFilePath(exportPath); } catch (IOException e1) { e1.printStackTrace(); } finally { dispose(); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("\u53D6\u6D88"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } }
From source file:com.vgi.mafscaling.OpenLoop.java
protected void createRunPanel(JPanel dataPanel) { JScrollPane dataScrollPane = new JScrollPane(); GridBagConstraints gbc_dataScrollPane = new GridBagConstraints(); gbc_dataScrollPane.weightx = 1.0;/*from ww w . ja va 2 s .c o m*/ gbc_dataScrollPane.weighty = 1.0; gbc_dataScrollPane.fill = GridBagConstraints.BOTH; gbc_dataScrollPane.gridx = 0; gbc_dataScrollPane.gridy = 3; dataPanel.add(dataScrollPane, gbc_dataScrollPane); JPanel dataRunPanel = new JPanel(); dataScrollPane.setViewportView(dataRunPanel); GridBagLayout gbl_dataRunPanel = new GridBagLayout(); gbl_dataRunPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_dataRunPanel.rowHeights = new int[] { 0 }; gbl_dataRunPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; gbl_dataRunPanel.rowWeights = new double[] { 0.0 }; dataRunPanel.setLayout(gbl_dataRunPanel); createRunTables(dataRunPanel); }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanProjectAnalysisSetting.java
/** * This method initializes this/*from w ww .j av a2s. c o m*/ * * @return void */ private void initialize() { GridBagConstraints gridBagConstraints71 = new GridBagConstraints(); gridBagConstraints71.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints71.weightx = 1.0; gridBagConstraints71.weighty = 1.0; gridBagConstraints71.insets = new Insets(0, 0, 0, 0); gridBagConstraints71.fill = GridBagConstraints.BOTH; GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); gridBagConstraints14.gridx = -1; gridBagConstraints14.anchor = GridBagConstraints.NORTH; gridBagConstraints14.insets = new Insets(10, 10, 0, 10); gridBagConstraints14.gridy = -1; this.setLayout(new GridBagLayout()); this.add(getJIntMainPanel(), gridBagConstraints71); this.add(getJPanel(), gridBagConstraints14); }
From source file:com.limegroup.gnutella.gui.LicenseWindow.java
protected void createVerifying() { GridBagConstraints c = new GridBagConstraints(); // TODO: Add a pretty animation. JTextArea text = newTextArea(getLocatingString()); c.anchor = GridBagConstraints.CENTER; c.fill = GridBagConstraints.BOTH; c.weightx = 1;//from www . ja v a 2s.c o m c.weighty = 1; DETAILS.add(text, c); }
From source file:com.sshtools.common.ui.SshToolsConnectionProxyTab.java
/** * Creates a new SshToolsConnectionProxyTab object. *///from www .j a va 2 s. c om public SshToolsConnectionProxyTab() { super(); group.add(noProxy); group.add(httpProxy); group.add(socks4Proxy); group.add(socks5Proxy); ChangeListener listener = new ChangeListener() { public void stateChanged(ChangeEvent e) { if (noProxy.isSelected()) { username.setEnabled(false); password.setEnabled(false); proxy.setEnabled(false); //port.setEnabled(false); port.setForeground(Color.white); } else { username.setEnabled(true); password.setEnabled(true); proxy.setEnabled(true); //port.setEnabled(true); port.setForeground(Color.black); if (httpProxy.isSelected()) { port.setText("80"); } else { port.setText("1080"); } } } }; noProxy.getModel().addChangeListener(listener); httpProxy.getModel().addChangeListener(listener); socks4Proxy.getModel().addChangeListener(listener); socks5Proxy.getModel().addChangeListener(listener); // Create the main connection details panel GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; gbc.insets = new Insets(0, 2, 2, 2); gbc.weightx = 1.0; proxyframe.setBorder(BorderFactory.createTitledBorder("Connect using the following proxy")); // No proxy label gbc.insets = new Insets(2, 10, 2, 2); UIUtil.jGridBagAdd(proxyframe, noProxy, gbc, GridBagConstraints.RELATIVE); // Socks 4 label gbc.insets = new Insets(2, 15, 2, 2); UIUtil.jGridBagAdd(proxyframe, socks4Proxy, gbc, GridBagConstraints.REMAINDER); //gbc.fill = GridBagConstraints.HORIZONTAL; // Http Proxy gbc.insets = new Insets(2, 10, 2, 2); UIUtil.jGridBagAdd(proxyframe, httpProxy, gbc, GridBagConstraints.RELATIVE); // Socks 5 label gbc.insets = new Insets(2, 15, 2, 2); UIUtil.jGridBagAdd(proxyframe, socks5Proxy, gbc, GridBagConstraints.REMAINDER); gbc.insets = new Insets(2, 10, 2, 10); JPanel connect = new JPanel(new GridBagLayout()); connect.setBorder(BorderFactory.createTitledBorder("Proxy Details")); UIUtil.jGridBagAdd(connect, new JLabel("Host"), gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(connect, proxy, gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(connect, new JLabel("Port"), gbc, GridBagConstraints.REMAINDER); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; UIUtil.jGridBagAdd(connect, port, gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.HORIZONTAL; UIUtil.jGridBagAdd(connect, new JLabel("Username"), gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(connect, username, gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(connect, new JLabel("Password"), gbc, GridBagConstraints.REMAINDER); gbc.insets = new Insets(2, 10, 10, 10); UIUtil.jGridBagAdd(connect, password, gbc, GridBagConstraints.REMAINDER); JPanel main = new JPanel(new GridBagLayout()); gbc.insets = new Insets(2, 2, 2, 2); UIUtil.jGridBagAdd(main, proxyframe, gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(main, connect, gbc, GridBagConstraints.REMAINDER); IconWrapperPanel iconProxyDetailsPanel = new IconWrapperPanel(new ResourceIcon(PROXY_ICON), main); noProxy.setSelected(true); // This panel setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; gbc.insets = new Insets(2, 2, 2, 2); gbc.weightx = 1.0; add(iconProxyDetailsPanel, BorderLayout.NORTH); }
From source file:com.intel.stl.ui.monitor.view.PSEventsPieChart.java
protected JPanel getLengendPanel() { JPanel panel = new JPanel(); panel.setOpaque(false);// w w w. java 2 s. c o m panel.setLayout(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); gc.fill = GridBagConstraints.BOTH; StateLongTypeViz[] states = StateLongTypeViz.values(); stateLabels = new JLabel[states.length]; for (int i = 0; i < states.length; i++) { StateLongTypeViz state = states[i]; gc.insets = new Insets(2, 5, 2, 2); gc.weightx = 0; gc.gridwidth = 1; JLabel label = new JLabel(state.getName(), Util.generateImageIcon(state.getColor(), 8, new Insets(1, 1, 1, 1)), JLabel.LEFT); label.setFont(UIConstants.H5_FONT); label.setForeground(UIConstants.INTEL_DARK_GRAY); panel.add(label, gc); gc.gridwidth = GridBagConstraints.REMAINDER; gc.weightx = 0; stateLabels[i] = new JLabel(); stateLabels[i].setForeground(UIConstants.INTEL_DARK_GRAY); stateLabels[i].setFont(UIConstants.H5_FONT); panel.add(stateLabels[i], gc); } return panel; }