[Asterisk-java-users] handleEvent(ManagerEvent event)
Brought to you by:
srt
From: Henry S. <hen...@gm...> - 2006-08-30 11:02:43
|
Hi all, first of all sorry for this question. I know this is not really an asterisk-java question, but more a basic Java question... i have two classes Ami.Java and GUI.java ==================================== Ami.java (Login for Asterisk Manager) ==================================== public class Ami implements ManagerEventHandler { private ManagerConnection managerConnection; public Ami() throws IOException { ManagerConnectionFactory factory = new ManagerConnectionFactory(); this.managerConnection = factory.getManagerConnection ("192.168.200.1", "admin", "admin"); } public void run() throws IOException, AuthenticationFailedException, TimeoutException { managerConnection.login(); managerConnection.addEventHandler(this); } public void handleEvent(ManagerEvent event) { if((event instanceof DialEvent)) { System.out.println(((DialEvent) event).getSrc()); System.out.println(((DialEvent)event).getDestination()); } } } ====================================================== GUI.java (JFrame with 2 JTextFields) ====================================================== public class GUI extends JFrame { JPanel sPanel; JTextField sTextField1, sTextField2; public GUI() throws Exception { super ("Asterisk Manager"); sPanel = new JPanel(); sTextField1 = new JTextField(15); sTextField2 = new JTextField(15); sPanel.add(sTextField1); sPanel.add(sTextField2); Ami ami = new Ami(); ami.run(); getContentPane().add(sPanel); setSize(200,100); setVisible(true); } public static void main(String args[]) { try{GUI gui = new GUI();} catch(Exception e){} } } ======================================================= when i start GUI i have my JFrame with 2 JTextFields and the following output in the console CAPI/EICON/2001-11b SIP/2001-09088da0 Now i want to insert the first line in JTextField1 and the second file in JTextFiled2. Again, i know is not really an Asterisk-Java question but i hope someone can help me. thx in advance! |