[3350] in java-interest
Frame Creation in Java
daemon@ATHENA.MIT.EDU (Mike Wallis)
Wed Nov 8 16:53:18 1995
Date: Wed, 8 Nov 1995 14:44:21 GMT
From: mike@netimage.co.uk (Mike Wallis)
To: java-interest@java.sun.com
Hiyas,
I've just started to write in Java, and I've been having some problems
getting a frame to work, I've been trying to write a Ftptool-like front-end to
the FtpClient classes and so far haven't got very far at all :-).
As far as I can see, the interpreter loads all the items but fails to
create the frame on-screen, have I missed something out? Or have I made a
mistake somewhere... I've enclosed the code which does the work.
Also, is it possible to run such a program through a Html page, and then
have the window created on the client machine after it has downloaded the
applets from the server? And how would you go about this??
package JavaFTP;
import awt.*;
import net.ftp.*;
/*
* The main class is just a frame to hold all the relevant items, such as
* buttons and menus as shown in hotjava.
* @version 1.0, 8 May 1995
* @author Mike Wallis
*
*/
public class jftp extends Frame {
static WServer server = null;
static Font dialogFont;
static Font inputFont;
static Font labelFont;
public static String programName = "JavaFTP";
public static String version = "1.0 alpha 1";
// Choose the size of our base window
public static int windowWidth = 641;
public static int windowHeight = 729;
// Function to set the title of the Window
public void setTitle(String title) {
if (title == null || title.equals("")) {
super.setTitle(programName+" "+version);
} else {
super.setTitle(programName+": "+title);
}
}
public jftp(WServer serv, String args[]) {
super(serv, true, null, windowWidth, windowHeight, Color.lightGray);
setInsets(4,0,4,0);
super.setTitle(programName);
// Set the default Text Fonts
labelFont = serv.fonts.getFont("Helvetica", Font.BOLD, 14);
inputFont = serv.fonts.getFont("DialogInput", Font.BOLD, 12);
dialogFont = serv.fonts.getFont("Dialog", Font.BOLD, 12);
setDefaultFont(dialogFont);
}
// Main function - which gets run initially
public static void main(String args[]) {
try {
server = new WServer();
} catch(Exception e) {
System.out.println("Couldn't open connection to window server");
return;
}
server.start();
jftp jftpf = new jftp(server, args);
}
}
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com