public boolean handleEvent(Event e) { if (e.id == Event.WINDOW_DESTROY) { System.out.println("Disposing of browser frame"); bf.hide(); bf.dispose(); bf = null; return true; } else { return false; } }
public boolean action(Event e, Object arg) { System.out.println(e + " " + arg); if (e.target == bf.tf) { System.out.println("new page"); String url = bf.tf.getText(); pages.addElement(url); String page = split(url); System.out.println("Server = " + server); System.out.println("Port = " + port); System.out.println("Page = " + page); connect(page); position++; bf.back.enable(); return true; } else if (e.target == bf.back) { System.out.println("pos " + position + " " + pages.size()); if (position > 0) { position--; String page = split((String) pages.elementAt(position)); bf.tf.setText((String) pages.elementAt(position)); connect(page); if (position == 0) { bf.back.disable(); } bf.forward.enable(); } return true; } else if (e.target == bf.forward) { if (position != pages.size() - 1) { position++; bf.tf.setText((String) pages.elementAt(position)); String page = split((String) pages.elementAt(position)); if (position == pages.size() - 1) { bf.forward.disable(); } bf.back.enable(); connect(page); } return true; } else if (e.target == bf.b) { System.out.println("Disposing of browser frame"); bf.hide(); bf.dispose(); bf = null; return true; } else { return false; } }