DeleteDirDialog.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:2k
- /* $Id: DeleteDirDialog.java,v 1.3 2002/09/09 05:46:50 parasuraman Exp $ */
- /*
- * @(#)CreateDirDialog.java
- * Copyright (c) 1996-2003 AdventNet, Inc. All Rights Reserved.
- * Please read the associated COPYRIGHTS file for more details.
- */
- import java.applet.*;
- import java.io.*;
- import java.awt.*;
- import java.util.*;
- import com.adventnet.snmp.snmp2.SASClient;
- public class DeleteDirDialog extends Applet {
- Label label ;
- TextField textfield;
- ButtonPanel ok_close =null;
- public SASClient sframe; // The frame that provides the OK function
- Font fontb = new Font("Helvetica", Font.BOLD, 16);
- Font font = new Font("Helvetica", Font.PLAIN, 16);
- String advent = new String("AdventNet Delete Directory Dialog");
- /* This takes care of the look of CreateDirDialog */
- public void init() {
-
- try{
- sframe = new SASClient(this,false,2);}
- catch(Exception e){}
- //sframe.protocol = 2;
- setBackground(Color.lightGray);
- setLayout(new BorderLayout());
-
- label = new Label("Directory Name to be Deleted");
- textfield = new TextField(40);
- setLayout(new FlowLayout(FlowLayout.LEFT));
- add(label);
- add(textfield);
- String buttons[] = {"OK","Cancel"};
- ok_close = new ButtonPanel(buttons);
- add("South", ok_close);
- resize(550,200);
- }
- boolean loading = false; // to avoid loading MIBs twice
- /* for OK and CANCEL actions */
- public boolean action(Event e, Object arg) {
- if (e.target instanceof Button) {
- //if (arg.equals("Cancel")) this.hide();
- //else
- if (arg.equals("OK")) {
-
- loading = true;
-
- try{
-
-
- String filename = (new File(textfield.getText())).getName(); // get rid of path
- //File f = new File("HTTPUsers"+File.separator+filename);
- //sframe.deleteDir(f.getAbsolutePath());
- sframe.deleteDir(filename);
- }
-
- catch(Exception ex){//ex.printStackTrace();
- }
-
- }
- }
- return true;
- }
- /** Allow another MIB load only if shown again */
- public synchronized void show() {
- loading = false;
- super.show();
- }
- /** To handle destroy window - pass all else to parent */
- public boolean handleEvent(Event e) {
- if (e.id == Event.WINDOW_DESTROY) {
- hide();
- }
- return super.handleEvent(e);
- }
- }