public void actionPerformed(ActionEvent e) { if (listBefore.getSelectedValue() != null) { VideoTechnik v = (VideoTechnik) listBefore.getSelectedValue(); String str = JOptionPane.showInputDialog(panel5, "Количество: "); try { JOptionPane.showMessageDialog( panel5, "Сумма: " + String.valueOf(v.toRachet(Integer.parseInt(str)))); } catch (NumberFormatException a) { } catch (NullPointerException aa) { } } else JOptionPane.showMessageDialog(panel5, "Не выбрана VideoTechnik!!!\nPlease, try again."); }