List of usage examples for java.awt GridBagConstraints VERTICAL
int VERTICAL
To view the source code for java.awt GridBagConstraints VERTICAL.
Click Source Link
From source file:org.esa.beam.visat.toolviews.spectrum.SpectrumToolView.java
@Override public JComponent createControl() { final JFreeChart chart = ChartFactory.createXYLineChart(CHART_TITLE, "Wavelength (nm)", "", null, PlotOrientation.VERTICAL, true, true, false); chart.getXYPlot().getRangeAxis().addChangeListener(new AxisChangeListener() { @Override//from w w w . j a va2s . c om public void axisChanged(AxisChangeEvent axisChangeEvent) { if (!isCodeInducedAxisChange) { rangeAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); } } }); chart.getXYPlot().getDomainAxis().addChangeListener(new AxisChangeListener() { @Override public void axisChanged(AxisChangeEvent axisChangeEvent) { if (!isCodeInducedAxisChange) { domainAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); } } }); chart.getXYPlot().getRangeAxis().setAutoRange(false); rangeAxisAdjustmentIsFrozen = false; chart.getXYPlot().getDomainAxis().setAutoRange(false); domainAxisAdjustmentIsFrozen = false; chartPanel = new ChartPanel(chart); chartHandler = new ChartHandler(chart); final XYPlotMarker plotMarker = new XYPlotMarker(chartPanel, new XYPlotMarker.Listener() { @Override public void pointSelected(XYDataset xyDataset, int seriesIndex, Point2D dataPoint) { if (hasDiagram()) { if (cursorSynchronizer == null) { cursorSynchronizer = new CursorSynchronizer(VisatApp.getApp()); } if (!cursorSynchronizer.isEnabled()) { cursorSynchronizer.setEnabled(true); } } } @Override public void pointDeselected() { cursorSynchronizer.setEnabled(false); } }); titleBase = getDescriptor().getTitle(); filterButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Filter24.gif"), false); filterButton.setName("filterButton"); filterButton.setEnabled(false); filterButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectSpectralBands(); recreateChart(); } }); showSpectrumForCursorButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/CursorSpectrum24.gif"), true); showSpectrumForCursorButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { recreateChart(); } }); showSpectrumForCursorButton.setName("showSpectrumForCursorButton"); showSpectrumForCursorButton.setSelected(true); showSpectrumForCursorButton.setToolTipText("Show spectrum at cursor position."); showSpectraForSelectedPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/SelectedPinSpectra24.gif"), true); showSpectraForSelectedPinsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isShowingSpectraForAllPins()) { showSpectraForAllPinsButton.setSelected(false); } else if (!isShowingSpectraForSelectedPins()) { plotMarker.setInvisible(); } recreateChart(); } }); showSpectraForSelectedPinsButton.setName("showSpectraForSelectedPinsButton"); showSpectraForSelectedPinsButton.setToolTipText("Show spectra for selected pins."); showSpectraForAllPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/PinSpectra24.gif"), true); showSpectraForAllPinsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isShowingSpectraForSelectedPins()) { showSpectraForSelectedPinsButton.setSelected(false); } else if (!isShowingSpectraForAllPins()) { plotMarker.setInvisible(); } recreateChart(); } }); showSpectraForAllPinsButton.setName("showSpectraForAllPinsButton"); showSpectraForAllPinsButton.setToolTipText("Show spectra for all pins."); // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // showAveragePinSpectrumButton = ToolButtonFactory.createButton( // UIUtils.loadImageIcon("icons/AverageSpectrum24.gif"), true); // showAveragePinSpectrumButton.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // // todo - implement // } // }); // showAveragePinSpectrumButton.setName("showAveragePinSpectrumButton"); // showAveragePinSpectrumButton.setToolTipText("Show average spectrum of all pin spectra."); showGridButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/SpectrumGrid24.gif"), true); showGridButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { chartHandler.setGridVisible(showGridButton.isSelected()); } }); showGridButton.setName("showGridButton"); showGridButton.setToolTipText("Show diagram grid."); // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // showGraphPointsButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/GraphPoints24.gif"), true); // showGraphPointsButton.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // // todo - implement // JOptionPane.showMessageDialog(null, "Not implemented"); // } // }); // showGraphPointsButton.setName("showGraphPointsButton"); // showGraphPointsButton.setToolTipText("Show graph points grid."); AbstractButton exportSpectraButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); exportSpectraButton.addActionListener(new SpectraExportAction(this)); exportSpectraButton.setToolTipText("Export spectra to text file."); exportSpectraButton.setName("exportSpectraButton"); AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help22.png"), false); helpButton.setName("helpButton"); helpButton.setToolTipText("Help."); /*I18N*/ final JPanel buttonPane = GridBagUtils.createPanel(); final GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets.top = 2; gbc.gridy = 0; buttonPane.add(filterButton, gbc); gbc.gridy++; buttonPane.add(showSpectrumForCursorButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForSelectedPinsButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForAllPinsButton, gbc); gbc.gridy++; // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // buttonPane.add(showAveragePinSpectrumButton, gbc); // gbc.gridy++; buttonPane.add(showGridButton, gbc); gbc.gridy++; // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // buttonPane.add(showGraphPointsButton, gbc); // gbc.gridy++; buttonPane.add(exportSpectraButton, gbc); gbc.gridy++; gbc.insets.bottom = 0; gbc.fill = GridBagConstraints.VERTICAL; gbc.weighty = 1.0; gbc.gridwidth = 2; buttonPane.add(new JLabel(" "), gbc); // filler gbc.fill = GridBagConstraints.NONE; gbc.weighty = 0.0; gbc.gridy = 10; gbc.anchor = GridBagConstraints.EAST; buttonPane.add(helpButton, gbc); chartPanel.setPreferredSize(new Dimension(300, 200)); chartPanel.setBackground(Color.white); chartPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2))); chartPanel.addChartMouseListener(plotMarker); JPanel mainPane = new JPanel(new BorderLayout(4, 4)); mainPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); mainPane.add(BorderLayout.CENTER, chartPanel); mainPane.add(BorderLayout.EAST, buttonPane); mainPane.setPreferredSize(new Dimension(320, 200)); if (getDescriptor().getHelpId() != null) { HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId()); HelpSys.enableHelpKey(mainPane, getDescriptor().getHelpId()); } // Add an internal frame listener to VISAT so that we can update our // spectrum dialog with the information of the currently activated // product scene view. // VisatApp.getApp().addInternalFrameListener(new SpectrumIFL()); VisatApp.getApp().getProductManager().addListener(new ProductManager.Listener() { @Override public void productAdded(ProductManager.Event event) { // ignored } @Override public void productRemoved(ProductManager.Event event) { final Product product = event.getProduct(); if (getCurrentProduct() == product) { chartPanel.getChart().getXYPlot().setDataset(null); setCurrentView(null); setCurrentProduct(null); } if (productToAllSpectraMap.containsKey(product)) { productToAllSpectraMap.remove(product); } if (productToBandsMap.containsKey(product)) { productToBandsMap.remove(product); } PlacemarkGroup pinGroup = product.getPinGroup(); for (int i = 0; i < pinGroup.getNodeCount(); i++) { chartHandler.removePinInformation(pinGroup.get(i)); } } }); final ProductSceneView view = VisatApp.getApp().getSelectedProductSceneView(); if (view != null) { handleViewActivated(view); } else { setCurrentView(view); } updateUIState(); return mainPane; }
From source file:org.openconcerto.erp.core.sales.credit.component.AvoirClientSQLComponent.java
private JPanel getBottomPanel() { // UI/*from w w w. jav a 2 s .c om*/ final JPanel panel = new JPanel(new GridBagLayout()); panel.setOpaque(false); final GridBagConstraints c = new DefaultGridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.weightx = 1; // Colonne 1 this.boxAdeduire.setOpaque(false); this.boxAdeduire.setMinimumSize(new Dimension(430, this.boxAdeduire.getPreferredSize().height)); this.boxAdeduire.setPreferredSize(new Dimension(430, this.boxAdeduire.getPreferredSize().height)); panel.add(this.boxAdeduire, c); this.addView("ID_MODE_REGLEMENT", DEC + ";" + SEP); this.eltModeRegl = (ElementSQLObject) this.getView("ID_MODE_REGLEMENT"); c.gridy++; c.fill = GridBagConstraints.NONE; c.weighty = 1; this.eltModeRegl.setOpaque(false); panel.add(this.eltModeRegl, c); // Colonne 2 : port et remise final JPanel panelPortEtRemise = new JPanel(); panelPortEtRemise.setOpaque(false); panelPortEtRemise.setLayout(new GridBagLayout()); final GridBagConstraints cFrais = new DefaultGridBagConstraints(); DeviseField textPortHT = new DeviseField(5); DeviseField textRemiseHT = new DeviseField(5); // Frais de port cFrais.gridheight = 1; cFrais.fill = GridBagConstraints.VERTICAL; cFrais.weighty = 1; cFrais.gridx = 1; // FIXME implmenter la remise et les port pour les avoirs JLabel labelPortHT = new JLabel(getLabelFor("PORT_HT")); labelPortHT.setHorizontalAlignment(SwingConstants.RIGHT); cFrais.gridy++; // panelPortEtRemise.add(labelPortHT, cFrais); cFrais.gridx++; DefaultGridBagConstraints.lockMinimumSize(textPortHT); // panelPortEtRemise.add(textPortHT, cFrais); // Remise JLabel labelRemiseHT = new JLabel(getLabelFor("REMISE_HT")); labelRemiseHT.setHorizontalAlignment(SwingConstants.RIGHT); cFrais.gridy++; cFrais.gridx = 1; // panelPortEtRemise.add(labelRemiseHT, cFrais); cFrais.gridx++; DefaultGridBagConstraints.lockMinimumSize(textRemiseHT); // panelPortEtRemise.add(textRemiseHT, cFrais); cFrais.gridy++; c.gridx++; c.gridy = 0; c.gridheight = 2; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; panel.add(panelPortEtRemise, c); // Colonne 3 : totaux final DeviseField fieldHT = new DeviseField(); final DeviseField fieldTVA = new DeviseField(); final DeviseField fieldService = new DeviseField(); final DeviseField fieldTTC = new DeviseField(); // SQL addSQLObject(textPortHT, "PORT_HT"); final DeviseField fieldDevise = new DeviseField(); if (getTable().getFieldsName().contains("T_DEVISE")) addSQLObject(fieldDevise, "T_DEVISE"); addSQLObject(textRemiseHT, "REMISE_HT"); addRequiredSQLObject(fieldHT, "MONTANT_HT"); addRequiredSQLObject(fieldTVA, "MONTANT_TVA"); addRequiredSQLObject(fieldTTC, "MONTANT_TTC"); addRequiredSQLObject(fieldService, "MONTANT_SERVICE"); // JTextField poids = new JTextField(); if (getTable().getFieldsName().contains("T_POIDS")) addSQLObject(poids, "T_POIDS"); final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, poids, null); totalTTC.setOpaque(false); c.gridx++; c.gridy = 0; c.gridheight = 2; c.fill = GridBagConstraints.BOTH; panel.add(totalTTC, c); // Listeners textPortHT.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void removeUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void insertUpdate(DocumentEvent e) { totalTTC.updateTotal(); } }); textRemiseHT.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void removeUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void insertUpdate(DocumentEvent e) { totalTTC.updateTotal(); } }); return panel; }
From source file:userinterface.properties.GUIGraphPicker.java
/** This method is called from within the constructor to * initialize the form.// ww w.j ava 2 s. c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; buttonGroup1 = new javax.swing.ButtonGroup(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); topComboLabel = new javax.swing.JLabel(); jPanel6 = new javax.swing.JPanel(); selectAxisConstantCombo = new javax.swing.JComboBox(); jPanel7 = new javax.swing.JPanel(); middleLabel = new javax.swing.JLabel(); constantTablePanel = new javax.swing.JPanel(); jPanel9 = new javax.swing.JPanel(); jPanel10 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); newGraphRadio = new javax.swing.JRadioButton(); existingGraphRadio = new javax.swing.JRadioButton(); jPanel11 = new javax.swing.JPanel(); existingGraphCombo = new javax.swing.JComboBox(); jPanel12 = new javax.swing.JPanel(); seriesNameLabel = new javax.swing.JLabel(); seriesNameField = new javax.swing.JTextField(); jPanel4 = new javax.swing.JPanel(); lineOkayButton = new javax.swing.JButton(); lineCancelButton = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT); jPanel1.setLayout(new java.awt.BorderLayout()); jPanel1.setBorder(new javax.swing.border.TitledBorder("Line Graph")); jPanel1.setFocusable(false); jPanel1.setEnabled(false); GridBagLayout gbl_jPanel3 = new GridBagLayout(); gbl_jPanel3.rowWeights = new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; gbl_jPanel3.columnWeights = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0 }; jPanel3.setLayout(gbl_jPanel3); lblPlotType = new JLabel("Plot type:"); GridBagConstraints gbc_lblPlotType = new GridBagConstraints(); gbc_lblPlotType.anchor = GridBagConstraints.WEST; gbc_lblPlotType.insets = new Insets(0, 0, 5, 5); gbc_lblPlotType.gridx = 1; gbc_lblPlotType.gridy = 0; jPanel3.add(lblPlotType, gbc_lblPlotType); panel = new JPanel(); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.anchor = GridBagConstraints.WEST; gbc_panel.insets = new Insets(0, 0, 5, 5); gbc_panel.fill = GridBagConstraints.VERTICAL; gbc_panel.gridx = 3; gbc_panel.gridy = 0; jPanel3.add(panel, gbc_panel); plotType2d = new JRadioButton("2D"); plotType2d.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { plotType2DRadioActionPerformed(e); } }); panel.add(plotType2d); plotType3d = new JRadioButton("3D"); plotType3d.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { plotType3DRadioActionPerformed(e); } }); panel.add(plotType3d); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new Insets(0, 0, 5, 5); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; jPanel3.add(jPanel5, gridBagConstraints); topComboLabel.setText("Select x axis constant:"); gridBagConstraints_1 = new java.awt.GridBagConstraints(); gridBagConstraints_1.insets = new Insets(0, 0, 5, 5); gridBagConstraints_1.gridx = 1; gridBagConstraints_1.gridy = 2; gridBagConstraints_1.anchor = java.awt.GridBagConstraints.WEST; jPanel3.add(topComboLabel, gridBagConstraints_1); gridBagConstraints_2 = new java.awt.GridBagConstraints(); gridBagConstraints_2.insets = new Insets(0, 0, 5, 5); gridBagConstraints_2.gridx = 2; gridBagConstraints_2.gridy = 1; jPanel3.add(jPanel6, gridBagConstraints_2); selectAxisConstantCombo.setPreferredSize(new java.awt.Dimension(100, 24)); selectAxisConstantCombo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { selectAxisConstantComboActionPerformed(evt); } }); gridBagConstraints_3 = new java.awt.GridBagConstraints(); gridBagConstraints_3.insets = new Insets(0, 0, 5, 5); gridBagConstraints_3.gridx = 3; gridBagConstraints_3.gridy = 2; gridBagConstraints_3.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel3.add(selectAxisConstantCombo, gridBagConstraints_3); gridBagConstraints_4 = new java.awt.GridBagConstraints(); gridBagConstraints_4.insets = new Insets(0, 0, 5, 5); gridBagConstraints_4.gridx = 0; gridBagConstraints_4.gridy = 3; jPanel3.add(jPanel7, gridBagConstraints_4); lblSelectYAxis = new JLabel("Select y axis constant:"); GridBagConstraints gbc_lblSelectYAxis = new GridBagConstraints(); gbc_lblSelectYAxis.anchor = GridBagConstraints.WEST; gbc_lblSelectYAxis.insets = new Insets(0, 0, 5, 5); gbc_lblSelectYAxis.gridx = 1; gbc_lblSelectYAxis.gridy = 4; jPanel3.add(lblSelectYAxis, gbc_lblSelectYAxis); selectYaxisConstantCombo = new JComboBox(); selectYaxisConstantCombo.setPreferredSize(new java.awt.Dimension(100, 24)); selectYaxisConstantCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectYAxisConstantComboActionPerformed(e); } }); GridBagConstraints gbc_selectYaxisConstantCombo = new GridBagConstraints(); gbc_selectYaxisConstantCombo.insets = new Insets(0, 0, 5, 5); gbc_selectYaxisConstantCombo.fill = GridBagConstraints.HORIZONTAL; gbc_selectYaxisConstantCombo.gridx = 3; gbc_selectYaxisConstantCombo.gridy = 4; jPanel3.add(selectYaxisConstantCombo, gbc_selectYaxisConstantCombo); panel_1 = new JPanel(); GridBagConstraints gbc_panel_1 = new GridBagConstraints(); gbc_panel_1.insets = new Insets(0, 0, 5, 5); gbc_panel_1.fill = GridBagConstraints.BOTH; gbc_panel_1.gridx = 1; gbc_panel_1.gridy = 5; jPanel3.add(panel_1, gbc_panel_1); middleLabel.setText("Define other constants:"); gridBagConstraints_5 = new java.awt.GridBagConstraints(); gridBagConstraints_5.insets = new Insets(0, 0, 5, 5); gridBagConstraints_5.gridx = 1; gridBagConstraints_5.gridy = 6; gridBagConstraints_5.anchor = java.awt.GridBagConstraints.WEST; jPanel3.add(middleLabel, gridBagConstraints_5); constantTablePanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints_6 = new java.awt.GridBagConstraints(); gridBagConstraints_6.insets = new Insets(0, 0, 5, 5); gridBagConstraints_6.gridx = 3; gridBagConstraints_6.gridy = 6; gridBagConstraints_6.gridwidth = 3; gridBagConstraints_6.gridheight = 2; gridBagConstraints_6.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints_6.weightx = 1.0; gridBagConstraints_6.weighty = 1.0; jPanel3.add(constantTablePanel, gridBagConstraints_6); gridBagConstraints_7 = new java.awt.GridBagConstraints(); gridBagConstraints_7.insets = new Insets(0, 0, 5, 0); gridBagConstraints_7.gridx = 6; gridBagConstraints_7.gridy = 1; jPanel3.add(jPanel9, gridBagConstraints_7); gridBagConstraints_8 = new java.awt.GridBagConstraints(); gridBagConstraints_8.insets = new Insets(0, 0, 5, 5); gridBagConstraints_8.gridx = 0; gridBagConstraints_8.gridy = 8; jPanel3.add(jPanel10, gridBagConstraints_8); jLabel3.setText("Add Series to:"); gridBagConstraints_9 = new java.awt.GridBagConstraints(); gridBagConstraints_9.insets = new Insets(0, 0, 5, 5); gridBagConstraints_9.gridx = 1; gridBagConstraints_9.gridy = 9; gridBagConstraints_9.anchor = java.awt.GridBagConstraints.WEST; jPanel3.add(jLabel3, gridBagConstraints_9); newGraphRadio.setText("New Graph"); buttonGroup1.add(newGraphRadio); newGraphRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newGraphRadioActionPerformed(evt); } }); gridBagConstraints_10 = new java.awt.GridBagConstraints(); gridBagConstraints_10.insets = new Insets(0, 0, 5, 5); gridBagConstraints_10.gridx = 3; gridBagConstraints_10.gridy = 9; gridBagConstraints_10.anchor = java.awt.GridBagConstraints.WEST; jPanel3.add(newGraphRadio, gridBagConstraints_10); existingGraphRadio.setText("Existing Graph"); buttonGroup1.add(existingGraphRadio); existingGraphRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { existingGraphRadioActionPerformed(evt); } }); gridBagConstraints_11 = new java.awt.GridBagConstraints(); gridBagConstraints_11.insets = new Insets(0, 0, 5, 5); gridBagConstraints_11.gridx = 3; gridBagConstraints_11.gridy = 10; gridBagConstraints_11.anchor = java.awt.GridBagConstraints.WEST; jPanel3.add(existingGraphRadio, gridBagConstraints_11); gridBagConstraints_12 = new java.awt.GridBagConstraints(); gridBagConstraints_12.insets = new Insets(0, 0, 5, 5); gridBagConstraints_12.gridx = 4; gridBagConstraints_12.gridy = 1; jPanel3.add(jPanel11, gridBagConstraints_12); gridBagConstraints_13 = new java.awt.GridBagConstraints(); gridBagConstraints_13.insets = new Insets(0, 0, 5, 5); gridBagConstraints_13.gridx = 5; gridBagConstraints_13.gridy = 10; gridBagConstraints_13.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints_13.anchor = java.awt.GridBagConstraints.WEST; jPanel3.add(existingGraphCombo, gridBagConstraints_13); gridBagConstraints_14 = new java.awt.GridBagConstraints(); gridBagConstraints_14.insets = new Insets(0, 0, 5, 5); gridBagConstraints_14.gridx = 0; gridBagConstraints_14.gridy = 11; jPanel3.add(jPanel12, gridBagConstraints_14); seriesNameLabel.setText("Series name:"); gridBagConstraints_15 = new java.awt.GridBagConstraints(); gridBagConstraints_15.insets = new Insets(0, 0, 0, 5); gridBagConstraints_15.gridx = 1; gridBagConstraints_15.gridy = 12; gridBagConstraints_15.anchor = java.awt.GridBagConstraints.WEST; jPanel3.add(seriesNameLabel, gridBagConstraints_15); gridBagConstraints_16 = new java.awt.GridBagConstraints(); gridBagConstraints_16.insets = new Insets(0, 0, 0, 5); gridBagConstraints_16.gridx = 3; gridBagConstraints_16.gridy = 12; gridBagConstraints_16.gridwidth = 3; gridBagConstraints_16.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel3.add(seriesNameField, gridBagConstraints_16); jPanel1.add(jPanel3, java.awt.BorderLayout.CENTER); jPanel4.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); lineOkayButton.setText("Okay"); lineOkayButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { lineOkayButtonActionPerformed(evt); } }); jPanel4.add(lineOkayButton); lineCancelButton.setText("Cancel"); lineCancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { lineCancelButtonActionPerformed(evt); } }); jPanel4.add(lineCancelButton); jPanel1.add(jPanel4, java.awt.BorderLayout.SOUTH); //jTabbedPane1.addTab("", GUIPrism.getIconFromImage("lineGraph.png"), jPanel1); jPanel2.setBorder(new javax.swing.border.TitledBorder("Bar Graph")); jPanel2.setEnabled(false); //jTabbedPane1.addTab("", GUIPrism.getIconFromImage("barGraph.png"), jPanel2); getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); pack(); }
From source file:shuffle.fwk.service.teams.EditTeamService.java
@SuppressWarnings("serial") private Component makeTeamPanel() { JPanel firstOptionRow = new JPanel(new GridBagLayout()); GridBagConstraints rowc = new GridBagConstraints(); rowc.fill = GridBagConstraints.HORIZONTAL; rowc.weightx = 0.0;// w w w . j av a 2 s.co m rowc.weighty = 0.0; rowc.weightx = 1.0; rowc.gridx = 1; stageChooser = new StageChooser(this); firstOptionRow.add(stageChooser, rowc); rowc.weightx = 0.0; JPanel secondOptionRow = new JPanel(new GridBagLayout()); rowc.gridx = 1; JLabel megaLabel = new JLabel(getString(KEY_MEGA_LABEL)); megaLabel.setToolTipText(getString(KEY_MEGA_TOOLTIP)); secondOptionRow.add(megaLabel, rowc); rowc.gridx = 2; megaChooser = new JComboBox<String>(); megaChooser.setToolTipText(getString(KEY_MEGA_TOOLTIP)); secondOptionRow.add(megaChooser, rowc); rowc.gridx = 3; JPanel progressPanel = new JPanel(new BorderLayout()); megaActive = new JCheckBox(getString(KEY_ACTIVE)); megaActive.setSelected(false); megaActive.setToolTipText(getString(KEY_ACTIVE_TOOLTIP)); progressPanel.add(megaActive, BorderLayout.WEST); megaProgressChooser = new JComboBox<Integer>(); progressPanel.add(megaProgressChooser, BorderLayout.EAST); megaProgressChooser.setToolTipText(getString(KEY_MEGA_PROGRESS_TOOLTIP)); secondOptionRow.add(progressPanel, rowc); JPanel thirdOptionRow = new JPanel(new GridBagLayout()); rowc.gridx = 1; JButton clearTeamButton = new JButton(getString(KEY_CLEAR_TEAM)); clearTeamButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clearTeam(); } }); clearTeamButton.setToolTipText(getString(KEY_CLEAR_TEAM_TOOLTIP)); thirdOptionRow.add(clearTeamButton, rowc); rowc.gridx = 2; woodCheckBox = new JCheckBox(getString(KEY_WOOD)); woodCheckBox.setToolTipText(getString(KEY_WOOD_TOOLTIP)); thirdOptionRow.add(woodCheckBox, rowc); rowc.gridx = 3; metalCheckBox = new JCheckBox(getString(KEY_METAL)); metalCheckBox.setToolTipText(getString(KEY_METAL_TOOLTIP)); thirdOptionRow.add(metalCheckBox, rowc); rowc.gridx = 4; coinCheckBox = new JCheckBox(getString(KEY_COIN)); coinCheckBox.setToolTipText(getString(KEY_COIN_TOOLTIP)); thirdOptionRow.add(coinCheckBox, rowc); rowc.gridx = 5; freezeCheckBox = new JCheckBox(getString(KEY_FREEZE)); freezeCheckBox.setToolTipText(getString(KEY_FREEZE_TOOLTIP)); thirdOptionRow.add(freezeCheckBox, rowc); JPanel topPart = new JPanel(new GridBagLayout()); GridBagConstraints topC = new GridBagConstraints(); topC.fill = GridBagConstraints.HORIZONTAL; topC.weightx = 0.0; topC.weighty = 0.0; topC.gridx = 1; topC.gridy = 1; topC.gridwidth = 1; topC.gridheight = 1; topC.anchor = GridBagConstraints.CENTER; topC.gridy = 1; topPart.add(firstOptionRow, topC); topC.gridy = 2; topPart.add(secondOptionRow, topC); topC.gridy = 3; topPart.add(thirdOptionRow, topC); addOptionListeners(); teamPanel = new JPanel(new WrapLayout()) { // Fix to make it play nice with the scroll bar. @Override public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.width = (int) (d.getWidth() - 20); return d; } }; final JScrollPane scrollPane = new JScrollPane(teamPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) { @Override public Dimension getMinimumSize() { Dimension d = super.getMinimumSize(); d.width = topPart.getMinimumSize().width; d.height = rosterScrollPane.getPreferredSize().height - topPart.getPreferredSize().height; return d; } @Override public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.width = topPart.getMinimumSize().width; d.height = rosterScrollPane.getPreferredSize().height - topPart.getPreferredSize().height; return d; } }; scrollPane.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { scrollPane.revalidate(); } }); scrollPane.getVerticalScrollBar().setUnitIncrement(27); JPanel ret = new JPanel(new GridBagLayout()); GridBagConstraints rc = new GridBagConstraints(); rc.fill = GridBagConstraints.VERTICAL; rc.weightx = 0.0; rc.weighty = 0.0; rc.gridx = 1; rc.gridy = 1; rc.insets = new Insets(5, 5, 5, 5); ret.add(topPart, rc); rc.gridy += 1; rc.weightx = 0.0; rc.weighty = 1.0; rc.insets = new Insets(0, 0, 0, 0); ret.add(scrollPane, rc); return ret; }
From source file:ca.uhn.hl7v2.testpanel.ui.editor.Hl7V2MessageEditorPanel.java
/** * Create the panel./*ww w. j av a2s . c o m*/ */ public Hl7V2MessageEditorPanel(final Controller theController) { setBorder(null); myController = theController; ButtonGroup encGrp = new ButtonGroup(); setLayout(new BorderLayout(0, 0)); mysplitPane = new JSplitPane(); mysplitPane.setResizeWeight(0.5); mysplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); add(mysplitPane); mysplitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent theEvt) { double ratio = (double) mysplitPane.getDividerLocation() / mysplitPane.getHeight(); ourLog.debug("Resizing split to ratio: {}", ratio); Prefs.getInstance().setHl7EditorSplit(ratio); } }); EventQueue.invokeLater(new Runnable() { public void run() { mysplitPane.setDividerLocation(Prefs.getInstance().getHl7EditorSplit()); } }); messageEditorContainerPanel = new JPanel(); messageEditorContainerPanel.setBorder(null); mysplitPane.setRightComponent(messageEditorContainerPanel); messageEditorContainerPanel.setLayout(new BorderLayout(0, 0)); myMessageEditor = new JEditorPane(); Highlighter h = new UnderlineHighlighter(); myMessageEditor.setHighlighter(h); // myMessageEditor.setFont(Prefs.getHl7EditorFont()); myMessageEditor.setSelectedTextColor(Color.black); myMessageEditor.setCaret(new EditorCaret()); myMessageScrollPane = new JScrollPane(myMessageEditor); messageEditorContainerPanel.add(myMessageScrollPane); JToolBar toolBar = new JToolBar(); messageEditorContainerPanel.add(toolBar, BorderLayout.NORTH); toolBar.setFloatable(false); toolBar.setRollover(true); myFollowToggle = new JToggleButton("Follow"); myFollowToggle.setToolTipText("Keep the message tree (above) and the message editor (below) in sync"); myFollowToggle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { theController.setMessageEditorInFollowMode(myFollowToggle.isSelected()); } }); myFollowToggle.setIcon(new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/updown.png"))); myFollowToggle.setSelected(theController.isMessageEditorInFollowMode()); toolBar.add(myFollowToggle); myhorizontalStrut = Box.createHorizontalStrut(20); toolBar.add(myhorizontalStrut); mylabel_4 = new JLabel("Encoding"); toolBar.add(mylabel_4); myRdbtnEr7 = new JRadioButton("ER7"); myRdbtnEr7.setMargin(new Insets(1, 2, 0, 1)); toolBar.add(myRdbtnEr7); myRdbtnXml = new JRadioButton("XML"); myRdbtnXml.setMargin(new Insets(1, 5, 0, 1)); toolBar.add(myRdbtnXml); encGrp.add(myRdbtnEr7); encGrp.add(myRdbtnXml); treeContainerPanel = new JPanel(); mysplitPane.setLeftComponent(treeContainerPanel); treeContainerPanel.setLayout(new BorderLayout(0, 0)); mySpinnerIconOn = new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/spinner.gif")); mySpinnerIconOff = new ImageIcon(); myTreePanel = new Hl7V2MessageTree(theController); myTreePanel.setWorkingListener(new IWorkingListener() { public void startedWorking() { mySpinner.setText(""); mySpinner.setIcon(mySpinnerIconOn); mySpinnerIconOn.setImageObserver(mySpinner); } public void finishedWorking(String theStatus) { mySpinner.setText(theStatus); mySpinner.setIcon(mySpinnerIconOff); mySpinnerIconOn.setImageObserver(null); } }); myTreeScrollPane = new JScrollPane(myTreePanel); myTopTabBar = new JTabbedPane(); treeContainerPanel.add(myTopTabBar); myTopTabBar.setBorder(null); JPanel treeContainer = new JPanel(); treeContainer.setLayout(new BorderLayout(0, 0)); treeContainer.add(myTreeScrollPane); myTopTabBar.add("Message Tree", treeContainer); mytoolBar_1 = new JToolBar(); mytoolBar_1.setFloatable(false); treeContainer.add(mytoolBar_1, BorderLayout.NORTH); mylabel_3 = new JLabel("Show"); mytoolBar_1.add(mylabel_3); myShowCombo = new JComboBox(); mytoolBar_1.add(myShowCombo); myShowCombo.setPreferredSize(new Dimension(130, 27)); myShowCombo.setMinimumSize(new Dimension(130, 27)); myShowCombo.setMaximumSize(new Dimension(130, 32767)); collapseAllButton = new JButton(); collapseAllButton.setBorderPainted(false); collapseAllButton.addMouseListener(new HoverButtonMouseAdapter(collapseAllButton)); collapseAllButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myTreePanel.collapseAll(); } }); collapseAllButton.setToolTipText("Collapse All"); collapseAllButton.setIcon(new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/collapse_all.png"))); mytoolBar_1.add(collapseAllButton); expandAllButton = new JButton(); expandAllButton.setBorderPainted(false); expandAllButton.addMouseListener(new HoverButtonMouseAdapter(expandAllButton)); expandAllButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myTreePanel.expandAll(); } }); expandAllButton.setToolTipText("Expand All"); expandAllButton.setIcon(new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/expand_all.png"))); mytoolBar_1.add(expandAllButton); myhorizontalGlue = Box.createHorizontalGlue(); mytoolBar_1.add(myhorizontalGlue); mySpinner = new JButton(""); mySpinner.setForeground(Color.DARK_GRAY); mySpinner.setHorizontalAlignment(SwingConstants.RIGHT); mySpinner.setMaximumSize(new Dimension(200, 15)); mySpinner.setPreferredSize(new Dimension(200, 15)); mySpinner.setMinimumSize(new Dimension(200, 15)); mySpinner.setBorderPainted(false); mySpinner.setSize(new Dimension(16, 16)); mytoolBar_1.add(mySpinner); myProfileComboboxModel = new ProfileComboModel(); myTablesComboModel = new TablesComboModel(myController); mytoolBar = new JToolBar(); mytoolBar.setFloatable(false); mytoolBar.setRollover(true); treeContainerPanel.add(mytoolBar, BorderLayout.NORTH); myOutboundInterfaceCombo = new JComboBox(); myOutboundInterfaceComboModel = new DefaultComboBoxModel(); mylabel_1 = new JLabel("Send"); mytoolBar.add(mylabel_1); myOutboundInterfaceCombo.setModel(myOutboundInterfaceComboModel); myOutboundInterfaceCombo.setMaximumSize(new Dimension(200, 32767)); mytoolBar.add(myOutboundInterfaceCombo); mySendButton = new JButton("Send"); mySendButton.addMouseListener(new HoverButtonMouseAdapter(mySendButton)); mySendButton.setBorderPainted(false); mySendButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // int selectedIndex = // myOutboundInterfaceComboModel.getIndexOf(myOutboundInterfaceComboModel.getSelectedItem()); int selectedIndex = myOutboundInterfaceCombo.getSelectedIndex(); OutboundConnection connection = myController.getOutboundConnectionList().getConnections() .get(selectedIndex); activateSendingActivityTabForConnection(connection); myController.sendMessages(connection, myMessage, mySendingActivityTable.provideTransmissionCallback()); } }); myhorizontalStrut_2 = Box.createHorizontalStrut(20); myhorizontalStrut_2.setPreferredSize(new Dimension(2, 0)); myhorizontalStrut_2.setMinimumSize(new Dimension(2, 0)); myhorizontalStrut_2.setMaximumSize(new Dimension(2, 32767)); mytoolBar.add(myhorizontalStrut_2); mySendOptionsButton = new JButton("Options"); mySendOptionsButton.setBorderPainted(false); final HoverButtonMouseAdapter sendOptionsHoverAdaptor = new HoverButtonMouseAdapter(mySendOptionsButton); mySendOptionsButton.addMouseListener(sendOptionsHoverAdaptor); mySendOptionsButton.setIcon(new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/sendoptions.png"))); mytoolBar.add(mySendOptionsButton); mySendOptionsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent theE) { if (mySendOptionsPopupDialog != null) { mySendOptionsPopupDialog.doHide(); mySendOptionsPopupDialog = null; return; } mySendOptionsPopupDialog = new SendOptionsPopupDialog(Hl7V2MessageEditorPanel.this, myMessage, mySendOptionsButton, sendOptionsHoverAdaptor); Point los = mySendOptionsButton.getLocationOnScreen(); mySendOptionsPopupDialog.setLocation(los.x, los.y + mySendOptionsButton.getHeight()); mySendOptionsPopupDialog.setVisible(true); } }); mySendButton.setIcon(new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/button_execute.png"))); mytoolBar.add(mySendButton); myhorizontalStrut_1 = Box.createHorizontalStrut(20); mytoolBar.add(myhorizontalStrut_1); mylabel_2 = new JLabel("Validate"); mytoolBar.add(mylabel_2); myProfileCombobox = new JComboBox(); mytoolBar.add(myProfileCombobox); myProfileCombobox.setPreferredSize(new Dimension(200, 27)); myProfileCombobox.setMinimumSize(new Dimension(200, 27)); myProfileCombobox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (myHandlingProfileComboboxChange) { return; } myHandlingProfileComboboxChange = true; try { if (myProfileCombobox.getSelectedIndex() == 0) { myMessage.setValidationContext(null); } else if (myProfileCombobox.getSelectedIndex() == 1) { myMessage.setValidationContext(new DefaultValidation()); } else if (myProfileCombobox.getSelectedIndex() > 0) { ProfileGroup profile = myProfileComboboxModel.myProfileGroups .get(myProfileCombobox.getSelectedIndex()); myMessage.setRuntimeProfile(profile); // } else if (myProfileCombobox.getSelectedItem() == // ProfileComboModel.APPLY_CONFORMANCE_PROFILE) { // IOkCancelCallback<Void> callback = new // IOkCancelCallback<Void>() { // public void ok(Void theArg) { // myProfileComboboxModel.update(); // } // // public void cancel(Void theArg) { // myProfileCombobox.setSelectedIndex(0); // } // }; // myController.chooseAndLoadConformanceProfileForMessage(myMessage, // callback); } } catch (ProfileException e2) { ourLog.error("Failed to load profile", e2); } finally { myHandlingProfileComboboxChange = false; } } }); myProfileCombobox.setMaximumSize(new Dimension(300, 32767)); myProfileCombobox.setModel(myProfileComboboxModel); myhorizontalStrut_4 = Box.createHorizontalStrut(20); myhorizontalStrut_4.setPreferredSize(new Dimension(2, 0)); myhorizontalStrut_4.setMinimumSize(new Dimension(2, 0)); myhorizontalStrut_4.setMaximumSize(new Dimension(2, 32767)); mytoolBar.add(myhorizontalStrut_4); // mySendingPanel = new JPanel(); // mySendingPanel.setBorder(null); // myTopTabBar.addTab("Sending", null, mySendingPanel, null); // mySendingPanel.setLayout(new BorderLayout(0, 0)); mySendingActivityTable = new ActivityTable(); mySendingActivityTable.setController(myController); myTopTabBar.addTab("Sending", null, mySendingActivityTable, null); // mySendingPanelScrollPanel = new JScrollPane(); // mySendingPanelScrollPanel.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); // mySendingPanelScrollPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); // mySendingPanelScrollPanel.setColumnHeaderView(mySendingActivityTable); // // mySendingPanel.add(mySendingPanelScrollPanel, BorderLayout.CENTER); bottomPanel = new JPanel(); bottomPanel.setPreferredSize(new Dimension(10, 20)); bottomPanel.setMinimumSize(new Dimension(10, 20)); add(bottomPanel, BorderLayout.SOUTH); GridBagLayout gbl_bottomPanel = new GridBagLayout(); gbl_bottomPanel.columnWidths = new int[] { 98, 74, 0 }; gbl_bottomPanel.rowHeights = new int[] { 16, 0 }; gbl_bottomPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE }; gbl_bottomPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE }; bottomPanel.setLayout(gbl_bottomPanel); mylabel = new JLabel("Terser Path:"); mylabel.setHorizontalTextPosition(SwingConstants.LEFT); mylabel.setHorizontalAlignment(SwingConstants.LEFT); GridBagConstraints gbc_label = new GridBagConstraints(); gbc_label.fill = GridBagConstraints.VERTICAL; gbc_label.weighty = 1.0; gbc_label.anchor = GridBagConstraints.NORTHWEST; gbc_label.gridx = 0; gbc_label.gridy = 0; bottomPanel.add(mylabel, gbc_label); myTerserPathTextField = new JLabel(); myTerserPathTextField.setForeground(Color.BLUE); myTerserPathTextField.setFont(new Font("Lucida Console", Font.PLAIN, 13)); myTerserPathTextField.setBorder(null); myTerserPathTextField.setBackground(SystemColor.control); myTerserPathTextField.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (StringUtils.isNotEmpty(myTerserPathTextField.getText())) { myTerserPathPopupMenu.show(myTerserPathTextField, 0, 0); } } }); GridBagConstraints gbc_TerserPathTextField = new GridBagConstraints(); gbc_TerserPathTextField.weightx = 1.0; gbc_TerserPathTextField.fill = GridBagConstraints.HORIZONTAL; gbc_TerserPathTextField.gridx = 1; gbc_TerserPathTextField.gridy = 0; bottomPanel.add(myTerserPathTextField, gbc_TerserPathTextField); initLocal(); }
From source file:net.technicpack.launcher.ui.InstallerFrame.java
private void setupStandardInstall(JPanel panel) { panel.setLayout(new GridBagLayout()); JLabel standardSpiel = new JLabel("<html><body align=\"left\" style='margin-right:10px;'>" + resources.getString("launcher.installer.standardspiel") + "</body></html>"); standardSpiel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16)); standardSpiel.setForeground(LauncherFrame.COLOR_WHITE_TEXT); standardSpiel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel.add(standardSpiel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(9, 0, 0, 3), 0, 0)); panel.add(Box.createGlue(), new GridBagConstraints(0, 1, 3, 1, 1.0, 0.7, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); standardDefaultDirectory = new JCheckBox(resources.getString("launcher.installer.default")); standardDefaultDirectory.setOpaque(false); standardDefaultDirectory.setHorizontalAlignment(SwingConstants.RIGHT); standardDefaultDirectory.setBorder(BorderFactory.createEmptyBorder()); standardDefaultDirectory.setIconTextGap(0); standardDefaultDirectory.setSelectedIcon(resources.getIcon("checkbox_closed.png")); standardDefaultDirectory.setIcon(resources.getIcon("checkbox_open.png")); standardDefaultDirectory.setFocusPainted(false); standardDefaultDirectory.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16)); standardDefaultDirectory.setForeground(LauncherFrame.COLOR_WHITE_TEXT); standardDefaultDirectory.setIconTextGap(6); standardDefaultDirectory.setSelected(settings.isPortable() || settings.getTechnicRoot().getAbsolutePath() .equals(SettingsFactory.getTechnicHomeDir().getAbsolutePath())); standardDefaultDirectory.addActionListener(new ActionListener() { @Override/*from www.j a v a 2 s.c o m*/ public void actionPerformed(ActionEvent e) { useDefaultDirectoryChanged(); } }); panel.add(standardDefaultDirectory, new GridBagConstraints(0, 2, 3, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 24, 12, 0), 0, 0)); JLabel installFolderLabel = new JLabel(resources.getString("launcher.installer.folder")); installFolderLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18)); installFolderLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT); panel.add(installFolderLabel, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 24, 0, 8), 0, 0)); String installDir = SettingsFactory.getTechnicHomeDir().getAbsolutePath(); if (!settings.isPortable()) installDir = settings.getTechnicRoot().getAbsolutePath(); standardInstallDir = new JTextField(installDir); standardInstallDir.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18)); standardInstallDir.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL); standardInstallDir.setHighlighter(null); standardInstallDir.setEditable(false); standardInstallDir.setCursor(null); panel.add(standardInstallDir, new GridBagConstraints(1, 3, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0)); standardSelectButton = new RoundedButton(resources.getString("launcher.installer.select")); standardSelectButton.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18)); standardSelectButton.setContentAreaFilled(false); standardSelectButton.setHoverForeground(LauncherFrame.COLOR_BLUE); standardSelectButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectStandard(); } }); panel.add(standardSelectButton, new GridBagConstraints(2, 3, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 16), 0, 0)); useDefaultDirectoryChanged(); panel.add(Box.createGlue(), new GridBagConstraints(0, 4, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); String defaultLocaleText = resources.getString("launcheroptions.language.default"); if (!resources.isDefaultLocaleSupported()) { defaultLocaleText = defaultLocaleText .concat(" (" + resources.getString("launcheroptions.language.unavailable") + ")"); } standardLanguages = new JComboBox(); standardLanguages.addItem(new LanguageItem(ResourceLoader.DEFAULT_LOCALE, defaultLocaleText, resources)); for (int i = 0; i < ResourceLoader.SUPPORTED_LOCALES.length; i++) { standardLanguages .addItem(new LanguageItem(resources.getCodeFromLocale(ResourceLoader.SUPPORTED_LOCALES[i]), ResourceLoader.SUPPORTED_LOCALES[i].getDisplayName(ResourceLoader.SUPPORTED_LOCALES[i]), resources.getVariant(ResourceLoader.SUPPORTED_LOCALES[i]))); } if (!settings.getLanguageCode().equalsIgnoreCase(ResourceLoader.DEFAULT_LOCALE)) { Locale loc = resources.getLocaleFromCode(settings.getLanguageCode()); for (int i = 0; i < ResourceLoader.SUPPORTED_LOCALES.length; i++) { if (loc.equals(ResourceLoader.SUPPORTED_LOCALES[i])) { standardLanguages.setSelectedIndex(i + 1); break; } } } standardLanguages.setBorder(new RoundBorder(LauncherFrame.COLOR_SCROLL_THUMB, 1, 10)); standardLanguages.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14)); standardLanguages.setUI(new LanguageCellUI(resources)); standardLanguages.setForeground(LauncherFrame.COLOR_WHITE_TEXT); standardLanguages.setBackground(LauncherFrame.COLOR_SELECTOR_BACK); standardLanguages.setRenderer(new LanguageCellRenderer(resources, "globe.png", LauncherFrame.COLOR_SELECTOR_BACK, LauncherFrame.COLOR_WHITE_TEXT)); standardLanguages.setEditable(false); standardLanguages.setFocusable(false); standardLanguages.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { standardLanguageChanged(); } }); panel.add(standardLanguages, new GridBagConstraints(0, 5, 1, 0, 0, 0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 8, 8, 0), 0, 0)); RoundedButton install = new RoundedButton(resources.getString("launcher.installer.install")); install.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18)); install.setContentAreaFilled(false); install.setForeground(LauncherFrame.COLOR_BUTTON_BLUE); install.setHoverForeground(LauncherFrame.COLOR_BLUE); install.setBorder(BorderFactory.createEmptyBorder(8, 56, 8, 56)); install.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { standardInstall(); } }); panel.add(install, new GridBagConstraints(1, 5, 2, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 8, 8), 0, 0)); }
From source file:org.dwfa.ace.classifier.CNFormsLabelPanel.java
public void setConcept(I_GetConceptData conceptIn, I_ConfigAceFrame config) throws IOException, TerminologyException { this.theCBean = conceptIn; this.config = config; commonJPanel.removeAll();/*from www .ja v a 2s.com*/ deltaJPanel.removeAll(); formsJPanel.removeAll(); // FORMS HAS SUBPANELS: STATED & COMPUTED if (conceptIn == null) return; // COMMON & DIFFERENT SECTION // COMMON PANEL commonLabels = getCommonLabels(showDetailCB.isSelected(), showStatusCB.isSelected(), config); // #### commonPartJPanel = new JPanel(); setMinMaxSize(commonPartJPanel); commonPartJPanel.setLayout(new BoxLayout(commonPartJPanel, BoxLayout.Y_AXIS)); for (I_ImplementActiveLabel l : commonLabels) { commonPartJPanel.add(l.getLabel()); } GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTHWEST; c.gridheight = 1; c.gridwidth = 1; c.weightx = 0; c.weighty = 0; c.gridx = 0; c.gridy = 0; commonJPanel.add(commonPartJPanel, c); // DELTA (DIFFERENCES) PANEL Map<I_ConceptAttributeTuple, Color> conAttrColorMap = new HashMap<I_ConceptAttributeTuple, Color>(); Map<I_DescriptionTuple, Color> desColorMap = new HashMap<I_DescriptionTuple, Color>(); Map<I_RelTuple, Color> relColorMap = new HashMap<I_RelTuple, Color>(); colors.reset(); Collection<I_ImplementActiveLabel> deltaLabels = getDeltaLabels(showDetailCB.isSelected(), showStatusCB.isSelected(), config, colors, conAttrColorMap, desColorMap, relColorMap); // #### deltaPartJPanel = new JPanel(); deltaPartJPanel.setLayout(new BoxLayout(deltaPartJPanel, BoxLayout.Y_AXIS)); for (I_ImplementActiveLabel l : deltaLabels) { deltaPartJPanel.add(l.getLabel()); } deltaJPanel.add(deltaPartJPanel); // FORM STATED PANEL c = new GridBagConstraints(); c.fill = GridBagConstraints.VERTICAL; c.anchor = GridBagConstraints.NORTHWEST; c.weightx = 0; // horizontal free space distribution weight c.weighty = 0; // vertical free space distribution weight c.gridx = 0; c.gridy = 0; JPanel tmpJPanel; tmpJPanel = newFormStatedJPanel("Stated Form:", config, conAttrColorMap, desColorMap, relColorMap); // #### setMinMaxSize(tmpJPanel); formsJPanel.add(tmpJPanel, c); // FORM DISTRIBUTION NORMAL PANEL if (showDistFormCB.isSelected()) { c.gridx++; if (c.gridx == 2) { c.gridx = 0; c.gridy++; } tmpJPanel = newFormDistJPanel("Distribution Normal Form:", config, conAttrColorMap, desColorMap, relColorMap); // #### setMinMaxSize(tmpJPanel); formsJPanel.add(tmpJPanel, c); } // AUTHORING NORMAL FORM PANEL if (showAuthFormCB.isSelected()) { c.gridx++; if (c.gridx == 2) { c.gridx = 0; c.gridy++; } tmpJPanel = newFormAuthJPanel("Authoring Normal Form:", config, conAttrColorMap, desColorMap, relColorMap); // #### setMinMaxSize(tmpJPanel); formsJPanel.add(tmpJPanel, c); } // LONG CANONICAL FORM PANEL if (showLongFormCB.isSelected()) { c.gridx++; if (c.gridx == 2) { c.gridx = 0; c.gridy++; } tmpJPanel = newFormLongJPanel("Long Canonical Form:", config, conAttrColorMap, desColorMap, relColorMap); // #### setMinMaxSize(tmpJPanel); formsJPanel.add(tmpJPanel, c); } // FORM SHORT CANONICAL PANEL if (showShortFormCB.isSelected()) { c.gridx++; if (c.gridx == 2) { c.gridx = 0; c.gridy++; } tmpJPanel = newFormShortJPanel("Short Canonical Form:", config, conAttrColorMap, desColorMap, relColorMap); // #### setMinMaxSize(tmpJPanel); formsJPanel.add(tmpJPanel, c); } }
From source file:uk.ac.ucl.chem.ccs.clinicalgui.DisplayJobPanel.java
private void initGUI() { if (ajo == null) { try {// w w w.java2 s . co m setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } //JLabel l = new JLabel("No simulation running"); //this.add(l); //this.setEnabled(false); return; } System.out.println("I am not null: drawing the display job panel"); try { TableLayout thisLayout = new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.FILL } }); thisLayout.setHGap(5); thisLayout.setVGap(5); this.setLayout(thisLayout); { jPanel1 = new JPanel(); TableLayout jPanel1Layout = new TableLayout(new double[][] { { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED }, { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } }); jPanel1Layout.setHGap(5); jPanel1Layout.setVGap(5); jPanel1.setLayout(jPanel1Layout); jPanel1.setLayout(jPanel1Layout); jPanel1.setBorder(BorderFactory.createEtchedBorder()); this.add(jPanel1, "0, 0, 0, 2"); jPanel1.setPreferredSize(new java.awt.Dimension(630, 305)); jPanel1.setSize(630, 305); { dtails = new JPanel(); GridLayout dtailsLayout = new GridLayout(1, 1); dtailsLayout.setColumns(1); dtailsLayout.setHgap(5); dtailsLayout.setVgap(5); dtails.setBorder(BorderFactory.createTitledBorder("Job Details")); jPanel1.add(dtails, "0, 0, 2, 4"); dtails.setLayout(dtailsLayout); { jobDetailsSP = new JScrollPane(); dtails.add(jobDetailsSP); { jPanel3 = new JPanel(); TableLayout jPanel3Layout = new TableLayout( new double[][] { { TableLayout.PREFERRED, TableLayout.FILL }, { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } }); jPanel3Layout.setHGap(5); jPanel3Layout.setVGap(5); jPanel3.setLayout(jPanel3Layout); jobDetailsSP.setViewportView(jPanel3); jPanel3.setBackground(new java.awt.Color(156, 199, 219)); { jLabel2 = new JLabel(); jPanel3.add(jLabel2, "0, 0"); jLabel2.setText("Job Start Time"); } { jLabel3 = new JLabel(); jPanel3.add(jLabel3, "0, 1"); jLabel3.setText("Resource ID"); } { jLabel4 = new JLabel(); jPanel3.add(jLabel4, "0, 2"); jLabel4.setText("Job Type"); } { jLabel5 = new JLabel(); jPanel3.add(jLabel5, "0, 3"); jLabel5.setText("Status"); } { jLabel6 = new JLabel(); jPanel3.add(jLabel6, "0, 4"); jLabel6.setText("Machine"); } { jLabel7 = new JLabel(); jPanel3.add(jLabel7, "0, 5"); jLabel7.setText("CPUs Requested"); } { jLabel8 = new JLabel(); jPanel3.add(jLabel8, "0, 6"); jLabel8.setText("Configuration File"); } { jLabel9 = new JLabel(); jPanel3.add(jLabel9, "0, 7"); jLabel9.setText("Job Arguments"); } { jLabel10 = new JLabel(); jPanel3.add(jLabel10, "0, 8"); jLabel10.setText("Job Stdout"); } { jLabel11 = new JLabel(); jPanel3.add(jLabel11, "0, 9"); jLabel11.setText("Job Stderr"); } { jLabel12 = new JLabel(); jPanel3.add(jLabel12, "0, 10"); jLabel12.setText("Job Stdin"); } { jLabel13 = new JLabel(); jPanel3.add(jLabel13, "0, 11"); jLabel13.setText("Resource Endpoint"); } { jobName = new JTextField(); jPanel3.add(jobName, "1, 0"); jobName.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobName.setOpaque(true); jobName.setBackground(new java.awt.Color(255, 255, 255)); jobName.setEditable(false); } { resourceID = new JTextField(); jPanel3.add(resourceID, "1, 1"); resourceID.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); resourceID.setOpaque(true); resourceID.setBackground(new java.awt.Color(255, 255, 255)); resourceID.setEditable(false); } { jobType = new JTextField(); jPanel3.add(jobType, "1, 2"); jobType.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobType.setBackground(new java.awt.Color(255, 255, 255)); jobType.setOpaque(true); jobType.setEditable(false); } { jobStatus = new JLabel(); jPanel3.add(jobStatus, "1, 3"); jobStatus.setOpaque(true); jobStatus.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobStatus.setBackground(new java.awt.Color(255, 255, 255)); } { rm = new JTextField(); jPanel3.add(rm, "1, 4"); rm.setBackground(new java.awt.Color(255, 255, 255)); rm.setOpaque(true); rm.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); rm.setEditable(false); } { jobCpus = new JTextField(); jPanel3.add(jobCpus, "1, 5"); jobCpus.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobCpus.setOpaque(true); jobCpus.setBackground(new java.awt.Color(255, 255, 255)); jobCpus.setEditable(false); } { jobConf = new JTextField(); jPanel3.add(jobConf, "1, 6"); jobConf.setBackground(new java.awt.Color(255, 255, 255)); jobConf.setOpaque(true); jobConf.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobConf.setEditable(false); } { jobArgs = new JTextField(); jPanel3.add(jobArgs, "1, 7"); jobArgs.setBackground(new java.awt.Color(255, 255, 255)); jobArgs.setOpaque(true); jobArgs.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobArgs.setEditable(false); } { jobSdtout = new JTextField(); jPanel3.add(jobSdtout, "1, 8"); jobSdtout.setBackground(new java.awt.Color(255, 255, 255)); jobSdtout.setOpaque(true); jobSdtout.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobSdtout.setEditable(false); } { jobStderr = new JTextField(); jPanel3.add(jobStderr, "1, 9"); jobStderr.setBackground(new java.awt.Color(255, 255, 255)); jobStderr.setOpaque(true); jobStderr.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobStderr.setEditable(false); } { jobStdin = new JTextField(); jPanel3.add(jobStdin, "1, 10"); jobStdin.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobStdin.setBackground(new java.awt.Color(255, 255, 255)); jobStdin.setOpaque(true); jobStdin.setEditable(false); } { jobEPR = new JTextField(); jPanel3.add(jobEPR, "1, 11"); jobEPR.setOpaque(true); jobEPR.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jobEPR.setBackground(new java.awt.Color(255, 255, 255)); jobEPR.setEditable(false); } } } } { controls = new JPanel(); TableLayout controlsLayout = new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } }); controlsLayout.setHGap(5); controlsLayout.setVGap(5); controls.setLayout(controlsLayout); controls.setBorder(BorderFactory.createTitledBorder("Operations")); jPanel1.add(controls, "3, 0, 4, 2"); { updateStatus = new JButton(); controls.add(updateStatus, "0, 0"); updateStatus.setText("Update Job Status"); updateStatus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (updateStatus.getText().equals("Start Job")) { StartCall sc = new StartCall(ajo, ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-lifetime"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-port"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-dn"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-server"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-pw"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-un")); ajo = sc.makeCall(); updatePanel(); } else { pollJobState(); } } }); } { teminateJob = new JButton(); controls.add(teminateJob, "0, 1"); teminateJob.setText("Terminate Job"); teminateJob.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { TerminateSimCall tsc = new TerminateSimCall(ajo.getEndPoint()); DisplayJobPanel.this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); boolean tcsstatus = tsc.makeCall(); DisplayJobPanel.this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); if (tcsstatus) { ajo.setState(AHEJobObject.GRIDSAM_TERMINATING); updateState(); } else { ErrorMessage em = new ErrorMessage(DisplayJobPanel.this, "Error terminating job. Check log for details"); ; } } }); } { vizButton = new JButton(); controls.add(vizButton, "0, 2"); vizButton.setText("Visualize"); vizButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String h = "localhost"; int p = 65250; int w = 1024 * 1024; VizSteererWindow vs = new VizSteererWindow(h, p, w, (JFrame) DisplayJobPanel.this.getTopLevelAncestor()); } }); } { deleteFiles = new JCheckBox(); controls.add(deleteFiles, "0, 3"); deleteFiles.setText("Delete staged files when destroying job"); deleteFiles.setFont(new java.awt.Font("Sansserif", 0, 11)); deleteFiles.setSelected(true); } } { polling = new JPanel(); GridBagLayout pollingLayout = new GridBagLayout(); pollingLayout.rowWeights = new double[] { 0.1, 0.1, 0.1, 0.1 }; pollingLayout.rowHeights = new int[] { 7, 7, 7, 7 }; pollingLayout.columnWeights = new double[] { 0.0, 0.1 }; pollingLayout.columnWidths = new int[] { 109, 7 }; polling.setBorder(BorderFactory.createTitledBorder("Status Polling")); jPanel1.add(polling, "3, 3, 4, 4"); polling.setLayout(pollingLayout); { jLabel1 = new JLabel(); polling.add(jLabel1, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Set the polling interval "); jLabel1.setFont(new java.awt.Font("Sansserif", 0, 11)); } { jSlider1 = new JSlider(); polling.add(jSlider1, new GridBagConstraints(0, 1, 2, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); jSlider1.setMaximum(60); jSlider1.setValue(0); //jSlider1.setMinorTickSpacing(1); //jSlider1.createStandardLabels(5); Hashtable lab = new Hashtable(); lab.put(new Integer(0), new JLabel("0")); lab.put(new Integer(20), new JLabel("10")); lab.put(new Integer(40), new JLabel("20")); lab.put(new Integer(60), new JLabel("30")); jSlider1.setLabelTable(lab); jSlider1.setPaintTicks(true); jSlider1.setPaintLabels(true); jSlider1.setSnapToTicks(false); jSlider1.setMajorTickSpacing(2); jSlider1.setFont(new java.awt.Font("Sansserif", 0, 11)); jSlider1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (jSlider1.getValue() != 0) { Integer i = new Integer(jSlider1.getValue()); time1.setText(Float.toString(i.floatValue() / 2)); if (pollingButton.getText().equals("Stop Polling")) { pollTimer.stop(); pollTimer.setInitialDelay(jSlider1.getValue() * 30000); pollTimer.setDelay(jSlider1.getValue() * 30000); pollTimer.start(); } } else { if (pollingButton.getText().equals("Stop Polling")) { pollTimer.stop(); pollingButton.setText("Start Polling"); } time1.setText("0.0"); } } }); } { pollingButton = new JButton(); polling.add(pollingButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); pollingButton.setText("Start Polling"); pollingButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (jSlider1.getValue() > 0) { if (pollingButton.getText().equals("Start Polling")) { pollTimer = new Timer(jSlider1.getValue() * 30000, new ActionListener() { public void actionPerformed(ActionEvent evt) { pollJobState(); } }); pollTimer.setInitialDelay(1); pollTimer.start(); pollingButton.setText("Stop Polling"); } else { pollTimer.stop(); pollingButton.setText("Start Polling"); } } } }); } { time = new JLabel(); polling.add(time, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); time.setBackground(new java.awt.Color(255, 255, 255)); time.setText("Every"); } { jLabel14 = new JLabel(); polling.add(jLabel14, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); jLabel14.setText("mins"); } { time1 = new JLabel(); polling.add(time1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); time1.setText("0.0"); ; } } } { jPanel2 = new JPanel(); GridLayout jPanel2Layout = new GridLayout(1, 1); jPanel2Layout.setColumns(1); jPanel2Layout.setHgap(5); jPanel2Layout.setVgap(5); jPanel2.setLayout(jPanel2Layout); TitledBorder title2; title2 = BorderFactory.createTitledBorder("Job Output"); jPanel2.setBorder(title2); this.add(jPanel2, "0, 3, 0, 4"); jPanel2.setPreferredSize(new java.awt.Dimension(630, 254)); { jTabbedPane1 = new JTabbedPane(); jPanel2.add(jTabbedPane1); { gridsamStatus = new JPanel(); GridLayout gridsamStatusLayout = new GridLayout(1, 1); gridsamStatusLayout.setColumns(1); gridsamStatusLayout.setHgap(5); gridsamStatusLayout.setVgap(5); gridsamStatus.setLayout(gridsamStatusLayout); jTabbedPane1.addTab("AHE Job Status", null, gridsamStatus, null); { jScrollPane1 = new JScrollPane(); gridsamStatus.add(jScrollPane1); { gridsamStatusResults = new JTextArea(); jScrollPane1.setViewportView(gridsamStatusResults); gridsamStatusResults.setFont(new java.awt.Font("Monospaced", 0, 12)); } } } { stagedFiles = new JPanel(); TableLayout stagedFilesLayout = new TableLayout(new double[][] { { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED }, { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED } }); stagedFilesLayout.setHGap(5); stagedFilesLayout.setVGap(5); stagedFiles.setLayout(stagedFilesLayout); jTabbedPane1.addTab("Staged Files", null, stagedFiles, null); { filesScrollPane = new JScrollPane(); stagedFiles.add(filesScrollPane, "0, 0, 5, 4"); { outputFilesTable = new JTable(); int col1 = 0, col2 = 0; int fsize = outputFilesTable.getFont().getSize() - 5; Object data[][] = new Object[ajo.getOutfiles().size() + ajo.getInfiles().size()][3]; int i = 0; if (ajo.getOutfiles() != null) { Iterator it = ajo.getOutfiles().iterator(); while (it.hasNext()) { JobFileElement je = (JobFileElement) it.next(); data[i][0] = new Boolean(true); data[i][1] = je.getName(); if (je.getName().length() > col1) { col1 = je.getName().length(); } String url = Tools.getUrlNoUP(je.getRemotepath()); data[i][2] = url; if (url.length() > col2) { col2 = url.length(); } i++; } } if (ajo.getInfiles() != null) { Iterator it = ajo.getInfiles().iterator(); while (it.hasNext()) { JobFileElement je = (JobFileElement) it.next(); data[i][0] = new Boolean(false); data[i][1] = je.getName(); if (je.getName().length() > col1) { col1 = je.getName().length(); } String url = Tools.getUrlNoUP(je.getRemotepath()); data[i][2] = url; if (url.length() > col2) { col2 = url.length(); } i++; } } String colNames[] = { "Download", "File Name", "File Location" }; TableModel outputFilesTableModel = new MyTableModel(data, colNames); outputFilesTable.setIntercellSpacing(new Dimension(3, 3)); outputFilesTable.setModel(outputFilesTableModel); outputFilesTable.getColumnModel().getColumn(0).setPreferredWidth(70); outputFilesTable.getColumnModel().getColumn(1).setPreferredWidth(col1 * fsize); outputFilesTable.getColumnModel().getColumn(2).setPreferredWidth(col2 * fsize); outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); filesScrollPane.setViewportView(outputFilesTable); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if (outputFilesTable.getWidth() < filesScrollPane.getWidth()) { outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); } else { outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); } } }); } } { downloadButton = new JButton(); stagedFiles.add(downloadButton, "5, 5"); downloadButton.setText("Download"); downloadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int outFileSize = ajo.getOutfiles().size(); for (int row = 0; row < outputFilesTable.getRowCount(); row++) { if (((Boolean) outputFilesTable.getValueAt(row, 0)) .booleanValue() == true) { if (row < outFileSize) { JobFileElement je = (JobFileElement) ajo.getOutfiles() .elementAt(row); if (fileLocation != null) { je.setLocalpath(Tools.checkURL(fileLocation) + je.getName()); } downloadFiles.add(je); } else { JobFileElement je = (JobFileElement) ajo.getInfiles() .elementAt(row - outFileSize); if (fileLocation != null) { je.setLocalpath(Tools.checkURL(fileLocation) + je.getName()); } downloadFiles.add(je); } } } StageFilesIn task = new StageFilesIn( ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavserver"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavuser"), ClinicalGuiClient.prop .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavpasswd")); task.init(downloadFiles); ProgressMonitor progressMonitor = new ProgressMonitor(DisplayJobPanel.this, "Downloading Files", null, 0, task.getLength()); //progressMonitor.setMillisToDecideToPopup(1); progressMonitor.setMillisToPopup(100); //jProgressBar1.setMaximum(task.getLength()); //jProgressBar1.setValue(0); while (task.filesToStage()) { if (task.stageNext()) { progressMonitor.setProgress(task.getCurrent()); } else { cat.error(task.getError()); } } } }); } { changeLocationButton = new JButton(); stagedFiles.add(changeLocationButton, "4, 5"); changeLocationButton.setText("Local Dir"); changeLocationButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fc.showOpenDialog(DisplayJobPanel.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); fileLocation = file.getAbsolutePath(); //System.out.println(fileLocation); } } }); } } { if (ajo.getReGSWSEPR() != null) { regSteering = new JPanel(); TableLayout steerLayout = new TableLayout( new double[][] { { TableLayout.FILL }, { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } }); regSteering.setLayout(steerLayout); steeredApp = true; jTabbedPane1.addTab("ReG Steering", null, regSteering, null); { JLabel look = new JLabel("Steering address"); steerERP = new JTextField(); steer = new JButton("Start Steerer"); steer.setEnabled(false); steer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { vs = new VizSteererWindow(h, p, w, DisplayJobPanel.this.getTopLevelAncestor()); } }); regSteering.add(look, "0,1"); regSteering.add(steerERP, "0,2"); regSteering.add(steer, "0,3"); } } } } } updatePanel(); this.setPreferredSize(new java.awt.Dimension(630, 605)); this.setSize(630, 605); this.setOpaque(false); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.revager.gui.findings_list.FindingsListFrame.java
private void createBottomOrgPanel() { JLabel locationLbl = new JLabel(translate("Location:")); locationLbl.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel dateLbl = new JLabel(translate("Date:")); dateLbl.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel beginLbl = new JLabel(translate("Period of time:")); beginLbl.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel tillLabel = new JLabel(translate("to")); tillLabel.setFont(UI.VERY_LARGE_FONT_BOLD); clockLabel.setFont(UI.VERY_LARGE_FONT_BOLD); dateTxtFld = new ObservingTextField(); dateTxtFld.setFont(UI.VERY_LARGE_FONT); dateTxtFld.setFocusable(false);//from ww w . j a v a 2 s.c o m dateTxtFld.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); dateTxtFld.setPreferredSize(new Dimension(190, (int) dateTxtFld.getPreferredSize().getHeight())); dateTxtFld.setMinimumSize(dateTxtFld.getPreferredSize()); dateTxtFld.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { // instantiate the DatePicker DatePicker dp = new DatePicker(UI.getInstance().getProtocolFrame(), UI.getInstance().getProtocolFrame().getDateTxtFld()); // previously selected date Date selectedDate = dp.parseDate(UI.getInstance().getProtocolFrame().getDateTxtFld().getText()); dp.setSelectedDate(selectedDate); dp.start(UI.getInstance().getProtocolFrame().getDateTxtFld()); } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); dateTxtFld.addKeyListener(updateListener); /* * creating spinner panel */ beginMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1)); beginHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1)); endMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1)); endHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1)); beginMSpinner.setFont(UI.VERY_LARGE_FONT); beginHSpinner.setFont(UI.VERY_LARGE_FONT); endHSpinner.setFont(UI.VERY_LARGE_FONT); endMSpinner.setFont(UI.VERY_LARGE_FONT); beginMSpinner.addChangeListener(spinnerChangeListener); beginHSpinner.addChangeListener(spinnerChangeListener); endHSpinner.addChangeListener(spinnerChangeListener); endMSpinner.addChangeListener(spinnerChangeListener); locationTxtFld = new JTextField(); locationTxtFld.setFont(UI.VERY_LARGE_FONT); /* * Hide border if the application runs on Mac OS X */ boolean hideBorder = UI.getInstance().getPlatform() == UI.Platform.MAC; GUITools.formatSpinner(endHSpinner, hideBorder); GUITools.formatSpinner(endMSpinner, hideBorder); GUITools.formatSpinner(beginHSpinner, hideBorder); GUITools.formatSpinner(beginMSpinner, hideBorder); // TODO: In some cases 'currentProt.getDate()' returns null. dateF.setTimeZone(currentProt.getDate().getTimeZone()); dateTxtFld.setText(dateF.format(currentProt.getDate().getTime())); int beginHours = currentProt.getStart().get(Calendar.HOUR_OF_DAY); beginMSpinner.setValue(currentProt.getStart().get(Calendar.MINUTE)); beginHSpinner.setValue(beginHours); int endHours = currentProt.getEnd().get(Calendar.HOUR_OF_DAY); endMSpinner.setValue(currentProt.getEnd().get(Calendar.MINUTE)); endHSpinner.setValue(endHours); /* * Correct the leading zero's */ if ((Integer) beginMSpinner.getValue() == 0) { ((NumberEditor) beginMSpinner.getEditor()).getTextField().setText("00"); } if ((Integer) beginHSpinner.getValue() == 0) { ((NumberEditor) beginHSpinner.getEditor()).getTextField().setText("00"); } if ((Integer) endMSpinner.getValue() == 0) { ((NumberEditor) endMSpinner.getEditor()).getTextField().setText("00"); } if ((Integer) endHSpinner.getValue() == 0) { ((NumberEditor) endHSpinner.getEditor()).getTextField().setText("00"); } locationTxtFld.setText(currentProt.getLocation().trim()); JPanel spinnerPanel = new JPanel(gbl); spinnerPanel.setOpaque(false); JLabel labelDoubleDot1 = new JLabel(":"); labelDoubleDot1.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel labelDoubleDot2 = new JLabel(":"); labelDoubleDot2.setFont(UI.VERY_LARGE_FONT_BOLD); GUITools.addComponent(spinnerPanel, gbl, beginHSpinner, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST); GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot1, 1, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER); GUITools.addComponent(spinnerPanel, gbl, beginMSpinner, 2, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST); GUITools.addComponent(spinnerPanel, gbl, tillLabel, 3, 0, 1, 1, 1.0, 0, 0, 10, 0, 10, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER); GUITools.addComponent(spinnerPanel, gbl, endHSpinner, 4, 0, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST); GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot2, 5, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER); GUITools.addComponent(spinnerPanel, gbl, endMSpinner, 6, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST); /* * adding created components to orgpanel */ GUITools.addComponent(bottomOrgPanel, gbl, dateLbl, 2, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, dateTxtFld, 3, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, locationLbl, 0, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, locationTxtFld, 1, 0, 1, 1, 1.0, 1.0, 10, 5, 0, 10, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, beginLbl, 5, 0, 1, 1, 0.0, 1.0, 10, 30, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); GUITools.addComponent(bottomOrgPanel, gbl, spinnerPanel, 6, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 25, GridBagConstraints.VERTICAL, GridBagConstraints.WEST); updateAttButtons(); }
From source file:com.sec.ose.osi.ui.frm.main.identification.codematch.JPanCodeMatchMain.java
/** * This method initializes jPanel // w w w. j av a 2 s . c om * * @return javax.swing.JPanel */ public JPanel getJPanelFolder() { if (jPanelFolder == null) { GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.anchor = GridBagConstraints.EAST; gridBagConstraints8.gridwidth = 1; gridBagConstraints8.gridx = 0; gridBagConstraints8.gridy = 0; gridBagConstraints8.weightx = 1.0; gridBagConstraints8.weighty = 0.0; gridBagConstraints8.insets = new Insets(0, 10, 0, 3); GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); gridBagConstraints6.anchor = GridBagConstraints.WEST; gridBagConstraints6.insets = new Insets(5, 0, 5, 10); gridBagConstraints6.gridx = 1; gridBagConstraints6.gridy = 0; gridBagConstraints6.weightx = 1.0; gridBagConstraints6.fill = GridBagConstraints.VERTICAL; GridBagConstraints gridBagConstraints66 = new GridBagConstraints(); gridBagConstraints66.anchor = GridBagConstraints.WEST; gridBagConstraints66.insets = new Insets(5, 0, 5, 10); gridBagConstraints66.gridx = 2; gridBagConstraints66.gridy = -1; gridBagConstraints66.weightx = 1.0; gridBagConstraints66.fill = GridBagConstraints.VERTICAL; GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); gridBagConstraints10.anchor = GridBagConstraints.EAST; gridBagConstraints10.gridx = 0; gridBagConstraints10.gridy = 1; gridBagConstraints10.weightx = 0.0; gridBagConstraints10.insets = new Insets(0, 0, 0, 3); GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.anchor = GridBagConstraints.WEST; gridBagConstraints7.insets = new Insets(0, 0, 5, 0); gridBagConstraints7.gridx = 1; gridBagConstraints7.gridy = 1; gridBagConstraints7.weightx = 1.0; gridBagConstraints7.fill = GridBagConstraints.VERTICAL; jPanelFolder = new JPanel(); jPanelFolder.setLayout(new GridBagLayout()); jPanelFolder.add(jLabelComponent, gridBagConstraints8); jPanelFolder.add(getJComboBoxComponent(), gridBagConstraints6); jPanelFolder.add(jLabelLicense, gridBagConstraints10); jPanelFolder.add(getJComboBoxLicense(), gridBagConstraints7); } return jPanelFolder; }