List of usage examples for java.awt FlowLayout RIGHT
int RIGHT
To view the source code for java.awt FlowLayout RIGHT.
Click Source Link
From source file:org.apache.uima.tools.docanalyzer.DBAnnotationViewerDialog.java
/** * Create an AnnotationViewer Dialog//from w ww . ja v a 2s. c o m * * @param aParentFrame * frame containing this panel * @param aTitle * title to display for the dialog * @param aInputDir * directory containing input files (in XCAS foramt) to read * @param aStyleMapFile * filename of style map to be used to view files in HTML * @param aPerformanceStats * string representaiton of performance statistics, optional. * @param aTypeSystem * the CAS Type System to which the XCAS files must conform. * @param aTypesToDisplay * array of types that should be highlighted in the viewer. This can be set to the output * types of the Analysis Engine. A value of null means to display all types. */ /*public DBAnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, DBPrefsMediator med, File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem, final String[] aTypesToDisplay, String interactiveTempFN, boolean javaViewerRBisSelected, boolean javaViewerUCRBisSelected, boolean xmlRBisSelected, CAS cas) { super(aParentFrame, aDialogTitle); // create the AnnotationViewGenerator (for HTML view generation) this.med1 = med; this.cas = cas; annotationViewGenerator = new AnnotationViewGenerator(tempDir); launchThatViewer(med.getOutputDir(), interactiveTempFN, aTypeSystem, aTypesToDisplay, javaViewerRBisSelected, javaViewerUCRBisSelected, xmlRBisSelected, aStyleMapFile, tempDir); }*/ public DBAnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, DBPrefsMediator med, File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem, final String[] aTypesToDisplay, boolean generatedStyleMap, CAS cas) { super(aParentFrame, aDialogTitle); this.xmiDAO = med.getXmiDAO(); this.med1 = med; this.cas = cas; styleMapFile = aStyleMapFile; final String performanceStats = aPerformanceStats; typeSystem = aTypeSystem; typesToDisplay = aTypesToDisplay; // create the AnnotationViewGenerator (for HTML view generation) annotationViewGenerator = new AnnotationViewGenerator(tempDir); // create StyleMapEditor dialog styleMapEditor = new StyleMapEditor(aParentFrame, cas); JPanel resultsTitlePanel = new JPanel(); resultsTitlePanel.setLayout(new BoxLayout(resultsTitlePanel, BoxLayout.Y_AXIS)); resultsTitlePanel.add(new JLabel("These are the Analyzed Documents.")); resultsTitlePanel.add(new JLabel("Select viewer type and double-click file to open.")); try { String[] documents = this.xmiDAO.getXMIList(); analyzedResultsList = new JList(documents); } catch (DAOException e) { displayError(e.getMessage()); } /* * File[] documents = dir.listFiles(); Vector docVector = new Vector(); for (int i = 0; i < * documents.length; i++) { if (documents[i].isFile()) { docVector.add(documents[i].getName()); } } * final JList analyzedResultsList = new JList(docVector); */ JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add(analyzedResultsList, null); JPanel southernPanel = new JPanel(); southernPanel.setLayout(new BoxLayout(southernPanel, BoxLayout.Y_AXIS)); JPanel controlsPanel = new JPanel(); controlsPanel.setLayout(new SpringLayout()); Caption displayFormatLabel = new Caption("Results Display Format:"); controlsPanel.add(displayFormatLabel); JPanel displayFormatPanel = new JPanel(); displayFormatPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); displayFormatPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); javaViewerRB = new JRadioButton("Java Viewer"); javaViewerUCRB = new JRadioButton("JV user colors"); htmlRB = new JRadioButton("HTML"); xmlRB = new JRadioButton("XML"); ButtonGroup displayFormatButtonGroup = new ButtonGroup(); displayFormatButtonGroup.add(javaViewerRB); displayFormatButtonGroup.add(javaViewerUCRB); displayFormatButtonGroup.add(htmlRB); displayFormatButtonGroup.add(xmlRB); // select the appropraite viewer button according to user's prefs javaViewerRB.setSelected(true); // default, overriden below if ("Java Viewer".equals(med.getViewType())) { javaViewerRB.setSelected(true); } else if ("JV User Colors".equals(med.getViewType())) { javaViewerUCRB.setSelected(true); } else if ("HTML".equals(med.getViewType())) { htmlRB.setSelected(true); } else if ("XML".equals(med.getViewType())) { xmlRB.setSelected(true); } displayFormatPanel.add(javaViewerRB); displayFormatPanel.add(javaViewerUCRB); displayFormatPanel.add(htmlRB); displayFormatPanel.add(xmlRB); controlsPanel.add(displayFormatPanel); SpringUtilities.makeCompactGrid(controlsPanel, 1, 2, // rows, cols 4, 4, // initX, initY 0, 0); // xPad, yPad JButton editStyleMapButton = new JButton("Edit Style Map"); // event for the editStyleMapButton button editStyleMapButton.addActionListener(this); southernPanel.add(controlsPanel); // southernPanel.add( new JSeparator() ); JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); // APL: edit style map feature disabled for SDK buttonsPanel.add(editStyleMapButton); if (performanceStats != null) { JButton perfStatsButton = new JButton("Performance Stats"); perfStatsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { JOptionPane.showMessageDialog((Component) ae.getSource(), performanceStats, null, JOptionPane.PLAIN_MESSAGE); } }); buttonsPanel.add(perfStatsButton); } JButton closeButton = new JButton("Close"); buttonsPanel.add(closeButton); southernPanel.add(buttonsPanel); // add jlist and panel container to Dialog getContentPane().add(resultsTitlePanel, BorderLayout.NORTH); getContentPane().add(scrollPane, BorderLayout.CENTER); getContentPane().add(southernPanel, BorderLayout.SOUTH); // event for the closeButton button closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { DBAnnotationViewerDialog.this.setVisible(false); } }); // event for analyzedResultsDialog window closing this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLF(); // set default look and feel analyzedResultsList.setCellRenderer(new MyListCellRenderer()); // doubleclicking on document shows the annotated result MouseListener mouseListener = new ListMouseAdapter(); // styleMapFile, analyzedResultsList, // inputDirPath,typeSystem , typesToDisplay , // javaViewerRB , javaViewerUCRB ,xmlRB , // viewerDirectory , this); // add mouse Listener to the list analyzedResultsList.addMouseListener(mouseListener); }
From source file:emailplugin.MailCreator.java
/** * Gives the User the opportunity to specify which Desktop he uses (KDE or * Gnome)//from w w w . ja va 2s .c o m * * @param parent * Parent Dialog * @return true if KDE or Gnome has been selected, false if the User wanted to * specify the App */ private boolean showKdeGnomeDialog(Frame parent) { final JDialog dialog = new JDialog(parent, true); dialog.setTitle(mLocalizer.msg("chooseTitle", "Choose")); JPanel panel = (JPanel) dialog.getContentPane(); panel.setLayout(new FormLayout("10dlu, fill:pref:grow", "default, 3dlu, default, 3dlu, default, 3dlu, default, 3dlu:grow, default")); panel.setBorder(Borders.DIALOG_BORDER); CellConstraints cc = new CellConstraints(); panel.add(UiUtilities.createHelpTextArea(mLocalizer.msg("cantConfigure", "Can't configure on your system")), cc.xyw(1, 1, 2)); JRadioButton kdeButton = new JRadioButton(mLocalizer.msg("kde", "I am using KDE")); panel.add(kdeButton, cc.xy(2, 3)); JRadioButton gnomeButton = new JRadioButton(mLocalizer.msg("gnome", "I am using Gnome")); panel.add(gnomeButton, cc.xy(2, 5)); JRadioButton selfButton = new JRadioButton(mLocalizer.msg("self", "I want to configure by myself")); panel.add(selfButton, cc.xy(2, 7)); ButtonGroup group = new ButtonGroup(); group.add(kdeButton); group.add(gnomeButton); group.add(selfButton); selfButton.setSelected(true); JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK)); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.setVisible(false); } }); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); buttonPanel.add(ok); panel.add(buttonPanel, cc.xy(2, 9)); UiUtilities.registerForClosing(new WindowClosingIf() { public void close() { dialog.setVisible(false); } public JRootPane getRootPane() { return dialog.getRootPane(); } }); dialog.getRootPane().setDefaultButton(ok); dialog.pack(); UiUtilities.centerAndShow(dialog); if (kdeButton.isSelected()) { mSettings.setApplication("kfmclient"); mSettings.setParameter("exec {content}"); } else if (gnomeButton.isSelected()) { mSettings.setApplication("gnome-open"); mSettings.setParameter("{content}"); } else { Plugin.getPluginManager().showSettings(mPlugin); return false; } return true; }
From source file:es.emergya.ui.base.LoginWindow.java
private void initialize() { ventana.getContentPane().removeAll(); ventana.setLayout(new BorderLayout()); ventana.setSize(new Dimension(800, 600)); JPanel panel = new JPanel(new GridBagLayout()); panel.setBackground(Color.WHITE); JPanel logos = new JPanel(new GridLayout(2, 1)); logos.add(new JLabel(LogicConstants.getIcon("login_logo_cliente"))); logos.add(new JLabel(LogicConstants.getIcon("login_logo"))); logos.setBackground(Color.WHITE); JLabel label = new JLabel(); label.setText(i18n.getString("11")); //$NON-NLS-1$ JLabel labelUsuario = new JLabel(); labelUsuario.setText(i18n.getString("12")); //$NON-NLS-1$ JLabel lablep = new JLabel(); lablep.setText(i18n.getString("13")); //$NON-NLS-1$ panel.add(logos, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); panel.add(error, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); panel.add(labelUsuario, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); panel.add(usuario, new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); panel.add(lablep, new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); panel.add(pass, new GridBagConstraints(1, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); panel.add(conectando, new GridBagConstraints(0, 4, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); panel.add(login, new GridBagConstraints(1, 6, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0)); panel.setBorder(new EmptyBorder(100, 100, 100, 100)); ventana.add(panel, BorderLayout.CENTER); JPanel abajo = new JPanel(); abajo.setLayout(new FlowLayout(FlowLayout.RIGHT)); abajo.add(version);//from w w w . j a v a2s. c o m abajo.setOpaque(false); ventana.add(abajo, BorderLayout.SOUTH); try { label.setFont(LogicConstants.deriveBoldFont(20.0f)); labelUsuario.setFont(LogicConstants.deriveBoldFont(20.0f)); lablep.setFont(LogicConstants.deriveBoldFont(20.0f)); login.setFont(LogicConstants.deriveBoldFont(20.0f)); error.setFont(LogicConstants.getBoldFont()); } catch (Exception e) { LOG.error("Error al inicializar el login", e); } ventana.setLocationRelativeTo(null); // ventana.pack(); }
From source file:org.fhaes.gui.ShapeFileDialog.java
@SuppressWarnings("unchecked") private void initGUI() { setBounds(100, 100, 582, 333);/*from ww w .j a v a 2s.co m*/ getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new MigLayout("", "[right][grow]", "[][][][grow]")); { JLabel lblOutputFilename = new JLabel("Output filename:"); contentPanel.add(lblOutputFilename, "cell 0 0,alignx trailing"); } { txtFilename = new JTextField(); txtFilename.getDocument().addDocumentListener(this); contentPanel.add(txtFilename, "flowx,cell 1 0,growx"); txtFilename.setColumns(10); } { JButton btnBrowse = new JButton("Browse"); btnBrowse.setActionCommand("Browse"); btnBrowse.addActionListener(this); contentPanel.add(btnBrowse, "cell 1 0"); } { JLabel lblAttributeTableStyle = new JLabel("Attribute table style:"); contentPanel.add(lblAttributeTableStyle, "cell 0 1,alignx trailing"); } { radStyle1 = new JRadioButton("One marker per site with multiple year attributes"); radStyle1.setActionCommand("Style1"); radStyle1.addActionListener(this); // radStyle1.setSelected(true); buttonGroup.add(radStyle1); contentPanel.add(radStyle1, "cell 1 1"); } { radStyle2 = new JRadioButton("Multiple markers per site, one for each year"); radStyle2.setActionCommand("Style2"); radStyle2.addActionListener(this); buttonGroup.add(radStyle2); new RadioButtonWrapper(buttonGroup, PrefKey.SHAPEFILE_OUTPUT_STYLE, "Style1"); contentPanel.add(radStyle2, "cell 1 2"); } { JPanel panel = new JPanel(); contentPanel.add(panel, "cell 0 3,alignx right,growy"); panel.setLayout(new MigLayout("insets n n n 0", "[119px]", "[15px]")); { JLabel lblYearsToInclude = new JLabel("Years to include:"); panel.add(lblYearsToInclude, "cell 0 0,alignx left,aligny top"); } } { JPanel panel = new JPanel(); contentPanel.add(panel, "cell 1 3,alignx left,growy"); panel.setLayout(new MigLayout("", "[160px:160px][][160px:160px]", "[][grow]")); { JLabel lblAvailableYears = new JLabel("Available:"); panel.add(lblAvailableYears, "cell 0 0,alignx center"); } { lblSelectedYears = new JLabel("Selected:"); panel.add(lblSelectedYears, "cell 2 0,alignx center"); } { JScrollPane scrollPane = new JScrollPane(); panel.add(scrollPane, "cell 0 1,grow"); { lstAvailableYears = new JList(); lstAvailableYears.setModel(availableYearsModel); scrollPane.setViewportView(lstAvailableYears); } } { JButton btnRemove = new JButton("<"); btnRemove.setActionCommand("removeYear"); btnRemove.addActionListener(this); { JButton btnAdd = new JButton(">"); btnAdd.setActionCommand("addYear"); btnAdd.addActionListener(this); panel.add(btnAdd, "flowy,cell 1 1"); } panel.add(btnRemove, "cell 1 1"); } { JScrollPane scrollPane = new JScrollPane(); panel.add(scrollPane, "cell 2 1,grow"); { lstSelectedYears = new JList(); lstSelectedYears.setModel(selectedYearsModel); selectedYearsModel.addListDataListener(new ListDataListener() { @Override public void contentsChanged(ListDataEvent arg0) { pingLayout(); } @Override public void intervalAdded(ListDataEvent arg0) { pingLayout(); } @Override public void intervalRemoved(ListDataEvent arg0) { pingLayout(); } }); scrollPane.setViewportView(lstSelectedYears); } } } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { btnOK = new JButton("OK"); btnOK.setActionCommand("OK"); btnOK.addActionListener(this); buttonPane.add(btnOK); getRootPane().setDefaultButton(btnOK); btnOK.setEnabled(false); } { JButton btnCancel = new JButton("Cancel"); btnCancel.setActionCommand("Cancel"); btnCancel.addActionListener(this); buttonPane.add(btnCancel); } } this.setLocationRelativeTo(parent); this.setIconImage(Builder.getApplicationIcon()); this.setTitle("Generate shapefile"); pingLayout(); }
From source file:edu.harvard.mcz.imagecapture.SpecimenPartAttributeDialog.java
private void init() { thisDialog = this; setBounds(100, 100, 820, 335);//from ww w .j a v a2 s . c om getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); JPanel panel = new JPanel(); panel.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); { JLabel lblAttributeType = new JLabel("Attribute Type"); panel.add(lblAttributeType, "2, 2, right, default"); } { comboBoxType = new JComboBox(); comboBoxType.setModel(new DefaultComboBoxModel( new String[] { "caste", "scientific name", "sex", "life stage", "part association" })); comboBoxType.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String item = comboBoxType.getSelectedItem().toString(); if (item != null) { comboBoxValue.setEditable(false); if (item.equals("scientific name")) { comboBoxValue.setEditable(true); } if (item.equals("sex")) { comboBoxValue.setModel(new DefaultComboBoxModel(Sex.getSexValues())); } if (item.equals("life stage")) { comboBoxValue.setModel(new DefaultComboBoxModel(LifeStage.getLifeStageValues())); } if (item.equals("caste")) { comboBoxValue.setModel(new DefaultComboBoxModel(Caste.getCasteValues())); } if (item.equals("part association")) { comboBoxValue .setModel(new DefaultComboBoxModel(PartAssociation.getPartAssociationValues())); } } } }); panel.add(comboBoxType, "4, 2, fill, default"); } { JLabel lblValue = new JLabel("Value"); panel.add(lblValue, "2, 4, right, default"); } { comboBoxValue = new JComboBox(); comboBoxValue.setModel(new DefaultComboBoxModel(Caste.getCasteValues())); panel.add(comboBoxValue, "4, 4, fill, default"); } { JLabel lblUnits = new JLabel("Units"); panel.add(lblUnits, "2, 6, right, default"); } { textFieldUnits = new JTextField(); panel.add(textFieldUnits, "4, 6, fill, default"); textFieldUnits.setColumns(10); } { JLabel lblRemarks = new JLabel("Remarks"); panel.add(lblRemarks, "2, 8, right, default"); } contentPanel.setLayout(new BorderLayout(0, 0)); contentPanel.add(panel, BorderLayout.WEST); { textFieldRemarks = new JTextField(); panel.add(textFieldRemarks, "4, 8, fill, default"); textFieldRemarks.setColumns(10); } { JButton btnAdd = new JButton("Add"); btnAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SpecimenPartAttribute newAttribs = new SpecimenPartAttribute(); newAttribs.setAttributeType(comboBoxType.getSelectedItem().toString()); newAttribs.setAttributeValue(comboBoxValue.getSelectedItem().toString()); newAttribs.setAttributeUnits(textFieldUnits.getText()); newAttribs.setAttributeRemark(textFieldRemarks.getText()); newAttribs.setSpecimenPartId(parentPart); newAttribs.setAttributeDeterminer(Singleton.getSingletonInstance().getUserFullName()); parentPart.getAttributeCollection().add(newAttribs); SpecimenPartAttributeLifeCycle sls = new SpecimenPartAttributeLifeCycle(); try { sls.attachDirty(newAttribs); } catch (SaveFailedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ((AbstractTableModel) table.getModel()).fireTableDataChanged(); } }); panel.add(btnAdd, "4, 10"); } try { JLabel lblNewLabel = new JLabel(parentPart.getSpecimenId().getBarcode() + ":" + parentPart.getPartName() + " " + parentPart.getPreserveMethod() + " (" + parentPart.getLotCount() + ") Right click on table to edit attributes."); contentPanel.add(lblNewLabel, BorderLayout.NORTH); } catch (Exception e) { JLabel lblNewLabel = new JLabel("No Specimen"); contentPanel.add(lblNewLabel, BorderLayout.NORTH); } JComboBox comboBox = new JComboBox(); comboBox.addItem("caste"); JComboBox comboBox1 = new JComboBox(); for (int i = 0; i < Caste.getCasteValues().length; i++) { comboBox1.addItem(Caste.getCasteValues()[i]); } JScrollPane scrollPane = new JScrollPane(); table = new JTable(new SpecimenPartsAttrTableModel( (Collection<SpecimenPartAttribute>) parentPart.getAttributeCollection())); //table.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(comboBox)); table.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { clickedOnRow = ((JTable) e.getComponent()).getSelectedRow(); popupMenu.show(e.getComponent(), e.getX(), e.getY()); } } @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { clickedOnRow = ((JTable) e.getComponent()).getSelectedRow(); popupMenu.show(e.getComponent(), e.getX(), e.getY()); } } }); popupMenu = new JPopupMenu(); JMenuItem mntmCloneRow = new JMenuItem("Edit Row"); mntmCloneRow.setMnemonic(KeyEvent.VK_E); mntmCloneRow.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { // Launch a dialog to edit the selected row. SpecimenPartAttribEditDialog popup = new SpecimenPartAttribEditDialog( ((SpecimenPartsAttrTableModel) table.getModel()).getRowObject(clickedOnRow)); popup.setVisible(true); } catch (Exception ex) { log.error(ex.getMessage()); JOptionPane.showMessageDialog(thisDialog, "Failed to edit a part attribute row. " + ex.getMessage()); } } }); popupMenu.add(mntmCloneRow); JMenuItem mntmDeleteRow = new JMenuItem("Delete Row"); mntmDeleteRow.setMnemonic(KeyEvent.VK_D); mntmDeleteRow.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { if (clickedOnRow >= 0) { ((SpecimenPartsAttrTableModel) table.getModel()).deleteRow(clickedOnRow); } } catch (Exception ex) { log.error(ex.getMessage()); JOptionPane.showMessageDialog(thisDialog, "Failed to delete a part attribute row. " + ex.getMessage()); } } }); popupMenu.add(mntmDeleteRow); // TODO: Enable controlled value editing of selected row. // table.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(comboBox1)); scrollPane.setViewportView(table); contentPanel.add(scrollPane, BorderLayout.EAST); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButton.grabFocus(); thisDialog.setVisible(false); } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { thisDialog.setVisible(false); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } }
From source file:org.gumtree.vis.hist2d.Hist2DChartEditor.java
private JPanel createMaskingPanel(JFreeChart chart) { JPanel wrap = new JPanel(new BorderLayout()); JPanel maskingPanel = new JPanel(new GridLayout(1, 1)); maskingPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); //Horizontal group JPanel managePanel = new JPanel(new BorderLayout()); managePanel.setBorder(//from ww w. j a va 2s .co m BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Region of Interests")); JPanel inner = new JPanel(new LCBLayout(6)); inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); inner.add(new JLabel("Select Region")); roiCombo = new JComboBox(panel.getMasks().toArray()); // colourScaleCombo.setMaximumRowCount(7); roiCombo.setActionCommand(CHANGE_ROI_COMMAND); roiCombo.addActionListener(this); roiCombo.setSelectedIndex(-1); inner.add(roiCombo); inner.add(new JLabel()); inner.add(new JLabel("or create")); JPanel createNewPanel = new JPanel(new GridLayout(1, 2)); newRectangleButton = new JButton("New Rectangle"); newRectangleButton.setActionCommand(CREATE_NEW_RECT_REGION_COMMAND); newRectangleButton.addActionListener(this); newEllipseButton = new JButton("New Ellipse"); newEllipseButton.setActionCommand(CREATE_NEW_ELLIPSE_REGION_COMMAND); newEllipseButton.addActionListener(this); createNewPanel.add(newRectangleButton); createNewPanel.add(newEllipseButton); inner.add(createNewPanel); inner.add(new JLabel()); JPanel editPanel = new JPanel(new BorderLayout()); editPanel .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Edit the Region")); JPanel editInner = new JPanel(new LCBLayout(6)); editInner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); editInner.add(new JLabel("Name")); roiName = new JTextField(10); // colourScaleCombo.setMaximumRowCount(7); roiName.setActionCommand(CHANGE_ROI_NAME_COMMAND); roiName.addActionListener(this); editInner.add(roiName); editInner.add(new JLabel()); editInner.add(new JLabel("Usage")); ButtonGroup buttonGroup = new ButtonGroup(); JPanel radioPanel = new JPanel(new GridLayout(1, 2)); inclusiveRadio = new JRadioButton("inclusive"); inclusiveRadio.setActionCommand(USE_INCLUSIVE_COMMAND); inclusiveRadio.addActionListener(this); buttonGroup.add(inclusiveRadio); radioPanel.add(inclusiveRadio); exclusiveRadio = new JRadioButton("exclusive"); exclusiveRadio.setActionCommand(USE_EXCLUSIVE_COMMAND); exclusiveRadio.addActionListener(this); buttonGroup.add(exclusiveRadio); radioPanel.add(exclusiveRadio); editInner.add(radioPanel); editInner.add(new JLabel()); editInner.add(new JLabel("Shape")); // ButtonGroup shapeGroup = new ButtonGroup(); // JPanel shapePanel = new JPanel(new GridLayout(1, 2)); // rectangleRadio = new JRadioButton("rectangle"); // rectangleRadio.setActionCommand(CHOOSE_RECTANGLE_SHAPE_COMMAND); // rectangleRadio.addActionListener(this); // shapeGroup.add(rectangleRadio); // shapePanel.add(rectangleRadio); // ellipseRadio = new JRadioButton("ellipse"); // ellipseRadio.setActionCommand(CHOOSE_ELLIPSE_SHAPE_COMMAND); // ellipseRadio.addActionListener(this); // shapeGroup.add(ellipseRadio); // shapePanel.add(ellipseRadio); // editInner.add(shapePanel); shapeLabel = new JLabel(); editInner.add(shapeLabel); editInner.add(new JLabel()); editInner.add(new JLabel("X Range")); JPanel xRangePanel = new JPanel(new GridLayout(1, 2)); JPanel xMinPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); xMinPanel.add(new JLabel("min: ")); xMin = new JTextField(10); // xMin.setActionCommand(CHANGE_XMIN_COMMAND); // xMin.addActionListener(this); xMin.addKeyListener(this); xMinPanel.add(xMin); xRangePanel.add(xMinPanel); JPanel xMaxPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); xMaxPanel.add(new JLabel("max: ")); xMax = new JTextField(10); // xMax.setActionCommand(CHANGE_XMAX_COMMAND); xMax.addKeyListener(this); xMaxPanel.add(xMax); xRangePanel.add(xMaxPanel); editInner.add(xRangePanel); editInner.add(new JLabel()); editInner.add(new JLabel("Y Range")); JPanel yRangePanel = new JPanel(new GridLayout(1, 2)); JPanel yMinPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); yMinPanel.add(new JLabel("min: ")); yMin = new JTextField(10); // yMin.setActionCommand(CHANGE_YMIN_COMMAND); // yMin.addActionListener(this); yMin.addKeyListener(this); yMinPanel.add(yMin); yRangePanel.add(yMinPanel); JPanel yMaxPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); yMaxPanel.add(new JLabel("max: ")); yMax = new JTextField(10); // yMax.setActionCommand(CHANGE_YMAX_COMMAND); // yMax.addActionListener(this); yMax.addKeyListener(this); yMaxPanel.add(yMax); yRangePanel.add(yMaxPanel); editInner.add(yRangePanel); editInner.add(new JLabel()); editInner.add(new JLabel()); JPanel applyPanel = new JPanel(new GridLayout(1, 2)); deleteButton = new JButton("Remove"); deleteButton.setEnabled(false); deleteButton.setActionCommand(REMOVE_CHANGE_ACTION); deleteButton.addActionListener(this); applyPanel.add(deleteButton); applyPanel.add(new JLabel()); applyButton = new JButton("Apply"); applyButton.setEnabled(false); applyButton.setActionCommand(APPLY_CHANGE_ACTION); applyButton.addActionListener(this); applyPanel.add(applyButton); editInner.add(applyPanel); editInner.add(new JLabel()); // inner.add(new JLabel("X Range")); // inner.add(inclusiveRadio); // exclusiveRadio = new JRadioButton("exclusive"); // exclusiveRadio.setActionCommand(USE_EXCLUSIVE_COMMAND); // exclusiveRadio.addActionListener(this); // inner.add(exclusiveRadio); editPanel.add(editInner, BorderLayout.NORTH); managePanel.add(editPanel, BorderLayout.SOUTH); managePanel.add(inner, BorderLayout.NORTH); maskingPanel.add(managePanel); wrap.setName("ROI"); wrap.add(maskingPanel, BorderLayout.NORTH); return wrap; }
From source file:org.eobjects.datacleaner.windows.MonitorConnectionDialog.java
@Override protected JComponent getDialogContent() { final DCPanel formPanel = new DCPanel(); int row = 0;//from w w w . j a va 2 s .c om WidgetUtils.addToGridBag(DCLabel.bright("Hostname:"), formPanel, 0, row); WidgetUtils.addToGridBag(_hostnameTextField, formPanel, 1, row); row++; WidgetUtils.addToGridBag(DCLabel.bright("Port:"), formPanel, 0, row); WidgetUtils.addToGridBag(_portTextField, formPanel, 1, row); row++; WidgetUtils.addToGridBag(DCLabel.bright("Context path:"), formPanel, 0, row); WidgetUtils.addToGridBag(_contextPathTextField, formPanel, 1, row); row++; WidgetUtils.addToGridBag(_httpsCheckBox, formPanel, 1, row); row++; WidgetUtils.addToGridBag(DCLabel.bright("Tenant ID:"), formPanel, 0, row); WidgetUtils.addToGridBag(_tenantTextField, formPanel, 1, row); row++; WidgetUtils.addToGridBag(_urlLabel, formPanel, 0, row, 2, 1); row++; WidgetUtils.addToGridBag(_authenticationCheckBox, formPanel, 1, row); row++; WidgetUtils.addToGridBag(DCLabel.bright("Username:"), formPanel, 0, row); WidgetUtils.addToGridBag(_usernameTextField, formPanel, 1, row); row++; WidgetUtils.addToGridBag(DCLabel.bright("Password:"), formPanel, 0, row); WidgetUtils.addToGridBag(_passwordTextField, formPanel, 1, row); formPanel.setBorder(WidgetUtils.BORDER_EMPTY); final JButton testButton = WidgetFactory.createButton("Test connection", "images/actions/refresh.png"); testButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { final MonitorConnection connection = createMonitorConnection(); final String pingUrl = connection.getRepositoryUrl() + "/ping"; final HttpGet request = new HttpGet(pingUrl); try (final MonitorHttpClient monitorHttpClient = connection.getHttpClient()) { final HttpResponse response = monitorHttpClient.execute(request); final StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == 200 || statusLine.getStatusCode() == 201) { // read response as JSON. final InputStream content = response.getEntity().getContent(); final Map<?, ?> map; try { map = new ObjectMapper().readValue(content, Map.class); } finally { FileHelper.safeClose(content); } logger.info("Ping request responded: {}", map); JOptionPane.showMessageDialog(MonitorConnectionDialog.this, "Connection successful!"); } else { final String reasonPhrase = statusLine.getReasonPhrase(); WidgetUtils.showErrorMessage("Server reported error", "Server replied with status " + statusLine.getStatusCode() + ":\n" + reasonPhrase); } } catch (Exception e) { // TODO: This dialog is shown behind the modal dialog WidgetUtils.showErrorMessage("Connection failed", "Connecting to DataCleaner monitor failed. Did you remember to fill in all the nescesary fields?", e); } } }); final JButton saveButton = WidgetFactory.createButton("Save connection", "images/actions/save.png"); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final MonitorConnection monitorConnection = createMonitorConnection(); _userPreferences.setMonitorConnection(monitorConnection); MonitorConnectionDialog.this.close(); } }); final DCPanel buttonPanel = new DCPanel(); buttonPanel.setBorder(WidgetUtils.BORDER_EMPTY); buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 4, 0)); buttonPanel.add(testButton); buttonPanel.add(saveButton); final DescriptionLabel descriptionLabel = new DescriptionLabel(); descriptionLabel.setText( "The DataCleaner monitor is a separate web application that is part of the DataCleaner eco-system. " + "In this dialog you can configure your connection to it. " + "With the monitor you can create, share, monitor and govern current and historic data quality metrics. " + "You can also set up alerts to react when certain metrics are out of their expected ranges."); final DCPanel panel = new DCPanel(); panel.setLayout(new BorderLayout()); panel.add(descriptionLabel, BorderLayout.NORTH); panel.add(formPanel, BorderLayout.CENTER); panel.add(buttonPanel, BorderLayout.SOUTH); panel.setPreferredSize(getDialogWidth(), 400); return panel; }
From source file:org.paxle.desktop.impl.dialogues.cconsole.CrawlingConsole.java
private void init(final MWComponents comp, final boolean showEnqueued, final boolean showDestroyed) { scroll.setViewportView(table);/*from ww w . j av a 2 s. c o m*/ updateCpb(false, true, false); cbEnq.setSelected(showEnqueued); cbDstr.setSelected(showDestroyed); cbox.setActionCommand(AC_SELECT); cbox.setSelectedIndex(comp.ordinal()); final JPanel bbLeft = new JPanel(new FlowLayout(FlowLayout.LEFT)); bbLeft.add(cpb); bbLeft.add(cbox); bbLeft.add(cbEnq); bbLeft.add(cbDstr); final JPanel bbRight = new JPanel(new FlowLayout(FlowLayout.RIGHT)); clear.setEnabled(false); bbRight.add(Utilities.instance.setButtonProps(new JToggleButton(), "\u2193 " + Messages.getString("crawlingConsole.settings"), this, AC_SETTINGS, KeyEvent.VK_S, null)); bbRight.add(clear); final JPanel b = new JPanel(new BorderLayout()); b.add(bbLeft, BorderLayout.WEST); b.add(bbRight, BorderLayout.EAST); options.setVisible(false); b.add(options, BorderLayout.SOUTH); super.setLayout(new BorderLayout()); super.add(scroll, BorderLayout.CENTER); super.add(b, BorderLayout.SOUTH); }
From source file:org.roche.antibody.ui.components.AntibodyEditorPane.java
/** * initates swing component//w w w .jav a 2s . c o m */ private void initComponents() { abstractGraphLayouter = AbstractGraphLayoutService.createLayouter(); this.abstractAntibodyView = new Graph2DView(); this.abstractAntibodyView.setFitContentOnResize(true); editMode = new AntibodyEditMode(this); abstractAntibodyView.addViewMode(editMode); // enable bridges for PolyLineEdgeRealizer BridgeCalculator bridgeCalculator = new BridgeCalculator(); bridgeCalculator.setCrossingMode(BridgeCalculator.CROSSING_MODE_HORIZONTAL_CROSSES_VERTICAL); ((DefaultGraph2DRenderer) abstractAntibodyView.getGraph2DRenderer()).setBridgeCalculator(bridgeCalculator); configureKeyboardActions(); this.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { super.componentShown(e); LOG.debug("Call componentShown of: {}", this.getClass().getName()); updateGraphLayout(); } }); this.setLayout(new BorderLayout()); // --- START Graphical Representation of Antybody (Center Panel) JSplitPane pnlSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); pnlSplit.setOneTouchExpandable(true); this.add(pnlSplit, BorderLayout.CENTER); pnlSplit.setLeftComponent(abstractAntibodyView); pnlSplit.setResizeWeight(1); // --- START Property Table, HELM Notation etc. (Right Panel) pnlEast = new JSplitPane(JSplitPane.VERTICAL_SPLIT); pnlEast.setBorder(DEFAULT_BORDER); pnlEast.setResizeWeight(0.65); antibodyPropertyModel = new DomainTableModel(); antibodyPropertyModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { abstractGraph.updateViews(); } }); propertyTable = new JTable(antibodyPropertyModel); propertyTable.setDefaultRenderer(Object.class, new DomainTableCellRenderer()); JScrollPane spnlPropertyTable = new JScrollPane(propertyTable); pnlEast.setTopComponent(spnlPropertyTable); pnlSplit.setRightComponent(pnlEast); // graphical preview graphicsPane = new JPanel(new BorderLayout()); anotherView = new Graph2DView(); graphicsPane.add(anotherView, BorderLayout.CENTER); // Tabcontainer for graphic and helm notation preview tabbedPane = new JTabbedPane(JTabbedPane.TOP); // --- HELM notation Preview Panel helmPreviewPane = new JPanel(); helmPreviewPane.setLayout(new BorderLayout()); tabbedPane.addTab("HELM Notation Preview", null, helmPreviewPane, null); // --- Button Panel for HELM notation preview JPanel pnlButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT)); cmdSaveAsXml = new JButton("Save Antibody", new ImageIcon(ResourceProvider.getInstance().get(ResourceProvider.DISK_IMAGE))); cmdSaveAsXml.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { XmlFileChooser dialog = new XmlFileChooser(); if (dialog.showSaveDialog(mainEditor.getFrame()) == JFileChooser.APPROVE_OPTION) { File abFile = dialog.getSelectedFile(); String newPath = FilenameUtils.removeExtension(abFile.getAbsolutePath()); abFile = new File(newPath + AntibodyFileChooser.XML_EXTENSION); AntibodyContainer abContainer = new AntibodyContainer(); try { antibody.setDomainLibraryPath(ConfigFileService.getInstance().getDomainLibFilename()); // PreferencesService.getInstance().getDomainLibraryFile().getAbsolutePath()); abContainer.setAntibody(antibody); abContainer.setHelmCode(helmTextArea.getText()); xmlService.marshal(abContainer, abFile); } catch (JAXBException e1) { JOptionPane.showMessageDialog(mainEditor.getFrame(), "Could not save Antibody! Please try again", "Error", JOptionPane.ERROR_MESSAGE); LOG.error("Could not save Antibody-XML to disk! {}", e1); } } } }); pnlButtons.add(cmdSaveAsXml); cmdLoadFromXml = new JButton("Load Antibody", new ImageIcon(ResourceProvider.getInstance().get(ResourceProvider.OPEN_FOLDER))); cmdLoadFromXml.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { XmlFileChooser dialog = new XmlFileChooser(); if (dialog.showOpenDialog(mainEditor.getFrame()) == JFileChooser.APPROVE_OPTION) { File abFile = dialog.getSelectedFile(); try { AntibodyContainer newAbContainer = xmlService.unmarshal(abFile); setModel(newAbContainer.getAntibody()); } catch (JAXBException e1) { JOptionPane.showMessageDialog(mainEditor.getFrame(), "Could not load Antibody! Please try again", "Error", JOptionPane.ERROR_MESSAGE); LOG.error("Could not load Antibody-XML to disk! {}", e1); } } } }); pnlButtons.add(cmdLoadFromXml); helmPreviewPane.add(pnlButtons, BorderLayout.SOUTH); pnlEast.setBottomComponent(tabbedPane); // --- HELM Notation Text Area helmTextArea = new JTextArea(); helmTextArea.setLineWrap(true); JScrollPane spnlHELMTextArea = new JScrollPane(helmTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); helmPreviewPane.add(spnlHELMTextArea, BorderLayout.CENTER); }
From source file:com.orthancserver.SelectImageDialog.java
public SelectImageDialog() { tree_ = new JTree(); tree_.addTreeWillExpandListener(new TreeWillExpandListener() { @Override/* w w w .j a v a 2 s.c om*/ public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException { TreePath path = event.getPath(); if (path.getLastPathComponent() instanceof MyTreeNode) { MyTreeNode node = (MyTreeNode) path.getLastPathComponent(); node.LoadChildren((DefaultTreeModel) tree_.getModel()); } } @Override public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException { } }); tree_.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getNewLeadSelectionPath(); if (path != null) { MyTreeNode node = (MyTreeNode) path.getLastPathComponent(); if (node.UpdatePreview(preview_)) { selectedType_ = node.GetResourceType(); selectedUuid_ = node.GetUuid(); selectedConnection_ = node.GetConnection(); okButton_.setEnabled(true); } removeServer_.setEnabled(node.GetResourceType() == ResourceType.SERVER); } } }); tree_.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { TreePath path = tree_.getPathForLocation(e.getX(), e.getY()); if (path != null) { MyTreeNode node = (MyTreeNode) path.getLastPathComponent(); if (e.getClickCount() == 2 && node.GetResourceType() == ResourceType.INSTANCE) { // Double click on an instance, close the dialog isSuccess_ = true; setVisible(false); } } } }); final JPanel contentPanel = new JPanel(); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); { JSplitPane splitPane = new JSplitPane(); splitPane.setResizeWeight(0.6); contentPanel.add(splitPane); splitPane.setLeftComponent(new JScrollPane(tree_)); splitPane.setRightComponent(preview_); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton btnAddServer = new JButton("Add server"); btnAddServer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { OrthancConfigurationDialog dd = new OrthancConfigurationDialog(); dd.setLocationRelativeTo(null); // Center dialog on screen OrthancConnection orthanc = dd.ShowModal(); if (orthanc != null) { AddOrthancServer(orthanc); ((DefaultTreeModel) tree_.getModel()).reload(); } } }); buttonPane.add(btnAddServer); } { buttonPane.add(removeServer_); removeServer_.setEnabled(false); removeServer_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { MyTreeNode selected = (MyTreeNode) tree_.getLastSelectedPathComponent(); if (selected.GetResourceType() == ResourceType.SERVER && JOptionPane.showConfirmDialog(null, "Remove server \"" + selected.getUserObject() + "\"?", "WARNING", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { ((DefaultTreeModel) tree_.getModel()).removeNodeFromParent(selected); } } }); } { okButton_.setEnabled(false); okButton_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { isSuccess_ = true; setVisible(false); } }); buttonPane.add(okButton_); getRootPane().setDefaultButton(okButton_); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { setVisible(false); } }); buttonPane.add(cancelButton); } } setUndecorated(false); setSize(500, 500); setTitle("Select some series or some instance in Orthanc"); setModal(true); }