Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
SaveFileDialog.java
Package: AdventNetSNMPAPI_4.zip [view]
Upload User: aonuowh
Upload Date: 2021-05-23
Package Size: 35390k
Code Size: 3k
Category:
SNMP
Development Platform:
C/C++
- /* $Id: SaveFileDialog.java,v 1.3 2002/09/09 05:46:50 parasuraman Exp $ */
- /*
- * @(#)SaveFileDialog.java
- * Copyright (c) 1996-2002 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 SaveFileDialog extends Applet {
- public SASClient sframe;
- Font fontb = new Font("Helvetica", Font.BOLD, 16);
- Font font = new Font("Helvetica", Font.PLAIN, 16);
- String advent = new String("AdventNet Save File Dialog");
- TextField field;
- TextArea text;
- /* This takes care of the look of SaveFileDialog */
- public void init() {
- try{
- sframe = new SASClient(this,true,2);}
- catch(Exception e){}
- //sframe.protocol = 2;
- setBackground(Color.lightGray);
- GridBagLayout gridbag = new GridBagLayout(); // we'll use gridbag
- GridBagConstraints c = new GridBagConstraints();
- setLayout(gridbag);
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1.0;
- c.insets = new Insets(20,10,0,10);
- c.gridwidth = GridBagConstraints.REMAINDER;
- Label label = new Label("Enter the Text to be Saved");label.setFont(fontb);
- gridbag.setConstraints(label,c);
- add(label);
- c.insets = new Insets(0,10,10,10);
- c.gridwidth = GridBagConstraints.REMAINDER;
- text = new TextArea();
- text.setEditable(true);
- gridbag.setConstraints(text,c);
- add(text);
- c.gridwidth = 1;
- label = new Label("Enter File Name to be saved");label.setFont(fontb);
- gridbag.setConstraints(label,c);
- add(label);
- c.gridwidth = GridBagConstraints.REMAINDER;
- field = new TextField();
- field.setEditable(true);
- gridbag.setConstraints(field,c);
- add(field);
- // Bottom panel is a panel sub-class we've defined for a row of buttons
- c.weighty = 0.0;
- c.gridheight = 1;
- String buttons[] = {"Save Text", "Cancel"};
- ButtonPanel bp = new ButtonPanel(buttons);
- bp.setFont(fontb);
- gridbag.setConstraints(bp,c);
- add(bp);
- resize(550,400);
- // setBackground(Title.fadedBlue);
- }
- /* 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("Save Text")) {
- try{
- String filename = (new File(field.getText())).getName(); // get rid of path
- //File f = new File("HTTPUsers"+File.separator+filename);
- //sframe.saveFile(f.getAbsolutePath(),(text.getText()).getBytes());
- sframe.saveFile(filename,(text.getText()).getBytes());
- }
- catch(Exception exc1){}
- //this.destroy();
- }
- }
- return true;
- }
- /** Allow another MIB load only if shown again */
- public synchronized void show() {
- 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);
- }
- }