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:org.intermine.install.swing.NewDerivedTypeDialog.java
/** * Initialise to show the properties needed to complete to create the * derived source from the given parent. * // w ww. jav a2 s . c om * @param project The Project being edited. * @param parentType The parent data source type descriptor. * @param name The name of the actual data source to add to the project. */ public void initialise(Project project, SourceInfo parentType, String name) { Container cp = getContentPane(); this.project = project; parentInfo = parentType; nameField.setText(name); typeField.setText(parentType.getSource().getType()); derivedTypeField.setText(name); for (JComponent c : additionalFields) { cp.remove(c); } cp.remove(spacerPanel); cp.remove(buttonPanel); additionalFields.clear(); wrappers.clear(); GridBagConstraints cons = GridBagHelper.defaultConstraints(); cons.gridy = 3; SourceTypeDerivation derivation = parentInfo.getSource().getDerivation(); assert derivation != null : "No derivation on source"; for (PropertyDescriptor descriptor : derivation.getProperty()) { JLabel label = new JLabel(descriptor.getName()); cons.gridx = 0; cons.weightx = 0; cp.add(label, cons); additionalFields.add(label); PropertyComponentWrapper wrapper = PropertyComponentCreator.createComponentFor(descriptor.getName(), descriptor, ""); cons.weightx = 1; cons.gridx++; cp.add(wrapper.getDisplayComponent(), cons); additionalFields.add(wrapper.getDisplayComponent()); wrappers.add(wrapper); cons.gridy++; } cons.gridx = 0; cons.weightx = 1; cons.weighty = 1; cons.gridwidth = GridBagConstraints.REMAINDER; cons.fill = GridBagConstraints.BOTH; cp.add(spacerPanel, cons); cons.gridy++; cons.weighty = 0; cons.fill = GridBagConstraints.HORIZONTAL; cp.add(buttonPanel, cons); pack(); }
From source file:edu.ucla.stat.SOCR.analyses.util.moduls.frm.Panels.Jpan_btn.java
private void getPanel() { this.setLayout(new GridBagLayout()); this.setBorder(BorderFactory.createTitledBorder(Language.getLabel(20))); // File final GridBagConstraints c = new GridBagConstraints(); int gridy = 0; // btn load/*from www .j av a2 s . co m*/ c.gridx = 0; c.gridy = gridy; c.gridwidth = 1; c.gridheight = 1; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(1, 1, 1, 1); strLoad = Language.getLabel(21); // Load btnLoad = new JButton(strLoad); btnLoad.addActionListener(this); add(btnLoad, c); // btn update c.gridx = 1; c.gridy = gridy; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(1, 1, 1, 1); strUpdate = Language.getLabel(110); // Update btnUpdate = new JButton(strUpdate); btnUpdate.addActionListener(this); btnUpdate.setEnabled(false); add(btnUpdate, c); gridy++; // txt file name c.gridx = 0; c.gridy = gridy; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(1, 1, 1, 1); txtFileName = new JTextField(); txtFileName.setText(Language.getLabel(112)); // No file loaded txtFileName.addActionListener(this); txtFileName.setEditable(false); add(txtFileName, c); gridy++; // progress bar c.gridx = 0; c.gridy = gridy; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(1, 1, 1, 1); progressBar = new JProgressBar(0, 100); progressBar.setStringPainted(true); progressBar.setString(""); progressBar.setBorderPainted(false); progressBar.setValue(0); add(progressBar, c); gridy++; }
From source file:savant.view.variation.swing.VariationModule.java
/** * Three of our panels consist of a component next to a scroll-bar *///from w w w .ja v a 2 s. c o m private JPanel populatePanel(JComponent content) { JScrollBar scroller = new JScrollBar(); scroller.setMinimum(1); scroller.addAdjustmentListener(scrollerListener); scrollers.add(scroller); JPanel container = new JPanel(); container.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0; if (content instanceof JLabel) { gbc.anchor = GridBagConstraints.NORTH; gbc.insets = MESSAGE_INSETS; gbc.fill = GridBagConstraints.HORIZONTAL; } else { gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; } container.add(content, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 0.0; gbc.weighty = 1.0; gbc.fill = GridBagConstraints.VERTICAL; gbc.insets = new Insets(0, 0, 0, 0); container.add(scroller, gbc); return container; }
From source file:org.openmicroscopy.shoola.agents.metadata.rnd.GraphicsPane.java
/** * Builds hosting the various sliders/* w ww. j ava 2 s . c om*/ * * @return See above. */ private JPanel buildGeneralPane() { JPanel content = new JPanel(); content.setBackground(UIUtilities.BACKGROUND_COLOR); content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); content.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 2, 2, 0); c.gridy = 0; c.gridx = 0; if (model.isGeneralIndex()) { content.add(previewToolBar, c); c.gridy++; c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.fill = GridBagConstraints.HORIZONTAL; content.add(new JSeparator(), c); c.gridy++; } content.add(controlsBar, c); c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.fill = GridBagConstraints.NONE;//reset to default c.weightx = 0.0; Iterator<ChannelSlider> i = sliders.iterator(); while (i.hasNext()) { c.gridy++; content.add(i.next(), c); } c.gridy++; c.gridwidth = GridBagConstraints.REMAINDER; //end row c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; content.add(viewedBy, c); JPanel p = UIUtilities.buildComponentPanel(content); p.setBackground(content.getBackground()); return p; }
From source file:org.executequery.gui.editor.QueryEditor.java
private void init() throws Exception { // construct the two query text area and results panels statusBar = new QueryEditorStatusBar(); statusBar.setBorder(BorderFactory.createEmptyBorder(0, -1, -2, -2)); editorPanel = new QueryEditorTextPanel(this); resultsPanel = new QueryEditorResultsPanel(this); delegate = new QueryEditorDelegate(this); popup = new QueryEditorPopupMenu(delegate); editorPanel.addEditorPaneMouseListener(popup); baseEditorPanel = new JPanel(new BorderLayout()); baseEditorPanel.add(editorPanel, BorderLayout.CENTER); baseEditorPanel.add(statusBar, BorderLayout.SOUTH); baseEditorPanel/*w w w. j a va 2 s.c om*/ .setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, GUIUtilities.getDefaultBorderColour())); // add to a base panel - when last tab closed visible set // to false on the tab pane and split collapses - want to avoid this resultsBase = new JPanel(new BorderLayout()); resultsBase.add(resultsPanel, BorderLayout.CENTER); if (new SplitPaneFactory().usesCustomSplitPane()) { splitPane = new EditorSplitPane(JSplitPane.VERTICAL_SPLIT, baseEditorPanel, resultsBase); } else { splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, baseEditorPanel, resultsBase); } splitPane.setDividerSize(4); splitPane.setResizeWeight(0.5); // --------------------------------------- // the tool bar and conn combo toolBar = new QueryEditorToolBar(editorPanel.getTextPaneActionMap(), editorPanel.getTextPaneInputMap()); Vector<DatabaseConnection> connections = ConnectionManager.getActiveConnections(); connectionsCombo = new OpenConnectionsComboBox(this, connections); maxRowCountCheckBox = new JCheckBox(); maxRowCountCheckBox.setToolTipText("Enable/disable max records"); maxRowCountCheckBox.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { maxRowCountCheckBoxSelected(); } }); maxRowCountField = new MaxRowCountField(this); toolsPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 0); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridy++; gbc.gridx++; gbc.weightx = 1.0; gbc.gridwidth = GridBagConstraints.REMAINDER; toolsPanel.add(toolBar, gbc); gbc.gridy++; gbc.weightx = 0; gbc.gridwidth = 1; gbc.insets.top = 7; gbc.insets.left = 5; gbc.insets.right = 10; toolsPanel.add(createLabel("Connection:", 'C'), gbc); gbc.gridx++; gbc.weightx = 1.0; gbc.insets.top = 2; gbc.insets.bottom = 2; gbc.insets.left = 0; gbc.insets.right = 0; toolsPanel.add(connectionsCombo, gbc); gbc.gridx++; gbc.weightx = 0; gbc.insets.left = 0; gbc.insets.top = 7; gbc.insets.right = 10; gbc.insets.left = 10; toolsPanel.add(createLabel("Filter:", 'l'), gbc); gbc.gridx++; gbc.weightx = 0.8; gbc.insets.top = 2; gbc.insets.bottom = 2; gbc.insets.right = 2; gbc.insets.left = 0; gbc.fill = GridBagConstraints.BOTH; toolsPanel.add(createResultSetFilterTextField(), gbc); gbc.gridx++; gbc.weightx = 0; gbc.insets.top = 5; gbc.insets.left = 10; toolsPanel.add(maxRowCountCheckBox, gbc); gbc.gridx++; gbc.insets.left = 0; gbc.insets.top = 7; gbc.insets.right = 10; toolsPanel.add(createLabel("Max Rows:", 'R'), gbc); gbc.gridx++; gbc.weightx = 0.3; gbc.insets.top = 2; gbc.insets.bottom = 2; gbc.insets.right = 2; gbc.fill = GridBagConstraints.BOTH; toolsPanel.add(maxRowCountField, gbc); splitPane.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3)); JPanel base = new JPanel(new BorderLayout()); base.add(toolsPanel, BorderLayout.NORTH); base.add(splitPane, BorderLayout.CENTER); gbc.gridy = 1; gbc.gridx = 1; gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.insets.top = 0; gbc.insets.bottom = 0; gbc.insets.left = 0; gbc.insets.right = 0; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.SOUTHEAST; add(base, gbc); // register for connection and keyword events EventMediator.registerListener(this); addDeleteLineActionMapping(); setEditorPreferences(); statusBar.setCaretPosition(1, 1); statusBar.setInsertionMode("INS"); }
From source file:org.fhcrc.cpl.viewer.quant.gui.ProteinQuantSummaryFrame.java
License:asdf
/** * Initialize the GUI components// www . j ava 2s . co m */ protected void initGUI() { //Global stuff setSize(fullWidth, fullHeight); eventPropertiesTable = new QuantEvent.QuantEventPropertiesTable(); eventPropertiesTable.setVisible(true); JScrollPane eventPropsScrollPane = new JScrollPane(); eventPropsScrollPane.setViewportView(eventPropertiesTable); eventPropsScrollPane.setSize(propertiesWidth, propertiesHeight); eventPropertiesDialog = new JDialog(this, "Event Properties"); eventPropertiesDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); eventPropertiesDialog.setSize(propertiesWidth, propertiesHeight); eventPropertiesDialog.setContentPane(eventPropsScrollPane); ListenerHelper helper = new ListenerHelper(this); setTitle("Protein Summary"); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.PAGE_START; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets = new Insets(5, 5, 5, 5); gbc.weighty = 1; gbc.weightx = 1; try { (getOwner()).setIconImage(ImageIO.read(WorkbenchFrame.class.getResourceAsStream("icon.gif"))); } catch (Exception e) { } try { Localizer.renderSwixml("org/fhcrc/cpl/viewer/quant/gui/ProteinQuantSummaryFrame.xml", this); assert null != contentPanel; setContentPane(contentPanel); } catch (Exception x) { ApplicationContext.errorMessage("error creating dialog", x); throw new RuntimeException(x); } buttonSelectAllVisible.setEnabled(false); helper.addListener(buttonSelectAllVisible, "buttonSelectAllVisible_actionPerformed"); buttonDeselectAll.setEnabled(false); helper.addListener(buttonDeselectAll, "buttonDeselectAll_actionPerformed"); buildTurkHITsButton.setEnabled(false); helper.addListener(buildTurkHITsButton, "buttonBuildTurkHITs_actionPerformed"); loadSelectedEventsButton.setEnabled(false); helper.addListener(loadSelectedEventsButton, "buttonLoadSelected_actionPerformed"); autoAssessSelectedEventsButton.setEnabled(false); helper.addListener(autoAssessSelectedEventsButton, "buttonAutoAssess_actionPerformed"); showPropertiesButton.setEnabled(false); helper.addListener(showPropertiesButton, "buttonShowProperties_actionPerformed"); showProteinRatiosButton.setEnabled(false); helper.addListener(showProteinRatiosButton, "buttonShowProteinRatios_actionPerformed"); //summary panel summaryPanel.setBorder(BorderFactory.createLineBorder(Color.gray)); summaryPanel.setPreferredSize(new Dimension(fullWidth, summaryPanelHeight)); summaryPanel.setMinimumSize(new Dimension(200, summaryPanelHeight)); gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = 1; summaryPanel.add(buttonSelectAllVisible, gbc); summaryPanel.add(buttonDeselectAll, gbc); gbc.gridwidth = GridBagConstraints.RELATIVE; summaryPanel.add(showPropertiesButton, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; summaryPanel.add(showProteinRatiosButton, gbc); gbc.gridwidth = 1; summaryPanel.add(loadSelectedEventsButton, gbc); gbc.gridwidth = GridBagConstraints.RELATIVE; summaryPanel.add(autoAssessSelectedEventsButton, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; summaryPanel.add(buildTurkHITsButton, gbc); gbc.fill = GridBagConstraints.BOTH; eventsScrollPane = new JScrollPane(); eventsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); eventsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); eventsPanel = new JPanel(); eventsPanel.setLayout(new GridBagLayout()); eventsTable = new QuantEventsSummaryTable(); eventsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); eventsTable.getSelectionModel().addListSelectionListener(new EventsTableListSelectionHandler()); eventsScrollPane.setViewportView(eventsTable); eventsScrollPane.setMinimumSize(new Dimension(400, 400)); gbc.insets = new Insets(0, 0, 0, 0); mainPanel.add(eventsScrollPane, gbc); logRatioHistogramPanel = new PanelWithLogRatioHistAndFields(); logRatioHistogramPanel.setBorder(BorderFactory.createTitledBorder("Log Ratios")); logRatioHistogramPanel.setPreferredSize(new Dimension(width - 10, 300)); gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 100; gbc.gridwidth = GridBagConstraints.REMAINDER; add(logRatioHistogramPanel, gbc); //status message messageLabel = new JLabel(); messageLabel.setBackground(Color.WHITE); messageLabel.setFont(Font.decode("verdana plain 12")); messageLabel.setText(" "); statusPanel = new JPanel(); gbc.weighty = 1; statusPanel.setPreferredSize(new Dimension(width - 10, 50)); statusPanel.add(messageLabel, gbc); add(statusPanel, gbc); //per-protein event summary table; disembodied //todo: move this into its own class? it's getting kind of complicated proteinRatiosTable = new JTable(); proteinRatiosTable.setVisible(true); ListSelectionModel proteinTableSelectionModel = proteinRatiosTable.getSelectionModel(); proteinTableSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); proteinTableSelectionModel.addListSelectionListener(new ProteinTableListSelectionHandler()); JScrollPane proteinRatiosScrollPane = new JScrollPane(); proteinRatiosScrollPane.setViewportView(proteinRatiosTable); proteinRatiosScrollPane.setPreferredSize(new Dimension(proteinDialogWidth, proteinDialogHeight - PROTEINTABLE_HISTPANEL_HEIGHT - PROTEINTABLE_SCATTERPLOTPANEL_HEIGHT - 70)); proteinRatiosDialog = new JDialog(this, "Protein Ratios"); proteinRatiosDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); proteinRatiosDialog.setSize(proteinDialogWidth, proteinDialogHeight); JPanel proteinRatiosContentPanel = new JPanel(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; proteinRatiosContentPanel.add(proteinRatiosScrollPane, gbc); proteinRatiosDialog.setContentPane(proteinRatiosContentPanel); perProteinLogRatioHistogramPanel = new PanelWithLogRatioHistAndFields(); perProteinLogRatioHistogramPanel.addRangeUpdateListener(new ProteinTableLogRatioHistogramListener()); perProteinLogRatioHistogramPanel.setBorder(BorderFactory.createTitledBorder("Log Ratios")); perProteinLogRatioHistogramPanel .setPreferredSize(new Dimension(proteinDialogWidth - 10, PROTEINTABLE_HISTPANEL_HEIGHT)); gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = GridBagConstraints.REMAINDER; proteinRatiosDialog.add(perProteinLogRatioHistogramPanel, gbc); perProteinPeptideLogRatioPanel = new JPanel(); perProteinPeptideLogRatioPanel.setBorder(BorderFactory.createTitledBorder("By Peptide")); perProteinPeptideLogRatioPanel .setPreferredSize(new Dimension(proteinDialogWidth - 10, PROTEINTABLE_SCATTERPLOTPANEL_HEIGHT)); proteinRatiosDialog.add(perProteinPeptideLogRatioPanel, gbc); }
From source file:com.limegroup.gnutella.gui.LicenseWindow.java
/** Creates the top of the window. */ protected void createTopOfWindow(Container parent) { GridBagConstraints c = new GridBagConstraints(); JLabel img = new URLLabel(getLargeLicenseURLString(), getLargeLicenseIcon()); c.insets = new Insets(4, 4, 2, 0); parent.add(img, c);// w w w. j a v a2 s .co m JComponent line = new Line(ThemeFileHandler.TABLE_BACKGROUND_COLOR.getValue()); c.insets = new Insets(0, 2, 0, 2); c.gridwidth = GridBagConstraints.RELATIVE; c.fill = GridBagConstraints.VERTICAL; parent.add(line, c); JTextArea text = newTextArea(LICENSE.getLicense()); c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(4, 0, 2, 4); parent.add(text, c); }
From source file:savant.view.variation.swing.VariationModule.java
private void showCard(JComponent card, String message) { if (currentCard != card) { if (currentCard != null) { remove(currentCard);//from w ww . j a v a 2 s . c o m } GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTH; if (message != null) { if (card == messagePanel) { messageLabel.setText(message); } else { gbc.insets = new Insets(20, 20, 20, 20); gbc.fill = GridBagConstraints.HORIZONTAL; progressPanel.setMessage(message); } } add(card, gbc); currentCard = card; repaint(); validate(); } }
From source file:pcgen.gui2.tabs.SummaryInfoTab.java
private void initComponents() { this.setFocusCycleRoot(true); this.setFocusTraversalPolicyProvider(true); this.setFocusTraversalPolicy(new SummaryTabFocusTraversalPolicy()); LanguageTableModel.initializeTable(languageTable); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); setPanelTitle(basicsPanel, LanguageBundle.getString("in_sumCharacterBasics")); //$NON-NLS-1$ basicsPanel.setLayout(new GridBagLayout()); deityComboBox.setRenderer(infoBoxRenderer); raceComboBox.setRenderer(infoBoxRenderer); classComboBox.setRenderer(classBoxRenderer); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 0.1;/*w w w .j ava 2 s .c o m*/ gbc.weighty = 0.7; add(basicsPanel, gbc); setPanelTitle(todoPanel, LanguageBundle.getString("in_tipsString")); //$NON-NLS-1$ initTodoPanel(todoPanel); gbc.gridy = 1; gbc.gridheight = GridBagConstraints.REMAINDER; add(todoPanel, gbc); initMiddlePanel(scoresPanel); gbc.gridy = GridBagConstraints.RELATIVE; gbc.weightx = 1; add(scoresPanel, gbc); JPanel rightPanel = new JPanel(); setPanelTitle(racePanel, LanguageBundle.getString("in_raceString")); //$NON-NLS-1$ setPanelTitle(classPanel, LanguageBundle.getString("in_sumClassLevel")); //$NON-NLS-1$ initRightPanel(rightPanel); gbc.weightx = 0.1; gbc.weighty = 1; add(rightPanel, gbc); }
From source file:com.sshtools.common.ui.SshToolsApplicationApplet.java
/** * * * @param t/* w w w . j a v a2s. com*/ */ protected void seriousAppletError(Throwable t) { StringBuffer buf = new StringBuffer(); buf.append("<html><p>A serious error has occured ...</p><br>"); buf.append("<p><font size=\"-1\" color=\"#ff0000\"><b>"); StringWriter writer = new StringWriter(); t.printStackTrace(new PrintWriter(writer, true)); StringTokenizer tk = new StringTokenizer(writer.toString(), "\n"); while (tk.hasMoreTokens()) { String msg = tk.nextToken(); buf.append(msg); if (tk.hasMoreTokens()) { buf.append("<br>"); } } buf.append("</b></font></p><html>"); SshToolsApplicationAppletPanel p = new SshToolsApplicationAppletPanel(); p.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 0, 8, 0); gbc.fill = GridBagConstraints.NONE; UIUtil.jGridBagAdd(p, new JLabel(buf.toString()), gbc, GridBagConstraints.REMAINDER); setAppletComponent(p); }