List of usage examples for javax.swing.event ListDataListener ListDataListener
ListDataListener
From source file:com.diversityarrays.kdxplore.curate.fieldview.FieldLayoutViewPanel.java
@SuppressWarnings("unchecked") public FieldLayoutViewPanel(@SuppressWarnings("rawtypes") MutableComboBoxModel comboBoxModel, JCheckBox alwaysOnTopOption, CurationData cd, CurationTableModel ctm, SelectedValueStore svs, PlotCellChoicesPanel pccp, JPopupMenu popuMenu, Font fontForResizeControls, Action curationHelpAction, MessagePrinter mp, Closure<String> selectionClosure, CurationContext curationContext, CurationMenuProvider curationMenuProvider, FieldLayoutTableModel fieldLayoutTableModel, CellSelectableTable fieldLayoutTable, FieldViewSelectionModel fvsm,//from ww w . ja va2s. c o m JButton undockButton) { super(new BorderLayout()); this.traitInstanceCombo.setModel(comboBoxModel); this.curationData = cd; this.messagePrinter = mp; this.selectionClosure = selectionClosure; this.curationTableModel = ctm; this.fieldLayoutTableModel = fieldLayoutTableModel; this.fieldLayoutTable = fieldLayoutTable; this.fieldViewSelectionModel = fvsm; traitInstanceCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object item = comboBoxModel.getSelectedItem(); if (item instanceof TraitInstance) { TraitInstance ti = (TraitInstance) item; plotCellRenderer.setActiveInstance(ti); } } }); rhtm = new RowHeaderTableModel(true, fieldLayoutTable, rowRemovable) { public String getRowLabel(int rowIndex) { int yCoord = FieldLayoutUtil.convertRowIndexToYCoord(rowIndex, trial, fieldLayoutTableModel.getFieldLayout()); return String.valueOf(yCoord); } }; rowHeaderTable = new RowHeaderTable(SwingConstants.CENTER, false, fieldLayoutTable, rowRemovable, rhtm, RowHeaderTable.createDefaultColumnModel("X/Y")) { public String getMarkerIndexName(int viewRow) { return "MIN-" + viewRow; //$NON-NLS-1$ } }; rhtTableRowResizer = new TableRowResizer(rowHeaderTable, true); curationData.addCurationDataChangeListener(plotActivationListener); curationTableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { fieldLayoutTable.repaint(); } }); plotCellRenderer = new PlotCellRenderer(plotAttributeProvider, curationTableModel); TraitInstanceCellRenderer tiCellRenderer = new TraitInstanceCellRenderer( curationData.getTraitColorProvider(), instanceNameProvider); traitInstanceCombo.setRenderer(tiCellRenderer); traitInstanceCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateActiveTraitInstance(); } }); traitInstanceCombo.getModel().addListDataListener(new ListDataListener() { @Override public void intervalRemoved(ListDataEvent e) { updateActiveTraitInstance(); } @Override public void intervalAdded(ListDataEvent e) { updateActiveTraitInstance(); } @Override public void contentsChanged(ListDataEvent e) { updateActiveTraitInstance(); } }); this.trial = curationData.getTrial(); this.plotCellChoicesPanel = pccp; for (TraitInstance t : curationData.getTraitInstances()) { String id = InstanceIdentifierUtil.getInstanceIdentifier(t); traitById.put(id, t); } // fieldViewSelectionModel = new FieldViewSelectionModel( // fieldLayoutTable, // fieldLayoutTableModel, // svs); fieldLayoutTable.setSelectionModel(fieldViewSelectionModel); plotCellRenderer.setCurationData(curationData); plotCellRenderer.setSelectionModel(fieldViewSelectionModel); plotCellChoicesPanel.addPlotCellChoicesListener(plotCellChoicesListener); fieldLayoutTableModel.setTrial(trial); // IMPORTANT: DO NOT SORT THE FIELD LAYOUT TABLE fieldLayoutTable.setAutoCreateRowSorter(false); JScrollPane fieldTableScrollPane = new JScrollPane(fieldLayoutTable); if (undockButton != null) { fieldTableScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, undockButton); } fieldTableScrollPane.setRowHeaderView(rowHeaderTable); ChangeListener scrollBarChangeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { fireRefreshRequired(); } }; fieldTableScrollPane.getVerticalScrollBar().getModel().addChangeListener(scrollBarChangeListener); fieldTableScrollPane.getHorizontalScrollBar().getModel().addChangeListener(scrollBarChangeListener); fieldLayoutTable.setRowHeaderTable(rowHeaderTable); // fieldLayoutTable.setComponentPopupMenu(popuMenu); initFieldLayoutTable(); Map<Integer, Plot> plotById = new HashMap<>(); FieldLayout<Integer> plotIdLayout = FieldLayoutUtil.createPlotIdLayout(trial.getTrialLayout(), trial.getPlotIdentSummary(), curationData.getPlots(), plotById); KdxploreFieldLayout<Plot> kdxFieldLayout = new KdxploreFieldLayout<Plot>(Plot.class, plotIdLayout.imageId, plotIdLayout.xsize, plotIdLayout.ysize); kdxFieldLayout.warning = plotIdLayout.warning; for (int y = 0; y < plotIdLayout.ysize; ++y) { for (int x = 0; x < plotIdLayout.xsize; ++x) { Integer id = plotIdLayout.cells[y][x]; if (id != null) { Plot plot = plotById.get(id); kdxFieldLayout.store_xy(plot, x, y); } } } fieldLayoutTableModel.setFieldLayout(kdxFieldLayout); if (kdxFieldLayout.warning != null && !kdxFieldLayout.warning.isEmpty()) { warningMessage.setText(kdxFieldLayout.warning); } else { warningMessage.setText(""); //$NON-NLS-1$ } changeVisitOrderAction.putValue(Action.SMALL_ICON, KDClientUtils.getIcon(kdxFieldLayout.imageId)); List<Component> components = new ArrayList<>(); components.add(alwaysOnTopOption); Collections.addAll(components, new JButton(changeVisitOrderAction), new JButton(curationHelpAction), traitInstanceCombo); Box resizeControls = KDClientUtils.createResizeControls(fieldLayoutTable, fontForResizeControls, components.toArray(new Component[components.size()])); resizeCombo = KDClientUtils.findResizeCombo(resizeControls); if (RunMode.getRunMode().isDeveloper()) { new FieldLayoutViewPanel.DebugSettings(resizeControls, messagePrinter); } JPanel fieldPanel = new JPanel(new BorderLayout()); // if (useSeparator) { // SeparatorPanel separator = GuiUtil.createLabelSeparator("Field Layout:", resizeControls); // fieldPanel.add(separator, BorderLayout.NORTH); // fieldPanel.add(fieldTableScrollPane, BorderLayout.CENTER); // } // else { fieldPanel.add(resizeControls, BorderLayout.NORTH); fieldPanel.add(fieldTableScrollPane, BorderLayout.CENTER); // } // splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, // plotCellChoicesPanel, // fieldPanel); // splitPane.setResizeWeight(0.0); // splitPane.setOneTouchExpandable(true); add(warningMessage, BorderLayout.NORTH); add(fieldPanel, BorderLayout.CENTER); // splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, // plotCellChoicesPanel, // fieldPanel); // splitPane.setResizeWeight(0.0); // splitPane.setOneTouchExpandable(true); // // add(warningMessage, BorderLayout.NORTH); // add(splitPane, BorderLayout.CENTER); fieldLayoutTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { if (SwingUtilities.isRightMouseButton(me) && 1 == me.getClickCount()) { me.consume(); List<Plot> plots = getSelectedPlots(); List<TraitInstance> checkedInstances = new ArrayList<>(); for (int index = traitInstanceCombo.getItemCount(); --index >= 1;) { Object item = traitInstanceCombo.getItemAt(index); if (item instanceof TraitInstance) { checkedInstances.add((TraitInstance) item); } } TraitInstance ti = fieldViewSelectionModel.getActiveTraitInstance(true); List<PlotOrSpecimen> plotSpecimens = new ArrayList<>(); plotSpecimens.addAll(plots); curationMenuProvider.showFieldViewToolMenu(me, plotSpecimens, ti, checkedInstances); } } }); }
From source file:de.cismet.cids.custom.objecteditors.wunda_blau.WebDavPicturePanel.java
/** * Creates new form WebDavPicturePanel.// w w w . j a v a 2 s .c om * * @param editable DOCUMENT ME! * @param urlProp DOCUMENT ME! * @param beanCollProp DOCUMENT ME! * @param bildClassName DOCUMENT ME! * @param numberProp DOCUMENT ME! * @param geoFieldProp DOCUMENT ME! * @param connectionContext DOCUMENT ME! */ public WebDavPicturePanel(final boolean editable, final String urlProp, final String beanCollProp, final String bildClassName, final String numberProp, final String geoFieldProp, final ConnectionContext connectionContext) { this.beanCollProp = beanCollProp; this.bildClassName = bildClassName; this.numberProp = numberProp; this.geoFieldProp = geoFieldProp; this.connectionContext = connectionContext; String webdavDirectory = null; WebDavHelper webdavHelper = null; try { final ResourceBundle bundle = ResourceBundle.getBundle("WebDav"); String pass = bundle.getString("password"); if ((pass != null) && pass.startsWith(PasswordEncrypter.CRYPT_PREFIX)) { pass = PasswordEncrypter.decryptString(pass); } final String user = bundle.getString("user"); webdavDirectory = bundle.getString(urlProp); webdavHelper = new WebDavHelper(Proxy.fromPreferences(), user, pass, false); } catch (final Exception ex) { final String message = "Fehler beim Initialisieren der Bilderablage."; LOG.error(message, ex); ObjectRendererUtils.showExceptionWindowToUser(message, ex, null); } this.webdavDirectory = webdavDirectory; this.webdavHelper = webdavHelper; initComponents(); fileChooser.setFileFilter(new FileFilter() { @Override public boolean accept(final File f) { return f.isDirectory() || IMAGE_FILE_PATTERN.matcher(f.getName()).matches(); } @Override public String getDescription() { return "Bilddateien"; } }); fileChooser.setMultiSelectionEnabled(true); listRepaintListener = new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent evt) { lstFotos.repaint(); } }; lstFotos.getModel().addListDataListener(new ListDataListener() { @Override public void intervalAdded(final ListDataEvent e) { defineButtonStatus(); } @Override public void intervalRemoved(final ListDataEvent e) { defineButtonStatus(); } @Override public void contentsChanged(final ListDataEvent e) { defineButtonStatus(); } }); timer = new Timer(300, new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { if (resizeListenerEnabled) { // if (isShowing()) { if (currentResizeWorker != null) { currentResizeWorker.cancel(true); } currentResizeWorker = new ImageResizeWorker(); CismetThreadPool.execute(currentResizeWorker); // } else { // timer.restart(); // } } } }); timer.setRepeats(false); btnAddImg.setVisible(editable); btnRemoveImg.setVisible(editable); }
From source file:com.googlecode.vfsjfilechooser2.filepane.VFSFilePane.java
public JPanel createList() { JPanel p = new JPanel(new BorderLayout()); final VFSJFileChooser fileChooser = getFileChooser(); final JList aList = new JList() { @Override/*from ww w . j av a 2s . co m*/ public int getNextMatch(String prefix, int startIndex, Position.Bias bias) { ListModel model = getModel(); int max = model.getSize(); if ((prefix == null) || (startIndex < 0) || (startIndex >= max)) { throw new IllegalArgumentException(); } // start search from the next element before/after the selected element boolean backwards = (bias == Position.Bias.Backward); for (int i = startIndex; backwards ? (i >= 0) : (i < max); i += (backwards ? (-1) : 1)) { String filename = fileChooser.getName((FileObject) model.getElementAt(i)); if (filename.regionMatches(true, 0, prefix, 0, prefix.length())) { return i; } } return -1; } }; aList.setCellRenderer(new FileRenderer()); aList.setLayoutOrientation(JList.VERTICAL_WRAP); // 4835633 : tell BasicListUI that this is a file list aList.putClientProperty("List.isFileList", Boolean.TRUE); if (listViewWindowsStyle) { aList.addFocusListener(repaintListener); } updateListRowCount(aList); getModel().addListDataListener(new ListDataListener() { public void intervalAdded(ListDataEvent e) { updateListRowCount(aList); } public void intervalRemoved(ListDataEvent e) { updateListRowCount(aList); } public void contentsChanged(ListDataEvent e) { if (isShowing()) { clearSelection(); } updateListRowCount(aList); } }); getModel().addPropertyChangeListener(this); if (fileChooser.isMultiSelectionEnabled()) { aList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } else { aList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } aList.setModel(getModel()); aList.addListSelectionListener(createListSelectionListener()); aList.addMouseListener(getMouseHandler()); JScrollPane scrollpane = new JScrollPane(aList); if (listViewBackground != null) { aList.setBackground(listViewBackground); } if (listViewBorder != null) { scrollpane.setBorder(listViewBorder); } p.add(scrollpane, BorderLayout.CENTER); return p; }
From source file:org.drugis.addis.entities.Study.java
public Study(final String id, final Indication i) { super(id);/*from w w w.j a va2 s .c o m*/ d_indication = new ObjectWithNotes<Indication>(i); setCharacteristic(BasicStudyCharacteristic.CREATION_DATE, DateUtil.getCurrentDateWithoutTime()); setCharacteristic(BasicStudyCharacteristic.TITLE, ""); setCharacteristic(BasicStudyCharacteristic.PUBMED, new PubMedIdList()); final ListDataListener orphanListener = new ListDataListener() { @Override public void intervalRemoved(final ListDataEvent e) { removeOrphanMeasurements(); } @Override public void intervalAdded(final ListDataEvent e) { removeOrphanMeasurements(); } @Override public void contentsChanged(final ListDataEvent e) { removeOrphanMeasurements(); } }; d_arms.addListDataListener(orphanListener); new ContentAwareListModel<StudyOutcomeMeasure<?>>(d_outcomeMeasures).addListDataListener(orphanListener); d_endpoints = convert(Endpoint.class, d_outcomeMeasures); d_adverseEvents = convert(AdverseEvent.class, d_outcomeMeasures); d_populationChars = convert(PopulationCharacteristic.class, d_outcomeMeasures); }
From source file:org.drugis.addis.entities.StudyOutcomeMeasure.java
private StudyOutcomeMeasure(T obj, Class<? extends Variable> cls) { super(obj);//from ww w . ja va2 s . c o m d_class = cls; d_whenTaken.addListDataListener(new ListDataListener() { public void intervalRemoved(ListDataEvent e) { firePropertyChange(PROPERTY_WHEN_TAKEN_CHANGED, false, true); } public void intervalAdded(ListDataEvent e) { firePropertyChange(PROPERTY_WHEN_TAKEN_CHANGED, false, true); } public void contentsChanged(ListDataEvent e) { firePropertyChange(PROPERTY_WHEN_TAKEN_CHANGED, false, true); } }); }
From source file:org.drugis.addis.presentation.StudyGraphModel.java
public StudyGraphModel(ObservableList<Study> studies, ObservableList<DrugSet> drugs, ValueHolder<OutcomeMeasure> om) { super(Edge.class); d_drugs = drugs;// ww w. j a v a2 s. c o m d_studies = studies; d_om = om; ListDataListener rebuildNeededListener = new ListDataListener() { public void intervalRemoved(ListDataEvent e) { d_rebuildNeeded = true; } public void intervalAdded(ListDataEvent e) { d_rebuildNeeded = true; } public void contentsChanged(ListDataEvent e) { d_rebuildNeeded = true; } }; d_rebuildNeeded = true; d_studies.addListDataListener(rebuildNeededListener); d_drugs.addListDataListener(rebuildNeededListener); rebuildGraph(); }
From source file:org.drugis.addis.presentation.TreatmentDefinitionsGraphModel.java
public TreatmentDefinitionsGraphModel(ObservableList<Study> studies, ObservableList<TreatmentDefinition> definitions, ValueHolder<OutcomeMeasure> om) { super(Edge.class); d_definitions = definitions;/* www . ja va 2 s . c om*/ d_studies = studies; d_om = om; ListDataListener rebuildNeededListener = new ListDataListener() { public void intervalRemoved(ListDataEvent e) { d_rebuildNeeded = true; } public void intervalAdded(ListDataEvent e) { d_rebuildNeeded = true; } public void contentsChanged(ListDataEvent e) { d_rebuildNeeded = true; } }; d_rebuildNeeded = true; d_studies.addListDataListener(rebuildNeededListener); d_definitions.addListDataListener(rebuildNeededListener); rebuildGraph(); }
From source file:org.drugis.addis.presentation.wizard.MetaCriteriaAndAlternativesPresentation.java
public MetaCriteriaAndAlternativesPresentation(ValueHolder<Indication> indication, ModifiableHolder<AnalysisType> analysisType, SortedSetModel<MetaAnalysis> metaAnalyses) { super(indication, analysisType); d_metaAnalyses = new FilteredObservableList<MetaAnalysis>(metaAnalyses, new IndicationFilter(d_indicationModel.getValue())); d_metaAnalysesCriteria = new TransformedObservableList<MetaAnalysis, OutcomeMeasure>(d_metaAnalyses, new Transform<MetaAnalysis, OutcomeMeasure>() { public OutcomeMeasure transform(MetaAnalysis a) { return a.getOutcomeMeasure(); }// w w w. ja v a2 s . co m }); d_availableCriteria = new SortedSetModel<OutcomeMeasure>(); d_metaAnalysesCriteria.addListDataListener(new ListDataListener() { public void intervalRemoved(ListDataEvent e) { updateCriteria(); } public void intervalAdded(ListDataEvent e) { updateCriteria(); } public void contentsChanged(ListDataEvent e) { updateCriteria(); } }); d_selectedMetaAnalysesPairs = new ContentAwareListModel<CriterionAnalysisPair>( new ArrayListModel<CriterionAnalysisPair>(), new String[] { CriterionAnalysisPair.PROPERTY_ANALYSIS }); // Filter the CriterionAnalysisPair list to include only selected criteria. final Predicate<CriterionAnalysisPair> criterionSelectedFilter = new Predicate<CriterionAnalysisPair>() { public boolean evaluate(CriterionAnalysisPair obj) { return getSelectedCriteria().contains(obj.getCriterion()); } }; final FilteredObservableList<CriterionAnalysisPair> pairsWithIncludedCriterion = new FilteredObservableList<CriterionAnalysisPair>( d_selectedMetaAnalysesPairs, criterionSelectedFilter); // Re-calculate the filtered list when the selected criteria change. getSelectedCriteria().addListDataListener(new ListDataListener() { public void intervalRemoved(ListDataEvent e) { update(); } public void intervalAdded(ListDataEvent e) { update(); } public void contentsChanged(ListDataEvent e) { update(); } private void update() { pairsWithIncludedCriterion.setFilter(criterionSelectedFilter); } }); d_selectedMetaAnalyses = new TransformedObservableList<CriterionAnalysisPair, MetaAnalysis>( pairsWithIncludedCriterion, new Transform<CriterionAnalysisPair, MetaAnalysis>() { public MetaAnalysis transform(CriterionAnalysisPair pair) { return pair.getAnalysis(); } }); d_selectedMetaAnalysesPairs.addListDataListener(d_resetAlternativeEnabledModelsListener); ValueModel criteriaHaveAnalysisModel = new CriteriaHaveAnalysisModel(); d_metaCompleteModel = new BooleanAndModel(d_completeModel, criteriaHaveAnalysisModel); getSelectedCriteria().addListDataListener(new AutoSelectMetaAnalysisListener()); }
From source file:org.drugis.common.beans.FilteredObservableList.java
public FilteredObservableList(final ObservableList<E> inner, final Predicate<E> filter) { d_inner = inner;/*from w ww. j a v a2 s .com*/ d_filter = filter; initializeIndices(); d_inner.addListDataListener(new ListDataListener() { @Override public void intervalRemoved(final ListDataEvent e) { FilteredObservableList.this.intervalRemoved(e.getIndex0(), e.getIndex1()); } @Override public void intervalAdded(final ListDataEvent e) { FilteredObservableList.this.intervalAdded(e.getIndex0(), e.getIndex1()); } @Override public void contentsChanged(final ListDataEvent e) { FilteredObservableList.this.contentsChanged(e.getIndex0(), e.getIndex1()); } }); }
From source file:org.fhaes.gui.ShapeFileDialog.java
@SuppressWarnings("unchecked") private void initGUI() { setBounds(100, 100, 582, 333);/* w ww .ja v a 2 s .c o 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(); }