package com.fc.vrml.image.ptg; import java.awt.*; import java.awt.event.*; import java.net.*; public class OpenURLDialog extends Dialog implements ActionListener{ public TextField textfield; public Label enterlabel; public Panel buttonpanel; public Button okbutton, cancelbutton; public GridLayout gridlayout; PixelTextureGenerator parent; public URL state=null; public OpenURLDialog(PixelTextureGenerator parent){ super(parent, "Enter image URL.", true); buttonpanel=new Panel(); gridlayout=new GridLayout(1, 2); buttonpanel.setLayout(gridlayout); setLayout(new BorderLayout()); enterlabel=new Label("Enter image URL:"); textfield=new TextField(); okbutton=new Button("OK"); cancelbutton=new Button("Cancel"); add(enterlabel, "North"); add(textfield, "Center"); buttonpanel.add(okbutton); buttonpanel.add(cancelbutton); add(buttonpanel, "South"); textfield.addActionListener(this); okbutton.addActionListener(this); cancelbutton.addActionListener(this); setSize(250,90); } public void actionPerformed(ActionEvent actionEvent){ if (actionEvent.getSource()==textfield){ try{ state=new URL(textfield.getText()); } catch (MalformedURLException mue){state=null;} } else if (actionEvent.getSource()==okbutton){ try{ state=new URL(textfield.getText()); } catch (MalformedURLException mue){state=null;} } else{ state=null; } setVisible(false); } }