private void buildList() { Vector<String> params = new Vector<String>(); OpenDataFile of = (OpenDataFile) mFileViewer.mOpenFiles.currElement(); Section sech = (Section) of.mSections.currElement(); for (int i = 0; i < sech.getNumStnVars(); i++) { params.addElement(sech.getStnVar(i)); } if (mList == null) { mList = new JOAJList(params); } else { mList.setListData(params); mList.invalidate(); } }
public void init() { this.setLayout(new BorderLayout(5, 5)); l1 = new JOAJLabel(mTitle, JOAJLabel.LEFT); this.add(l1, BorderLayout.NORTH); buildList(); mList.setVisibleRowCount(mVisibleRows - 1); if (mAllowMultipleSelection) { mList.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } else { mList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } if (mProtoCell != null) { mList.setPrototypeCellValue(mProtoCell); } else { mList.setPrototypeCellValue("SALT "); } JScrollPane listScroller = new JScrollPane(mList); this.add(listScroller, BorderLayout.CENTER); mList.addListSelectionListener((ListSelectionListener) mComp); }
public String getSelectedVariable() { return (String) (mList.getSelectedValue()); }
public void setSelectedLine(int line) { mList.setSelectedIndex(line); }