List of usage examples for java.awt GridBagConstraints GridBagConstraints
public GridBagConstraints()
From source file:com.intel.stl.ui.main.view.NodeStatesPie.java
protected void fillLengendPanel(JPanel panel, PieDataset dataset, Color[] colors) { panel.removeAll();//from w w w . ja v a 2s .c o m GridBagConstraints gc = new GridBagConstraints(); gc.fill = GridBagConstraints.BOTH; int size = dataset.getItemCount(); stateLabels = new JLabel[size]; for (int i = 0; i < size; i++) { gc.insets = new Insets(2, 5, 2, 2); gc.weightx = 0; gc.gridwidth = 1; JLabel label = new JLabel(dataset.getKey(i).toString(), Util.generateImageIcon(colors[i], 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.H3_FONT); panel.add(stateLabels[i], gc); } }
From source file:org.gridchem.client.gui.panels.myccg.resource.HPCChartPanel.java
public HPCChartPanel(StatusListener statusListener) { super();/*from w w w .j ava 2 s . c om*/ this.statusListener = statusListener; setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1.0; c.weighty = 1.0; c.gridx = 0; c.gridy = 0; c.fill = GridBagConstraints.BOTH; JPanel captionPanel = new JPanel(); captionPanel.setLayout(new GridLayout(1, 2)); captionPanel.add(new JLabel()); captionPanel.add(new JLabel(DEFAULT_MESSAGE)); captionPanel.add(new JLabel()); add(captionPanel, c); c.weightx = 0; c.weighty = 0; c.gridx = 0; c.gridy = 1; navPanel = createSelectionBar(); add(navPanel, c); enableSelectionBar(false); revalidate(); }
From source file:me.childintime.childintime.ui.window.tool.BmiToolDialog.java
/** * Build the UI.//from w ww .j a va2 s .c o m */ private void buildUi() { // Set the layout setLayout(new BorderLayout()); // Create a grid bag constraints configuration GridBagConstraints c = new GridBagConstraints(); // Create the container and body state panel final JPanel container = new JPanel(new GridBagLayout()); container.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16)); // Add the close button c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 0; c.weightx = 0; c.weighty = 0; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 0, 0, 0); container.add(new JLabel("Select a student to see their details."), c); // Add the body state panel to the container c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 1; c.weightx = 1; c.weighty = 1; c.anchor = GridBagConstraints.CENTER; c.insets = new Insets(16, 0, 0, 0); container.add(buildUiBodyStatePanel(), c); // Create the close button final JButton closeButton = new JButton("Close"); closeButton.addActionListener(e -> dispose()); // Add the close button c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 2; c.weightx = 0; c.weighty = 0; c.anchor = GridBagConstraints.EAST; c.insets = new Insets(8, 0, 0, 0); container.add(closeButton, c); // Add the container add(container, BorderLayout.CENTER); }
From source file:org.keyboardplaying.xtt.ui.UIController.java
/** Builds and shows the main window. */ public void showMainWindow() { /* Create UI. */ JPanel pane = new JPanel(new GridBagLayout()); /* Arrange the components */ GridBagConstraints c;/*from w w w . j a v a 2 s.c o m*/ c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.fill = GridBagConstraints.BOTH; pane.add(makeProjectActionButton("action.construct", "action-construct", ImageSize.W_16, constructAction), c); c = new GridBagConstraints(); c.gridx = 0; c.gridy = 1; c.gridwidth = 2; c.fill = GridBagConstraints.BOTH; pane.add(makeProjectActionButton("action.deconstruct", "action-deconstruct", ImageSize.W_16, deconstructAction), c); c = new GridBagConstraints(); c.gridx = 2; c.gridy = 0; c.gridheight = 2; c.fill = GridBagConstraints.BOTH; pane.add(makeActionButton(null, "icon-settings", ImageSize.W_32, settingsAction), c); Window window = makeWindow("app.name", "icon-timetracker", pane); window.addWindowListener(new WindowAdapter() { /* * (non-Javadoc) * * @see java.awt.event.WindowAdapter#windowClosing(java.awt.event. WindowEvent) */ @Override public void windowClosing(WindowEvent e) { super.windowClosing(e); Frame[] windows = JFrame.getFrames(); for (Frame w : windows) { w.dispose(); } } }); window.setVisible(true); }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java
private final JPanel getMainPanel() { final JPanel mainPanel = new JPanel(new GridBagLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); final ServerList linkedServerList = new ServerList(linkedServerListModel); linkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); final JScrollPane linkedServerScrollPane = new JScrollPane(linkedServerList); linkedServerScrollPane// ww w . j a v a 2 s .c o m .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Linked Servers")); // Doesn't matter what this is set to, as long as it's the same as the // one for unlinkedServerScrollPane linkedServerScrollPane.setPreferredSize(new Dimension(10, 10)); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 0; c.weightx = 0.5; c.weighty = 1.0; mainPanel.add(linkedServerScrollPane, c); final ServerList unlinkedServerList = new ServerList(unlinkedServerListModel); unlinkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); final JScrollPane unlinkedServerScrollPane = new JScrollPane(unlinkedServerList); unlinkedServerScrollPane .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Unlinked Servers")); // Doesn't matter what this is set to, as long as it's the same as the // one for unlinkedServerScrollPane unlinkedServerScrollPane.setPreferredSize(new Dimension(10, 10)); final JPanel middlePanel = new JPanel(); middlePanel.setLayout(new BoxLayout(middlePanel, BoxLayout.Y_AXIS)); middlePanel.add(Box.createVerticalGlue()); final JButton linkSelectionButton = new JButton("<"); final JButton unlinkSelectionButton = new JButton(">"); linkSelectionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { // Move selection from unlinked to linked list final int selection = unlinkedServerList.getSelectedIndex(); if (selection < 0) { return; } final Server server = unlinkedServerListModel.getVisibleServerAtIndex(selection); unlinkedServerListModel.removeServer(server); linkedServerListModel.addServer(server); } }); unlinkSelectionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { // Move selection from linked to unlinked list final int selection = linkedServerList.getSelectedIndex(); if (selection < 0) { return; } final int answer = JOptionPane.showOptionDialog(LinkUnlinkWindow.this, "You are about to unlink a server. " + "Unlinking a server will permanently remove \nall data associated with " + "this server, but the server will keep running. " + "\n\nAre you sure you wish to continue?", "Unlink Server", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null); if (answer != JOptionPane.YES_OPTION) { return; } final Server server = linkedServerListModel.getVisibleServerAtIndex(selection); linkedServerListModel.removeServer(server); unlinkedServerListModel.addServer(server); } }); middlePanel.add(unlinkSelectionButton); middlePanel.add(Box.createVerticalStrut(10)); middlePanel.add(linkSelectionButton); middlePanel.add(Box.createVerticalGlue()); c.gridx = 1; c.gridy = 0; c.weightx = 0.0; c.weighty = 0.0; mainPanel.add(middlePanel, c); c.gridx = 2; c.gridy = 0; c.weightx = 0.5; c.weighty = 1.0; mainPanel.add(unlinkedServerScrollPane, c); return mainPanel; }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java
/** * This method initializes jPanelValue * // w w w. j ava2 s . c o m * @return javax.swing.JPanel */ private JPanel getJPanelValue() { if (jPanelValue == null) { 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)); // Default Report Location jLabelDefaultReportLocation = new JLabel(); jLabelDefaultReportLocation.setText("Default Report Location:"); jLabelDefaultReportLocation.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraintsjLabelDefaultReportLocation = new GridBagConstraints(); gridBagConstraintsjLabelDefaultReportLocation.gridx = 0; gridBagConstraintsjLabelDefaultReportLocation.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelDefaultReportLocation.insets = new Insets(5, 0, 0, 0); gridBagConstraintsjLabelDefaultReportLocation.gridy = 1; GridBagConstraints gridBagConstraintsjpanelDefaultReportLocation = new GridBagConstraints(); gridBagConstraintsjpanelDefaultReportLocation.fill = GridBagConstraints.BOTH; gridBagConstraintsjpanelDefaultReportLocation.gridy = 1; gridBagConstraintsjpanelDefaultReportLocation.weightx = 1.0; gridBagConstraintsjpanelDefaultReportLocation.insets = new Insets(10, 5, 5, 15); gridBagConstraintsjpanelDefaultReportLocation.gridx = 1; // reciprocal license jLabelReciprocalLicense = new JLabel(); jLabelReciprocalLicense.setText("Reciprocal License (RED):"); jLabelReciprocalLicense.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraintsjLabelReciprocalLicense = new GridBagConstraints(); gridBagConstraintsjLabelReciprocalLicense.gridx = 0; gridBagConstraintsjLabelReciprocalLicense.insets = new Insets(0, 15, 0, 0); gridBagConstraintsjLabelReciprocalLicense.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelReciprocalLicense.gridy = 2; jPanelValue.add(jLabelDefaultReportLocation, gridBagConstraintsjLabelDefaultReportLocation); jPanelValue.add(getJPanelDefaultReportLocation(), gridBagConstraintsjpanelDefaultReportLocation); jPanelValue.add(jLabelReciprocalLicense, gridBagConstraintsjLabelReciprocalLicense); GridBagConstraints gridBagConstraintsgetJTextFieldReciprocalLicense = new GridBagConstraints(); gridBagConstraintsgetJTextFieldReciprocalLicense.gridx = 1; gridBagConstraintsgetJTextFieldReciprocalLicense.weightx = 1.0; gridBagConstraintsgetJTextFieldReciprocalLicense.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldReciprocalLicense.insets = new Insets(5, 5, 5, 15); gridBagConstraintsgetJTextFieldReciprocalLicense.gridy = 2; jPanelValue.add(getJTextFieldReciprocalLicense(), gridBagConstraintsgetJTextFieldReciprocalLicense); // major license jLabelMajorLicense = new JLabel(); jLabelMajorLicense.setText("Major License (ORANGE):"); jLabelMajorLicense.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraintsjLabelMajorLicense = new GridBagConstraints(); gridBagConstraintsjLabelMajorLicense.gridx = 0; gridBagConstraintsjLabelMajorLicense.insets = new Insets(0, 15, 0, 0); gridBagConstraintsjLabelMajorLicense.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelMajorLicense.gridy = 3; jPanelValue.add(jLabelMajorLicense, gridBagConstraintsjLabelMajorLicense); GridBagConstraints gridBagConstraintsgetJTextFieldMajorLicense = new GridBagConstraints(); gridBagConstraintsgetJTextFieldMajorLicense.gridx = 1; gridBagConstraintsgetJTextFieldMajorLicense.weightx = 1.0; gridBagConstraintsgetJTextFieldMajorLicense.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldMajorLicense.insets = new Insets(5, 5, 5, 15); gridBagConstraintsgetJTextFieldMajorLicense.gridy = 3; jPanelValue.add(getJTextFieldMajorLicense(), gridBagConstraintsgetJTextFieldMajorLicense); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 1; gridBagConstraints3.weighty = 1.0; gridBagConstraints3.weightx = 0.0; gridBagConstraints3.gridy = 4; JLabel jLabelEmpty = new JLabel(); jLabelEmpty.setText(""); jPanelValue.add(jLabelEmpty, gridBagConstraints3); } return jPanelValue; }
From source file:com.jostrobin.battleships.view.frames.GameFrame.java
private void addBattleField(int length, int width, String playerName, int gridX, int gridY) { battleFieldPanel = new BattleFieldPanel(playerName); battleFieldPanel.initializeFieldSize(length, width); battleFieldPanel.setSelectable(false); placementHelper = new PlacementHelper(battleFieldPanel); GridBagConstraints battlefieldConstraints = new GridBagConstraints(); battlefieldConstraints.weightx = 1.0; battlefieldConstraints.weighty = 0.8; battlefieldConstraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING; battlefieldConstraints.fill = GridBagConstraints.BOTH; battlefieldConstraints.gridy = gridY; battlefieldConstraints.gridx = gridX; add(battleFieldPanel, battlefieldConstraints); }
From source file:com.floreantpos.ui.dialog.ManagerDialog.java
/** This method is called from within the constructor to * initialize the form.//from www .j ava 2 s . co m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { titlePanel1 = new com.floreantpos.ui.TitlePanel(); transparentPanel4 = new com.floreantpos.swing.TransparentPanel(); transparentPanel2 = new com.floreantpos.swing.TransparentPanel(); transparentPanel3 = new com.floreantpos.swing.TransparentPanel(); btnShowTips = new com.floreantpos.swing.PosButton(); btnDrawerPullReport = new com.floreantpos.swing.PosButton(); btnOpenTickets = new com.floreantpos.swing.PosButton(); btnCashDrops = new com.floreantpos.swing.PosButton(); transparentPanel1 = new com.floreantpos.swing.TransparentPanel(); btnFinish = new com.floreantpos.swing.PosButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); titlePanel1.setTitle(com.floreantpos.POSConstants.MANAGER_FUNCTION); getContentPane().add(titlePanel1, java.awt.BorderLayout.NORTH); transparentPanel4.setLayout(new java.awt.BorderLayout()); transparentPanel4.setOpaque(true); transparentPanel2.setLayout(new java.awt.GridBagLayout()); transparentPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10)); transparentPanel3.setLayout(new java.awt.GridLayout(3, 2, 5, 5)); btnShowTips.setText(com.floreantpos.POSConstants.SERVER_TIPS); btnShowTips.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doShowServerTips(evt); } }); transparentPanel3.add(btnShowTips); btnDrawerPullReport.setText(com.floreantpos.POSConstants.DRAWER_PULL_BUTTON_TEXT); btnDrawerPullReport.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnDrawerPullReportActionPerformed(evt); } }); transparentPanel3.add(btnDrawerPullReport); btnOpenTickets.setText(com.floreantpos.POSConstants.OPEN_TICKETS); btnOpenTickets.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doShowOpenTickets(); } }); transparentPanel3.add(btnOpenTickets); btnCashDrops.setText(com.floreantpos.POSConstants.DRAWER_BLEED); btnCashDrops.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doShowCashDrops(); } }); transparentPanel3.add(btnCashDrops); GridBagConstraints gbc_transparentPanel3 = new GridBagConstraints(); gbc_transparentPanel3.insets = new Insets(0, 0, 5, 0); gbc_transparentPanel3.gridx = 0; gbc_transparentPanel3.gridy = 0; transparentPanel2.add(transparentPanel3, gbc_transparentPanel3); btnDrawerKick = new PosButton(); btnDrawerKick.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doDrawerKick(); } }); btnDrawerKick.setText(Messages.getString("ManagerDialog.1")); //$NON-NLS-1$ transparentPanel3.add(btnDrawerKick); transparentPanel4.add(transparentPanel2, java.awt.BorderLayout.CENTER); transparentPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); btnFinish.setText(com.floreantpos.POSConstants.FINISH); btnFinish.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doCloseDialog(); } }); transparentPanel1.add(btnFinish); transparentPanel4.add(transparentPanel1, java.awt.BorderLayout.SOUTH); getContentPane().add(transparentPanel4, java.awt.BorderLayout.CENTER); pack(); }
From source file:gdt.jgui.entity.query.JQueryPanel.java
/** * The default constructor.//from w w w . j av a 2 s. com */ public JQueryPanel() { GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 100, 0, 0 }; gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0 }; gridBagLayout.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE }; gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0 }; setLayout(gridBagLayout); JLabel lblElement = new JLabel("Element"); GridBagConstraints gbc_lblElement = new GridBagConstraints(); gbc_lblElement.insets = new Insets(5, 5, 5, 5); gbc_lblElement.gridx = 0; gbc_lblElement.gridy = 0; gbc_lblElement.anchor = GridBagConstraints.FIRST_LINE_START; add(lblElement, gbc_lblElement); elementComboBox = new JComboBox<String>(); GridBagConstraints gbc_elementComboBox = new GridBagConstraints(); gbc_elementComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_elementComboBox.insets = new Insets(0, 0, 5, 0); gbc_elementComboBox.gridx = 1; gbc_elementComboBox.gridy = 0; gbc_elementComboBox.anchor = GridBagConstraints.FIRST_LINE_START; add(elementComboBox, gbc_elementComboBox); elementComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { try { initItemNameSelector(); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } }); JLabel lblItemNameField = new JLabel("Item field"); GridBagConstraints gbc_lblItemField = new GridBagConstraints(); gbc_lblItemField.insets = new Insets(5, 5, 5, 5); gbc_lblItemField.gridx = 0; gbc_lblItemField.gridy = 1; gbc_lblItemField.anchor = GridBagConstraints.FIRST_LINE_START; add(lblItemNameField, gbc_lblItemField); itemNameFieldComboBox = new JComboBox<String>(); GridBagConstraints gbc_itemNameFieldComboBox = new GridBagConstraints(); gbc_itemNameFieldComboBox.insets = new Insets(0, 0, 5, 0); gbc_itemNameFieldComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_itemNameFieldComboBox.gridx = 1; gbc_itemNameFieldComboBox.gridy = 1; gbc_itemNameFieldComboBox.anchor = GridBagConstraints.FIRST_LINE_START; add(itemNameFieldComboBox, gbc_itemNameFieldComboBox); itemNameFieldComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { try { initItemNameSelector(); initItemValueSelector(); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } }); JLabel itemTitle = new JLabel("Item title"); GridBagConstraints gbc_lblItemtitle = new GridBagConstraints(); gbc_lblItemtitle.insets = new Insets(5, 5, 5, 5); gbc_lblItemtitle.gridx = 0; gbc_lblItemtitle.gridy = 2; gbc_lblItemtitle.anchor = GridBagConstraints.FIRST_LINE_START; add(itemTitle, gbc_lblItemtitle); itemNameComboBox = new JComboBox<String>(); GridBagConstraints gbc_itemComboBox = new GridBagConstraints(); gbc_itemComboBox.insets = new Insets(0, 0, 5, 0); gbc_itemComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_itemComboBox.gridx = 1; gbc_itemComboBox.gridy = 2; gbc_itemComboBox.anchor = GridBagConstraints.FIRST_LINE_START; add(itemNameComboBox, gbc_itemComboBox); itemNameComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { try { initItemValueSelector(); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } }); JLabel itemValue = new JLabel("Item value"); GridBagConstraints gbc_lblItemValue = new GridBagConstraints(); gbc_lblItemValue.insets = new Insets(5, 5, 5, 5); gbc_lblItemValue.weighty = 0.0; gbc_lblItemValue.gridx = 0; gbc_lblItemValue.gridy = 3; gbc_lblItemValue.anchor = GridBagConstraints.FIRST_LINE_START; add(itemValue, gbc_lblItemValue); itemValueComboBox = new JComboBox<String>(); GridBagConstraints gbc_itemValueComboBox = new GridBagConstraints(); gbc_itemValueComboBox.insets = new Insets(0, 0, 5, 0); gbc_itemValueComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_itemValueComboBox.gridx = 1; gbc_itemValueComboBox.gridy = 3; gbc_itemValueComboBox.anchor = GridBagConstraints.FIRST_LINE_START; add(itemValueComboBox, gbc_itemValueComboBox); table = new JTable(); JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mouseClicked(java.awt.event.MouseEvent evt) { int row = table.rowAtPoint(evt.getPoint()); int col = table.columnAtPoint(evt.getPoint()); System.out.println("JQueryPanel:cell click:row=" + row + " column=" + col); if (col == 1) { String label$ = (String) table.getValueAt(row, 1); System.out.println("JQueryPanel:cell click:label=" + label$); Entigrator entigrator = console.getEntigrator(entihome$); String entity$ = entigrator.indx_keyAtLabel(label$); JEntityFacetPanel efp = new JEntityFacetPanel(); String efpLocator$ = efp.getLocator(); efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$); efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, entity$); JConsoleHandler.execute(console, efpLocator$); } } }); GridBagConstraints gbc_scroll_panel = new GridBagConstraints(); gbc_scroll_panel.anchor = GridBagConstraints.NORTH; gbc_scroll_panel.gridwidth = 2; gbc_scroll_panel.weighty = 1.0; gbc_scroll_panel.fill = GridBagConstraints.HORIZONTAL; gbc_scroll_panel.gridx = 0; gbc_scroll_panel.gridy = 4; add(scrollPane, gbc_scroll_panel); scrollPane.setMinimumSize(scrollPane.getPreferredSize()); }
From source file:com.intel.stl.ui.main.view.HealthHistoryView.java
@Override protected JPanel getMainComponent() { if (mainPanel != null) { return mainPanel; }// w ww . j a v a2 s .co m mainPanel = new JPanel(); GridBagLayout gridBag = new GridBagLayout(); mainPanel.setLayout(gridBag); GridBagConstraints gc = new GridBagConstraints(); gc.fill = GridBagConstraints.BOTH; gc.weightx = 1; gc.weighty = 1; gc.gridwidth = GridBagConstraints.REMAINDER; chartPanel = new ChartPanel(null); // chart.PanelsetBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, // UIConstants.INTEL_BORDER_GRAY)); chartPanel.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { chartPanel.setMaximumDrawHeight(e.getComponent().getHeight()); chartPanel.setMaximumDrawWidth(e.getComponent().getWidth()); chartPanel.setMinimumDrawWidth(e.getComponent().getWidth()); chartPanel.setMinimumDrawHeight(e.getComponent().getHeight()); } }); mainPanel.add(chartPanel, gc); gc.gridwidth = 1; gc.insets = new Insets(0, 5, 0, 5); gc.fill = GridBagConstraints.NONE; gc.anchor = GridBagConstraints.WEST; gc.weighty = 0; startTimeLabel = ComponentFactory.getH5Label("start", Font.PLAIN); mainPanel.add(startTimeLabel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; gc.anchor = GridBagConstraints.EAST; endTimeLabel = ComponentFactory.getH5Label("end", Font.PLAIN); mainPanel.add(endTimeLabel, gc); return mainPanel; }