JPanel contentPane = new JPanel(new BorderLayout()); JButton pingButton = new JButton("Ping!"); pingButton.addActionListener(new PingListener()); contentPane.add(pingButton, BorderLayout.CENTER); setContentPane(contentPane); setSize(250, 100);
Ping returnValue = null; try { FileInputStream file = new FileInputStream("C:\\temp\\ping_stub"); ObjectInputStream objectInputStream = new ObjectInputStream(file); returnValue = (Ping) objectInputStream.readObject(); } catch (Exception e) { System.out.println("Error reading stub from file"); e.printStackTrace(); } return returnValue;