public void actionPerformed(ActionEvent event) { if (event.getSource() == bstart) { selectframe.setVisible(false); for (int i = 0; i < typeButtons.length; i++) if (typeButtons[i].isSelected()) { new Thread(this).start(); return; } } else if (event.getSource() == bcancel) selectframe.setVisible(false); else if (event.getSource() == bopen) { int row = table.getSelectedRow(); if (row != -1) { ResourceEntry resourceEntry = (ResourceEntry) table.getValueAt(row, 0); NearInfinity.getInstance().showResourceEntry(resourceEntry); ((AbstractStruct) NearInfinity.getInstance().getViewable()) .getViewer() .selectEntry(((Item) table.getValueAt(row, 2)).getName()); } } else if (event.getSource() == bopennew) { int row = table.getSelectedRow(); if (row != -1) { ResourceEntry resourceEntry = (ResourceEntry) table.getValueAt(row, 0); Resource resource = ResourceFactory.getResource(resourceEntry); new ViewFrame(resultFrame, resource); ((AbstractStruct) resource) .getViewer() .selectEntry(((Item) table.getValueAt(row, 2)).getName()); } } }
public void valueChanged(ListSelectionEvent event) { if (table.getSelectedRow() == -1) textArea.setText(null); else { TableItem item = table.getTableItemAt(table.getSelectedRow()); textArea.setText(item.toString()); } textArea.setCaretPosition(0); }