diff --git a/contrib/javasupport/GNUmakefile b/contrib/javasupport/GNUmakefile index e98604ae4f..0dc47b8e4d 100644 --- a/contrib/javasupport/GNUmakefile +++ b/contrib/javasupport/GNUmakefile @@ -1,4 +1,4 @@ -# $Id: GNUmakefile,v 1.2 1998-05-29 21:27:09 d3e129 Exp $ +# $Id: GNUmakefile,v 1.3 1998-07-28 19:17:50 d3e129 Exp $ include ../../src/config/makefile.h @@ -13,12 +13,14 @@ all: $(MAKE) javacheck.class $(MAKE) classes +GIF_FILES = pc22.gif CLASSDIR = $(TOPDIR)/lib/classes classes: -test -d $(CLASSDIR) || $(MKDIR) -p $(CLASSDIR) $(MAKE) NWChem.class - -mv *.class $(CLASSDIR) + -mv *.class $(CLASSDIR) + -cp $(GIF_FILES) $(CLASSDIR) NWChem.class: NWChem.java Email.java submitted.java notsent.java waiting.java javac NWChem.java diff --git a/contrib/javasupport/ImageLoader.java b/contrib/javasupport/ImageLoader.java new file mode 100644 index 0000000000..66d350c0aa --- /dev/null +++ b/contrib/javasupport/ImageLoader.java @@ -0,0 +1,125 @@ +/** + * + * ImageLoader Class + *
+ * Offers a way to load an image (JPEG or GIF) from a disk location relative + * the a Java Class. + * These methods work when using the code as a StandAlone application, class files + * inside a Browser, and or and JAR file loaded into a Browser. + * + * To use, simply call the static method with something like this... + * Image myImage = ImageLoader.getImage(myComponent, "images", "filename.jpg"); + * where myComponent is the component to display the image on. + * + * @version 1.0 May 1998 + * @author Chris Parkinson + */ + +import java.awt.*; +import java.awt.image.*; +import java.util.*; +import java.io.*; +import java.net.URL; + + + +public class ImageLoader +{ + + +///////////////////////////////////////////////////////////////// +// +// Constructors +// +///////////////////////////////////////////////////////////////// +/** + * Construct nothing ! + */ + public ImageLoader() { + } + + +//////////////////////////////////////////////////////// +// +// Get a Resource Image +// +//////////////////////////////////////////////////////// +/** + * Get a Resource Image. + * Read in an image file from a resource ( a file located in the class path) + * This method accesses images using the getResourceStream methods of the + * Class class. + *
+ * @param owner the object who wants the image icon. + * @param pathname the pathname for the image . + * @param filename the filename for the image (GIF or JPG format). + * @return an Image + */ + public static Image getImage(Component owner, String pathname, String filename) +{ + + byte imageBytes[] = getImageBytes(owner.getClass(), pathname, filename); + if (imageBytes!=null) return getImage(owner, imageBytes); + return null; +} + + +/** + * Get a the byte array of a Resource Image. + * Read in an image file from a resource ( a file located in the class path) + * and return the image byte array. + * This method accesses images using the getResourceStream methods of the + * Class class. The file to access must be in the same directory as the class owner. + *
+ * @param classOwner the class who wants the image icon. + * @param pathname the pathname for the image . + * @param filename the filename for the image (GIF or JPG format). + * @return an array of bytes. + */ +public static byte[] getImageBytes(Class classOwner, String pathname, String +filename) { + String fullFile = filename; + if (pathname!=null)fullFile = pathname + "/" + filename; + + //Try and load our images the correct way + InputStream inputStream = classOwner.getResourceAsStream(fullFile); + + //Now we will load whatever we have + try { + byte array[] = new byte[inputStream.available()]; + inputStream.read(array); + inputStream.close(); + return array; + }catch(Exception e) { + System.out.println("Error occurred trying to read a resource image "); + System.out.println("Filename = " + fullFile); + System.out.println("Class = " + classOwner); + System.out.println(e.toString()); + return null; + } +} + +/** + * Get an image from an array of bytes. + *
+ * @param owner a component who owns the image + * @param imageData an array of bytes containing an image + * @return an Image + */ +public static Image getImage( Component owner, byte[] imageData) { + try { + Toolkit toolkit = Toolkit.getDefaultToolkit(); + Image image = toolkit.createImage(imageData); + MediaTracker tracker = new MediaTracker(owner); + tracker.addImage(image,0); + tracker.waitForAll(); + return image; + }catch(Exception e) {} + return null; +} + + + + +} + diff --git a/contrib/javasupport/ImageViewer.java b/contrib/javasupport/ImageViewer.java new file mode 100644 index 0000000000..a052c7a7fa --- /dev/null +++ b/contrib/javasupport/ImageViewer.java @@ -0,0 +1,19 @@ +import java.awt.*; +import java.net.*; + +public class ImageViewer extends Canvas { + +Image image; + +public ImageViewer(String filename) { + + + image = ImageLoader.getImage(this,"",filename); + +} +public void paint(Graphics g) { + g.drawImage(image, 0, 0, this); +} + + +} diff --git a/contrib/javasupport/NWChem.java b/contrib/javasupport/NWChem.java index 09f1a52a90..7e71b46d33 100644 --- a/contrib/javasupport/NWChem.java +++ b/contrib/javasupport/NWChem.java @@ -1,4 +1,4 @@ -// $Id: NWChem.java,v 1.3 1998-05-29 21:29:08 d3e129 Exp $ +// $Id: NWChem.java,v 1.4 1998-07-28 19:17:50 d3e129 Exp $ import java.net.Socket; import java.io.*; @@ -112,9 +112,15 @@ public NWChem() { label16.setBounds(7,620,150,30); label15 = new Label("Danielle Farrar, 1998"); - label15.setFont(new Font("SansSerif",Font.BOLD,10)); + label15.setFont(new Font("SansSerif",Font.BOLD,12)); add(label15); - label15.setBounds(550,650,120,30); + label15.setBounds(550,650,120,12); + + String picture = "pc22.gif"; + ImageViewer newimage = new ImageViewer(picture); + add(newimage); + newimage.setBounds(580,586,56,64); + /*****************Each text field is a part of the message****************/ @@ -127,10 +133,10 @@ try { String nwpath = user + "/nwchemsupport"; File nwfile = new File(nwpath); - RandomAccessFile emailfile = new RandomAccessFile(nwfile, "rw"); + RandomAccessFile emailfile = new RandomAccessFile(nwfile, "r"); String sentfrom = emailfile.readLine(); edit1.setText(sentfrom); - } catch (IOException e) {} + } catch (IOException e) {System.out.println("Remember to set your email address to the 'nwchemsupport' file in your home directory!");} edit2=new TextField(37); ////////Subject? @@ -199,99 +205,109 @@ try { add(choice2);// second choice box, describes the problem choice2.setBounds(200,308,132,26); choice2.addItem("Problem?"); - choice2.addItem("Info-request"); - choice2.addItem("Help-request"); - choice2.addItem("Fatal-bug"); - choice2.addItem("Non-fatal-bug"); - choice2.addItem("Input"); - choice2.addItem("Output"); - choice2.addItem("File"); - choice2.addItem("Execution"); - choice2.addItem("Performance"); - choice2.addItem("Web_page_problem"); - choice2.addItem("NWChem-configuration"); - choice2.addItem("Suggestion"); - choice2.addItem("Unknown"); + choice2.addItem("distribution"); + choice2.addItem("execution"); + choice2.addItem("fatal-bug"); + choice2.addItem("file"); + choice2.addItem("help-request"); + choice2.addItem("info-request"); + choice2.addItem("input"); + choice2.addItem("install"); + choice2.addItem("non-fatal-bug"); + choice2.addItem("nwchem-configuration"); + choice2.addItem("output"); + choice2.addItem("performance"); + choice2.addItem("suggestion"); + choice2.addItem("web_page_problem"); + choice2.addItem("unknown"); + choice2.addItem("developer-note "); choice3= new Choice(); add(choice3); choice3.setBounds(12,344,132,26); choice3.addItem("Module/Theory?"); - choice3.addItem("All"); - choice3.addItem("SCF"); - choice3.addItem("RISCF"); - choice3.addItem("DFT"); - choice3.addItem("RIMP2"); - choice3.addItem("MP2"); - choice3.addItem("MCSCF"); - choice3.addItem("MRPT"); - choice3.addItem("CCSD"); - choice3.addItem("CCSD(T)"); - choice3.addItem("Atomic_SCF"); - choice3.addItem("Columbus"); - choice3.addItem("Selected_CI"); - choice3.addItem("CPHF"); - choice3.addItem("QMMM"); - choice3.addItem("MD"); - choice3.addItem("Free_Energy"); - choice3.addItem("Argos_Input"); - choice3.addItem("DPLOT"); - choice3.addItem("Properties"); - choice3.addItem("Integrals"); - choice3.addItem("ECPs"); - choice3.addItem("symmetry"); - choice3.addItem("Geometry_optimization "); - choice3.addItem("Vib_module"); - choice3.addItem("Driver"); - choice3.addItem("Stepper"); - choice3.addItem("TASKS"); - choice3.addItem("Geometry_object"); - choice3.addItem("Basis_object"); - choice3.addItem("RTDB"); - choice3.addItem("FFT"); - choice3.addItem("Peigs"); - choice3.addItem("Chemio"); - choice3.addItem("TCGMSG"); - choice3.addItem("TCGMSG_MPI"); - choice3.addItem("Global_Array"); - choice3.addItem("Memory_Allocator"); + choice3.addItem("all"); + choice3.addItem("atomic_scf"); + choice3.addItem("basis_object"); + choice3.addItem("blas_lapack"); + choice3.addItem("ccsd"); + choice3.addItem("chemio"); + choice3.addItem("columbus"); + choice3.addItem("cphf"); + choice3.addItem("dft"); + choice3.addItem("dplot"); + choice3.addItem("driver_geometry_opt"); + choice3.addItem("ecp"); + choice3.addItem("esp_charge_fit"); + choice3.addItem("fft"); choice3.addItem("gapss"); + choice3.addItem("geometry_object"); + choice3.addItem("global_array"); + choice3.addItem("input_module"); + choice3.addItem("integrals"); + choice3.addItem("lapi"); choice3.addItem("makefiles"); + choice3.addItem("mcscf"); + choice3.addItem("md_nwargos"); + choice3.addItem("memory_allocator"); + choice3.addItem("moints"); + choice3.addItem("mp2"); + choice3.addItem("mrpt"); + choice3.addItem("nbo"); + choice3.addItem("peigs"); + choice3.addItem("prepar"); + choice3.addItem("properties"); + choice3.addItem("pstat"); + choice3.addItem("qmmm"); + choice3.addItem("rimp2"); + choice3.addItem("riscf"); + choice3.addItem("rtdb"); + choice3.addItem("scf"); + choice3.addItem("selected_ci"); + choice3.addItem("stepper_geometry_opt"); + choice3.addItem("symmetry"); + choice3.addItem("tasks"); + choice3.addItem("tcgmsg_or_tcgmsg_mpi"); + choice3.addItem("util_routine"); + choice3.addItem("vib"); + choice3.addItem("independent"); choice4= new Choice(); ////////fourth choice box, describes operation add(choice4); choice4.setBounds(380,308,132,26); choice4.addItem("Operation?"); - choice4.addItem("independent "); + choice4.addItem("dynamics"); choice4.addItem("energy"); + choice4.addItem("frequencies"); choice4.addItem("gradient"); + choice4.addItem("independent "); choice4.addItem("optimize"); choice4.addItem("saddle"); - choice4.addItem("frequencies"); - choice4.addItem("dynamics"); + choice4.addItem("shell"); choice4.addItem("thermodynamics"); + choice4.addItem("unknown"); choice5= new Choice(); ////////fifth choice box, describes platform add(choice5); choice5.setBounds(200,344,132,26); choice5.addItem("Platform?"); + choice5.addItem("c90_cray"); + choice5.addItem("dec"); + choice5.addItem("hp"); + choice5.addItem("ibm"); + choice5.addItem("ibmsp"); + choice5.addItem("j90_cray"); + choice5.addItem("linux"); + choice5.addItem("paragon"); + choice5.addItem("sgi32"); + choice5.addItem("sgi64"); + choice5.addItem("sun"); + choice5.addItem("t3d_cray"); + choice5.addItem("t3e_cray"); + choice5.addItem("other"); choice5.addItem("independent "); - choice5.addItem("IBMSP"); - choice5.addItem("Paragon"); - choice5.addItem("T3D_cray"); - choice5.addItem("T3E_cray"); - choice5.addItem("J9O_cray"); - choice5.addItem("C9O_cray"); - choice5.addItem("SGI32"); - choice5.addItem("SGI64"); - choice5.addItem("Linux"); - choice5.addItem("Sun"); - choice5.addItem("IBM"); - choice5.addItem("HP"); - choice5.addItem("DEC"); - choice5.addItem("Other"); button1 = new Button("Submit"); ////////the submit button, sends e-mail by clickedButton1() method @@ -461,6 +477,8 @@ try { FileDialog openDialog; Frame frame; String sent; + Image image; + int width, height; public synchronized void setVisible() { setLocation(50, 50); @@ -474,6 +492,7 @@ public void Exit() { } + public void clickedButton3() { ////////calls up dialog box, when directory/file selected, they are inserted into edit5 textField FileDialog openDialog; @@ -718,7 +737,7 @@ try { choice1.select("user_priority"); choice2.select("Problem?"); choice3.select("Module/Theory?"); - choice3.select("Module/Theory?"); +// choice3.select("Module/Theory?"); choice4.select("Operation?"); choice5.select("Platform?"); diff --git a/contrib/javasupport/pc22.gif b/contrib/javasupport/pc22.gif new file mode 100644 index 0000000000..c3ea88ae20 Binary files /dev/null and b/contrib/javasupport/pc22.gif differ