List of usage examples for java.awt GridBagConstraints GridBagConstraints
public GridBagConstraints()
From source file:cool.pandora.modeller.ui.jpanel.base.NewBagFrame.java
/** * layoutProfileSelection./* w ww . j a va 2 s . c om*/ * * @param contentPane JPanel * @param row int */ private void layoutProfileSelection(final JPanel contentPane, final int row) { // content // profile selection final JLabel bagProfileLabel = new JLabel(bagView.getPropertyMessage("Select Profile:")); bagProfileLabel.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); profileList = new JComboBox<>(bagView.getProfileStore().getProfileNames()); profileList.setName(bagView.getPropertyMessage("bag.label.projectlist")); profileList.setSelectedItem(bagView.getPropertyMessage("bag.project.noproject")); profileList.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); GridBagConstraints glbc = new GridBagConstraints(); final JLabel spacerLabel = new JLabel(); glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); contentPane.add(bagProfileLabel, glbc); glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); contentPane.add(profileList, glbc); glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); contentPane.add(spacerLabel, glbc); }
From source file:com.socrata.datasync.ui.MetadataJobTab.java
public MetadataJobTab(MetadataJob job, JFrame containingFrame) { this.metadataJob = job; mainFrame = containingFrame;/*from www . j a va 2s. c o m*/ // build tab panel form //jobPanel = new JPanel(new GridLayout(0,2)); jobPanel = new JPanel(new GridBagLayout()); // set FlowLayouts FlowLayout flowLeft = new FlowLayout(FlowLayout.LEFT, 0, 0); FlowLayout flowRight = new FlowLayout(FlowLayout.LEFT, 0, JOB_FIELD_VGAP); //Dataset ID Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Dataset ID", DATASET_ID_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 0)); JPanel datasetIDTextFieldContainer = new JPanel(flowRight); datasetIDTextField = new JTextField(); datasetIDTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); datasetIDTextFieldContainer.add(datasetIDTextField); jobPanel.add(datasetIDTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 0)); //Load Metadata Button jobPanel.add(new JLabel("")); JPanel loadMetadataButtonContainer = new JPanel(flowRight); JButton loadMetadataButton = new JButton("Load Current Dataset Metadata"); loadMetadataButton.addActionListener(new LoadMetadataActionListener()); loadMetadataButtonContainer.add(loadMetadataButton); loadMetadataButtonContainer.add(UIUtility.generateHelpBubble(LOAD_METADATA_TIP_TEXT)); jobPanel.add(loadMetadataButtonContainer, UIUtility.getGridBagFieldConstraints(1, 1)); //Title Text Field jobPanel.add(UIUtility.generateLabelWithHelpBubble("Title", TITLE_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 2)); JPanel titleTextFieldContainer = new JPanel(flowRight); titleTextField = new JTextField(); titleTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); titleTextFieldContainer.add(titleTextField); jobPanel.add(titleTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 2)); //Description Text Area jobPanel.add( UIUtility.generateLabelWithHelpBubble("Description", DESCRIPTION_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 3)); JPanel descriptionTextFieldContainer = new JPanel(); descriptionTextArea = new JTextArea(5, 33); descriptionTextArea.setLineWrap(true); descriptionTextArea.setWrapStyleWord(true); JScrollPane descriptionScrollPane = new JScrollPane(descriptionTextArea); descriptionTextFieldContainer.add(descriptionScrollPane); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 1; constraints.gridy = 3; constraints.weightx = 0; constraints.anchor = GridBagConstraints.LINE_START; constraints.ipadx = -10; //Not sure why, but text area was getting extra margin so left edge didn't line up with other fields jobPanel.add(descriptionTextFieldContainer, constraints); //Category Text Field jobPanel.add(UIUtility.generateLabelWithHelpBubble("Category", CATEGORY_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 4)); JPanel categoryTextFieldContainer = new JPanel(flowRight); categoryTextField = new JTextField(); categoryTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); categoryTextFieldContainer.add(categoryTextField); jobPanel.add(categoryTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 4)); //Tags/Keywords Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Tags/Keywords", KEYWORDS_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 5)); JPanel keywordsTextFieldContainer = new JPanel(flowRight); keywordsTextField = new JTextField(); keywordsTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); keywordsTextFieldContainer.add(keywordsTextField); jobPanel.add(keywordsTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 5)); //License Type Combo Box jobPanel.add( UIUtility.generateLabelWithHelpBubble("License Type", LICENSE_TYPE_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 6)); JPanel licenseTypeContainer = new JPanel(flowRight); licenseTypeComboBox = new JComboBox(); for (LicenseType licenseType : LicenseType.values()) { licenseTypeComboBox.addItem(licenseType); } licenseTypeContainer.add(licenseTypeComboBox); jobPanel.add(licenseTypeContainer, UIUtility.getGridBagFieldConstraints(1, 6)); //Data Provided By Text Field jobPanel.add(UIUtility.generateLabelWithHelpBubble("Data Provided By", DATA_PROVIDED_BY_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 7)); JPanel dataProvidedByTextFieldContainer = new JPanel(flowRight); dataProvidedByTextField = new JTextField(); dataProvidedByTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); dataProvidedByTextFieldContainer.add(dataProvidedByTextField); jobPanel.add(dataProvidedByTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 7)); //Source Link Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Source Link", SOURCE_LINK_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 8)); JPanel sourceLinkTextFieldContainer = new JPanel(flowRight); sourceLinkTextField = new JTextField(); sourceLinkTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); sourceLinkTextFieldContainer.add(sourceLinkTextField); jobPanel.add(sourceLinkTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 8)); //Contact Info Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Contact Info", CONTACT_INFO_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 9)); JPanel contactInfoTextFieldContainer = new JPanel(flowRight); contactInfoTextField = new JTextField(); contactInfoTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); contactInfoTextFieldContainer.add(contactInfoTextField); jobPanel.add(contactInfoTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 9)); //Command to execute jobPanel.add(UIUtility.generateLabelWithHelpBubble("Command to execute with scheduler", RUN_COMMAND_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 10)); JPanel runCommandTextFieldContainer = new JPanel(flowRight); runCommandTextField = new JTextField(DEFAULT_RUN_JOB_COMMAND); runCommandTextField.setPreferredSize(new Dimension(JOB_COMMAND_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); runCommandTextField.setEditable(false); runCommandTextField.addMouseListener(new JobCommandTextFieldListener()); runCommandTextFieldContainer.add(runCommandTextField); JButton copyJobCommandButton = new JButton("Copy to clipboard"); copyJobCommandButton.addActionListener(new CopyJobCommandListener()); runCommandTextFieldContainer.add(copyJobCommandButton); jobPanel.add(runCommandTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 10)); // Load job data into fields populateFieldsFromJobData(); jobTabTitleLabel = new JLabel(job.getJobFilename()); }
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapFillingFrame.java
/** * Constructor.//from ww w . j a v a2s. c om */ public GapFillingFrame(final AbstractTabView atv, final Instances dataSet, final Attribute attr, final int dateIdx, final int valuesBeforeAndAfter, final int position, final int gapsize, final StationsDataProvider gcp, final boolean inBatchMode) { super(); setTitle("Gap filling for " + attr.name() + " (" + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position).value(dateIdx)) + " -> " + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position + gapsize).value(dateIdx)) + ")"); LogoHelper.setLogo(this); this.atv = atv; this.dataSet = dataSet; this.attr = attr; this.dateIdx = dateIdx; this.valuesBeforeAndAfter = valuesBeforeAndAfter; this.position = position; this.gapsize = gapsize; this.gcp = gcp; final Instances testds = WekaDataProcessingUtil.buildFilteredDataSet(dataSet, 0, dataSet.numAttributes() - 1, Math.max(0, position - valuesBeforeAndAfter), Math.min(position + gapsize + valuesBeforeAndAfter, dataSet.numInstances() - 1)); this.attrNames = WekaTimeSeriesUtil.getNamesOfAttributesWithoutGap(testds); this.isGapSimulated = (this.attrNames.contains(attr.name())); this.originaldataSet = new Instances(dataSet); if (this.isGapSimulated) { setTitle(getTitle() + " [SIMULATED GAP]"); /*final JXLabel fictiveGapLabel=new JXLabel(" FICTIVE GAP"); fictiveGapLabel.setForeground(Color.RED); fictiveGapLabel.setFont(new Font(fictiveGapLabel.getFont().getName(), Font.PLAIN,fictiveGapLabel.getFont().getSize()*2)); final JXPanel fictiveGapPanel=new JXPanel(); fictiveGapPanel.setLayout(new BorderLayout()); fictiveGapPanel.add(fictiveGapLabel,BorderLayout.CENTER); getContentPane().add(fictiveGapPanel,BorderLayout.NORTH);*/ this.attrNames.remove(attr.name()); this.originalDataBeforeGapSimulation = dataSet.attributeToDoubleArray(attr.index()); for (int i = position; i < position + gapsize; i++) dataSet.instance(i).setMissing(attr); } final Object[] attrNamesObj = this.attrNames.toArray(); this.centerPanel = new JXPanel(); this.centerPanel.setLayout(new BorderLayout()); getContentPane().add(this.centerPanel, BorderLayout.CENTER); //final JXPanel algoPanel=new JXPanel(); //getContentPane().add(algoPanel,BorderLayout.NORTH); final JXPanel filterPanel = new JXPanel(); //filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.Y_AXIS)); filterPanel.setLayout(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 1; gbc.weighty = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(10, 10, 10, 10); getContentPane().add(filterPanel, BorderLayout.WEST); final JXComboBox algoCombo = new JXComboBox(Algo.values()); algoCombo.setBorder(new TitledBorder("Algorithm")); filterPanel.add(algoCombo, gbc); gbc.gridy++; final JXLabel infoLabel = new JXLabel("Usable = with no missing values on the period"); //infoLabel.setBorder(new TitledBorder("")); filterPanel.add(infoLabel, gbc); gbc.gridy++; final JList<Object> timeSeriesList = new JList<Object>(attrNamesObj); timeSeriesList.setBorder(new TitledBorder("Usable time series")); timeSeriesList.setSelectionMode(DefaultListSelectionModel.MULTIPLE_INTERVAL_SELECTION); final JScrollPane jcpMap = new JScrollPane(timeSeriesList); jcpMap.setPreferredSize(new Dimension(225, 150)); jcpMap.setMinimumSize(new Dimension(225, 150)); filterPanel.add(jcpMap, gbc); gbc.gridy++; final JXPanel mapPanel = new JXPanel(); mapPanel.setBorder(new TitledBorder("")); mapPanel.setLayout(new BorderLayout()); mapPanel.add(gcp.getMapPanel(Arrays.asList(attr.name()), this.attrNames, true), BorderLayout.CENTER); filterPanel.add(mapPanel, gbc); gbc.gridy++; final JXLabel mssLabel = new JXLabel( "<html>Most similar usable serie: <i>[... computation ...]</i></html>"); mssLabel.setBorder(new TitledBorder("")); filterPanel.add(mssLabel, gbc); gbc.gridy++; final JXLabel nsLabel = new JXLabel("<html>Nearest usable serie: <i>[... computation ...]</i></html>"); nsLabel.setBorder(new TitledBorder("")); filterPanel.add(nsLabel, gbc); gbc.gridy++; final JXLabel ussLabel = new JXLabel("<html>Upstream serie: <i>[... computation ...]</i></html>"); ussLabel.setBorder(new TitledBorder("")); filterPanel.add(ussLabel, gbc); gbc.gridy++; final JXLabel dssLabel = new JXLabel("<html>Downstream serie: <i>[... computation ...]</i></html>"); dssLabel.setBorder(new TitledBorder("")); filterPanel.add(dssLabel, gbc); gbc.gridy++; final JCheckBox hideOtherSeriesCB = new JCheckBox("Hide the others series"); hideOtherSeriesCB.setSelected(DEFAULT_HIDE_OTHER_SERIES_OPTION); filterPanel.add(hideOtherSeriesCB, gbc); gbc.gridy++; final JCheckBox showErrorCB = new JCheckBox("Show error on plot"); filterPanel.add(showErrorCB, gbc); gbc.gridy++; final JCheckBox zoomCB = new JCheckBox("Auto-adjusted size"); zoomCB.setSelected(DEFAULT_ZOOM_OPTION); filterPanel.add(zoomCB, gbc); gbc.gridy++; final JCheckBox multAxisCB = new JCheckBox("Multiple axis"); filterPanel.add(multAxisCB, gbc); gbc.gridy++; final JCheckBox showEnvelopeCB = new JCheckBox("Show envelope (all algorithms, SLOW)"); filterPanel.add(showEnvelopeCB, gbc); gbc.gridy++; final JXButton showModelButton = new JXButton("Show the model"); filterPanel.add(showModelButton, gbc); gbc.gridy++; showModelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JXFrame dialog = new JXFrame(); dialog.setTitle("Model"); LogoHelper.setLogo(dialog); dialog.getContentPane().removeAll(); dialog.getContentPane().setLayout(new BorderLayout()); final JTextPane modelTxtPane = new JTextPane(); modelTxtPane.setText(gapFiller.getModel()); modelTxtPane.setBackground(Color.WHITE); modelTxtPane.setEditable(false); final JScrollPane jsp = new JScrollPane(modelTxtPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jsp.setSize(new Dimension(400 - 20, 400 - 20)); dialog.getContentPane().add(jsp, BorderLayout.CENTER); dialog.setSize(new Dimension(400, 400)); dialog.setLocationRelativeTo(centerPanel); dialog.pack(); dialog.setVisible(true); } }); algoCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); showModelButton.setEnabled(gapFiller.hasExplicitModel()); } catch (final Exception e1) { e1.printStackTrace(); } } }); timeSeriesList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); mapPanel.removeAll(); final List<String> currentlySelected = new ArrayList<String>(); currentlySelected.add(attr.name()); for (final Object sel : timeSeriesList.getSelectedValues()) currentlySelected.add(sel.toString()); mapPanel.add(gcp.getMapPanel(currentlySelected, attrNames, true), BorderLayout.CENTER); } catch (final Exception e1) { e1.printStackTrace(); } } }); hideOtherSeriesCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (final Exception e1) { e1.printStackTrace(); } } }); showErrorCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); zoomCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); showEnvelopeCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); multAxisCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); this.inBatchMode = inBatchMode; if (!inBatchMode) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), new int[0], DEFAULT_HIDE_OTHER_SERIES_OPTION, false, DEFAULT_ZOOM_OPTION, false, false); showModelButton.setEnabled(gapFiller.hasExplicitModel()); } catch (Exception e1) { e1.printStackTrace(); } } if (!inBatchMode) { /* automatically select computed series */ new AbstractSimpleAsync<Void>(true) { @Override public Void execute() throws Exception { mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames, false); mssLabel.setText("<html>Most similar usable serie: <b>" + mostSimilar + "</b></html>"); nearest = gcp.findNearestStation(attr.name(), attrNames); nsLabel.setText("<html>Nearest usable serie: <b>" + nearest + "</b></html>"); upstream = gcp.findUpstreamStation(attr.name(), attrNames); if (upstream != null) { ussLabel.setText("<html>Upstream usable serie: <b>" + upstream + "</b></html>"); } else { ussLabel.setText("<html>Upstream usable serie: <b>N/A</b></html>"); } downstream = gcp.findDownstreamStation(attr.name(), attrNames); if (downstream != null) { dssLabel.setText("<html>Downstream usable serie: <b>" + downstream + "</b></html>"); } else { dssLabel.setText("<html>Downstream usable serie: <b>N/A</b></html>"); } timeSeriesList.setSelectedIndices( new int[] { attrNames.indexOf(mostSimilar), attrNames.indexOf(nearest), attrNames.indexOf(upstream), attrNames.indexOf(downstream) }); return null; } @Override public void onSuccess(final Void result) { } @Override public void onFailure(final Throwable caught) { caught.printStackTrace(); } }.start(); } else { try { mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames, false); } catch (Exception e1) { e1.printStackTrace(); } nearest = gcp.findNearestStation(attr.name(), attrNames); upstream = gcp.findUpstreamStation(attr.name(), attrNames); downstream = gcp.findDownstreamStation(attr.name(), attrNames); } }
From source file:com.wet.wired.jsr.player.JPlayer.java
public void showWindow() { setTitle("TestingOwl Player"); setIconImage(owl.getWelcomeIcon().getImage()); getContentPane().removeAll();// w ww .j av a 2 s . co m JPanel panel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); panel.setLayout(gbl); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { closePlayer(); System.exit(0); } }); open = new JButton("Open Recording"); open.setActionCommand("open"); open.addActionListener(this); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0; gbc.weighty = 1; panel.add(open, gbc); reset = new JButton("Reset"); reset.setActionCommand("reset"); reset.setEnabled(false); reset.addActionListener(this); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 0; gbc.weighty = 1; panel.add(reset, gbc); play = new JButton("Play"); play.setActionCommand("play"); play.setEnabled(false); play.addActionListener(this); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 2; gbc.gridy = 0; gbc.weightx = 0; gbc.weighty = 1; panel.add(play, gbc); fastForward = new JButton("Fast Forward"); fastForward.setActionCommand("fastForward"); fastForward.setEnabled(false); fastForward.addActionListener(this); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 3; gbc.gridy = 0; gbc.weightx = 0; gbc.weighty = 1; panel.add(fastForward, gbc); pause = new JButton("Pause"); pause.setActionCommand("pause"); pause.setEnabled(false); pause.addActionListener(this); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 4; gbc.gridy = 0; gbc.weightx = 0; gbc.weighty = 1; panel.add(pause, gbc); close = new JButton("Close File"); close.setActionCommand("close"); close.setEnabled(false); close.addActionListener(this); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 5; gbc.gridy = 0; gbc.weightx = 0; gbc.weighty = 1; panel.add(close, gbc); // slider gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 6; gbc.gridy = 0; gbc.weightx = 1; gbc.weighty = 1; panel.add(createSliderLayout(), gbc); soundLevel.setSize(30, (int) close.getSize().getHeight()); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 7; gbc.gridy = 0; gbc.weightx = 0; gbc.weighty = 1; panel.add(soundLevel, gbc); recorder = new JButton("to Recorder"); recorder.setActionCommand("recorder"); recorder.setEnabled(true); recorder.addActionListener(this); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 8; gbc.gridy = 0; gbc.weightx = 0; gbc.weighty = 1; panel.add(recorder, gbc); panel.doLayout(); this.getContentPane().add(panel, BorderLayout.NORTH); panel = new JPanel(); panel.setLayout(new GridLayout(1, 2)); frameLabel = new JLabel("Frame: 0 Time: 0"); frameLabel.setForeground(Color.black); text = new JLabel("No recording selected"); text.setForeground(Color.black); panel.add(text); panel.add(frameLabel); this.getContentPane().add(panel, BorderLayout.SOUTH); this.setSize(700, this.getHeight()); this.pack(); this.setVisible(true); }
From source file:edu.harvard.mcz.imagecapture.SpecimenBrowser.java
/** * This method initializes jPanel /*from w ww .ja v a 2 s .c om*/ * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.fill = GridBagConstraints.BOTH; gridBagConstraints4.gridy = 0; gridBagConstraints4.weightx = 1.0; gridBagConstraints4.gridx = 7; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 6; gridBagConstraints3.gridy = 0; jLabel3 = new JLabel(); jLabel3.setText("Drawer:"); GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.fill = GridBagConstraints.BOTH; gridBagConstraints21.gridy = 0; gridBagConstraints21.weightx = 1.0; gridBagConstraints21.gridx = 5; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 4; gridBagConstraints11.gridy = 0; jLabel2 = new JLabel(); jLabel2.setText("Family:"); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 2; gridBagConstraints2.insets = new Insets(0, 5, 0, 0); gridBagConstraints2.gridy = 0; jLabel1 = new JLabel(); jLabel1.setText("Workflow:"); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.anchor = GridBagConstraints.WEST; gridBagConstraints1.gridx = 3; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; jLabel = new JLabel(); jLabel.setText("Find Barcode:"); jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(jLabel, new GridBagConstraints()); jPanel.add(getJTextField(), gridBagConstraints); jPanel.add(getJComboBox(), gridBagConstraints1); jPanel.add(jLabel1, gridBagConstraints2); jPanel.add(jLabel2, gridBagConstraints11); jPanel.add(getJTextFieldFamily(), gridBagConstraints21); jPanel.add(jLabel3, gridBagConstraints3); jPanel.add(getJTextFieldDrawerNumber(), gridBagConstraints4); } return jPanel; }
From source file:com.db4o.sync4o.ui.Db4oSyncSourceConfigPanel.java
private void setupControls() { // Layout and setup UI components... setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); add(_namePanel);// ww w .ja v a 2 s. c o m _namePanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(_fieldsPanel); _fieldsPanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(_classConfigsTree); _classConfigsTree.setAlignmentX(Component.LEFT_ALIGNMENT); _classConfigsTree.setPreferredSize(new Dimension(300, 300)); add(_buttonsPanel); _buttonsPanel.setAlignmentX(Component.LEFT_ALIGNMENT); JLabel l; // Admin UI Management Panels use a title // (in a particular "title font") to identify themselves l = new JLabel("Edit Db4oSyncSource Configuration", SwingConstants.CENTER); l.setBorder(new TitledBorder("")); l.setFont(titlePanelFont); _namePanel.add(l); GridBagConstraints labelConstraints = new GridBagConstraints(); labelConstraints.gridwidth = 1; labelConstraints.fill = GridBagConstraints.NONE; labelConstraints.weightx = 0.0; labelConstraints.gridx = 0; labelConstraints.gridy = 0; labelConstraints.anchor = GridBagConstraints.EAST; GridBagConstraints fieldConstraints = new GridBagConstraints(); fieldConstraints.gridwidth = 2; fieldConstraints.fill = GridBagConstraints.HORIZONTAL; fieldConstraints.weightx = 1.0; fieldConstraints.gridx = 1; fieldConstraints.gridy = 0; _fieldsPanel.add(new JLabel("Source URI: "), labelConstraints); _fieldsPanel.add(_sourceUriValue, fieldConstraints); labelConstraints.gridy = GridBagConstraints.RELATIVE; fieldConstraints.gridy = GridBagConstraints.RELATIVE; _fieldsPanel.add(new JLabel("Name: "), labelConstraints); _fieldsPanel.add(_nameValue, fieldConstraints); fieldConstraints.gridwidth = 1; _fieldsPanel.add(new JLabel("db4o File: "), labelConstraints); _fieldsPanel.add(_dbFileValue, fieldConstraints); _dbFileValue.setEditable(false); fieldConstraints.gridwidth = 2; GridBagConstraints buttonConstraints = new GridBagConstraints(); buttonConstraints.gridwidth = 1; buttonConstraints.fill = GridBagConstraints.NONE; buttonConstraints.gridx = 2; buttonConstraints.gridy = 3; _dbFileLocateButton.setText("..."); _fieldsPanel.add(_dbFileLocateButton, buttonConstraints); buttonConstraints.gridwidth = 3; buttonConstraints.fill = GridBagConstraints.NONE; buttonConstraints.gridx = 0; buttonConstraints.gridy = GridBagConstraints.RELATIVE; buttonConstraints.anchor = GridBagConstraints.CENTER; // Ensure all the controls use the Admin UI standard font Component[] components = _fieldsPanel.getComponents(); for (int i = 0; i < components.length; i++) { Component c = components[i]; c.setFont(defaultFont); } _confirmButton.setText("Add"); _buttonsPanel.add(_confirmButton); }
From source file:be.vds.jtbdive.client.view.core.dive.profile.DiveProfileGraphicDetailPanel.java
private Component createControls() { JPanel controlPanel = new JPanel(new GridBagLayout()); controlPanel.setOpaque(false);//from w ww. j a va 2s.com GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(5, 5, 5, 5); GridBagLayoutManager.addComponent(controlPanel, createInstantDataPanel(), c, 0, 0, 1, 1, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.CENTER); GridBagLayoutManager.addComponent(controlPanel, createWarningsPanel(), c, 0, 1, 1, 1, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.CENTER); GridBagLayoutManager.addComponent(controlPanel, createOptionsPanel(), c, 0, 2, 1, 1, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.CENTER); GridBagLayoutManager.addComponent(controlPanel, createEditorButton(), c, 0, 3, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH); GridBagLayoutManager.addComponent(controlPanel, createImportExportButtons(), c, 0, 4, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH); GridBagLayoutManager.addComponent(controlPanel, Box.createVerticalGlue(), c, 0, 5, 1, 1, 1, 1, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER); return controlPanel; }
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);//from w ww . j a va2s .c o m 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.att.aro.ui.view.menu.tools.RegexWizard.java
public void init() { GoogleAnalyticsUtil.getGoogleAnalyticsInstance().sendViews("VideoParserWizard"); setDefaultCloseOperation(RegexWizard.DISPOSE_ON_CLOSE); enableCheckBoxes(true);/* w ww . j a va 2 s .c o m*/ this.setSize(815, 800); this.setMaximumSize(new Dimension(815, 800)); this.setMinimumSize(new Dimension(815, 700)); this.setModal(false); this.setTitle(resourceBundle.getString("videoParser.wizard.title")); this.setLocationRelativeTo(getOwner()); this.setAlwaysOnTop(true); this.setResizable(false); setLayout(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.fill = GridBagConstraints.BOTH; constraint.gridx = 0; constraint.gridy = 0; constraint.weightx = 1; constraint.weighty = 0.6; constraint.gridwidth = 2; add(getFieldPanel(), constraint); constraint.gridy = 1; constraint.gridwidth = 1; constraint.weighty = 0.38; constraint.weightx = 0.4; constraint.insets = new Insets(0, 2, 0, 5); add(getMatcherPanel(), constraint); constraint.weightx = 0.5; constraint.gridx = 1; constraint.insets = new Insets(0, 1, 0, 2); add(getResultPanel(), constraint); constraint.weightx = 1; constraint.gridy = 2; constraint.gridx = 0; constraint.weighty = 0.02; constraint.gridwidth = 2; add(getBottomPanel(), constraint); this.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent e) { clear(); } }); pack(); }
From source file:net.sf.taverna.t2.workbench.cagrid.CaGridComponent.java
private void addResultPanel() { GridBagConstraints c = new GridBagConstraints(); c.gridx = 0;/*from w w w. j av a2 s . c om*/ c.gridy = ++row; c.fill = GridBagConstraints.BOTH; c.weightx = 0.01; c.weighty = 0.01; c.anchor = GridBagConstraints.SOUTHEAST; c.gridwidth = GridBagConstraints.REMAINDER; resultPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); resultPanel.setDividerLocation(200); resultPanel.setBorder(null); runListModel = new DefaultListModel(); runList = new JList(runListModel); runList.setBorder(new EmptyBorder(5, 5, 5, 5)); runList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); runListPanel = new JPanel(new BorderLayout()); runListPanel.setBorder(LineBorder.createGrayLineBorder()); JLabel worklflowRunsLabel = new JLabel("Workflow Runs"); worklflowRunsLabel.setBorder(new EmptyBorder(5, 5, 5, 5)); removeCaGridRunsButton = new JButton("Remove"); // button to remove previous workflow runs removeCaGridRunsButton.setAlignmentX(JComponent.RIGHT_ALIGNMENT); removeCaGridRunsButton.setEnabled(false); removeCaGridRunsButton.setToolTipText("Remove caGrid run(s)"); removeCaGridRunsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] selected = runList.getSelectedIndices(); for (int i = selected.length - 1; i >= 0; i--) { CaGridRun cr = (CaGridRun) runListModel.get(selected[i]); //delete the EPR file File file = new File(new File(System.getProperty("user.home")), cr.workflowid + ".epr"); file.delete(); System.out.println(cr.workflowid + ".epr deleted"); runListModel.remove(selected[i]); } // Set the first item as selected - if there is one if (runListModel.size() > 0) { runList.setSelectedIndex(0); } else { resultText.setText(""); resultText.revalidate(); } } }); runListPanel.add(worklflowRunsLabel, BorderLayout.NORTH); runListPanel.add(removeCaGridRunsButton, BorderLayout.BEFORE_FIRST_LINE); JScrollPane scrollPane = new JScrollPane(runList); scrollPane.setBorder(null); runListPanel.add(scrollPane, BorderLayout.CENTER); // loadWorkflowRunsFromStoredEPRFiles(): add CaGridRun to runList for each EPR // add two buttons: remove and refresh status runList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { Object selection = runList.getSelectedValue(); if (selection instanceof CaGridRun) { removeCaGridRunsButton.setEnabled(true); CaGridRun dataflowRun = (CaGridRun) selection; // update status and refresh outputPanel String resultDisplayString = updateResultDisplayString(dataflowRun); resultText.setText(resultDisplayString); resultText.setLineWrap(true); resultText.setEditable(false); outputPanel.revalidate(); revalidate(); } else { removeCaGridRunsButton.setEnabled(false); revalidate(); } } } }); resultPanel.setTopComponent(runListPanel); //each output should be a (xml) string outputPanel = new JScrollPane(); resultText = new JTextArea(); outputPanel = new JScrollPane(resultText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); //outputPanel = new JPanel(new BorderLayout()); outputPanel.setBorder(LineBorder.createGrayLineBorder()); outputPanel.setBackground(Color.WHITE); //outputPanel.add(new JLabel("Workflow Execution Outputs shows here.", JLabel.CENTER), null); resultPanel.setBottomComponent(outputPanel); add(resultPanel, c); //add runComponent to the GUI ArrayList<CaGridRun> loadedRunList = loadWorkflowRunsFromStoredEPRFiles(null, (String) services.getSelectedItem()); if (loadedRunList != null) { for (int m = 0; m < loadedRunList.size(); m++) { CaGridRun cr = (CaGridRun) loadedRunList.get(m); runListModel.add(0, cr); } System.out.println(loadedRunList.size() + " EPR loaded."); runList.setSelectedIndex(0); } }