ВУЗ:
Составители:
Рубрика:
42
void Save_actionPerformed(ActionEvent e) {
try{
String url = textField1.getText();
list1.add(url);
String query = "INSERT INTO url (adres) VALUES ('" + url + "')";
int x = st.executeUpdate(query);
}
catch (Exception ex) {
System.out.println("Ошибка подключения к БД ");
}}
void Load_actionPerformed(ActionEvent e) {
String url=list1.getSelectedItem();
try{
StringTokenizer name = new StringTokenizer(url,"/");
URL myURL = new URL(" http://" + url + "/ ");
BufferedReader br =
new BufferedReader(new InputStreamReader(myURL.openStream()));
String line;
FileWriter fw = new FileWriter(name.nextToken()+".html", false);
while ((line = br.readLine()) != null){
System.out.println(line);
fw.write(line);
}
fw.close();
br.close();
}
catch(MalformedURLException me){
System.err.println("Unknown host: " + me);
System.exit(0);
}
catch(IOException ioe){
System.err.println("Input error: " + ioe);
}
catch(NullPointerException o){
String name=url;
}
}
}
Страницы
- « первая
- ‹ предыдущая
- …
- 40
- 41
- 42
- 43
- 44
- …
- следующая ›
- последняя »