public void actionPerformed(ActionEvent e) { if (e.getSource() == from) { String tmpFrom = from.getText().trim(); String tmpTo = to.getText().trim(); if (tmpFrom.equals("MST") || tmpFrom.equals("mst")) findMinSpan(); else { try { // check if from exists // String str = from.getText(); // fixa så man kan skippa att skriva första med stor bokstav tmpFrom = Character.toUpperCase(tmpFrom.charAt(0)) + tmpFrom.substring(1); int pos = noderna.findLeading(tmpFrom).getNodeNo(); route.setText(introText + "\n"); from.setText(noderna.find(pos).toString()); } catch (NullPointerException npe) { route.setText(felTextStart + "\n"); return; } if (!tmpTo.equals("")) { findShort(); } } } else if (e.getSource() == to) { String tmpFrom = from.getText().trim(); String tmpTo = to.getText().trim(); if (tmpTo.equals("MST") || tmpTo.equals("mst")) findMinSpan(); else { try { // check if to exists // String str = to.getText(); tmpTo = Character.toUpperCase(tmpTo.charAt(0)) + tmpTo.substring(1); int pos = noderna.findLeading(tmpTo).getNodeNo(); route.setText(introText + "\n"); to.setText(noderna.find(pos).toString()); } catch (NullPointerException npe) { route.setText(felTextStart + "\n"); return; } if (!tmpFrom.equals("")) { findShort(); } } /* else if ( ! from.getText().equals("") ) findShort(); */ } }