import java.applet.*; import java.awt.*; import java.io.*; public class Kohalik extends Applet{ Pa3 tahvel; //Panel nupud=new Panel(); Button sb; TextField tekst; Panel pv=new Panel(), np=new Panel(); public void init(){ setLayout(new BorderLayout()); pv.setLayout(new BorderLayout()); pv.add("Center", tekst=new TextField()); tekst.setEditable(false); pv.add("West", sb=new Button("/\\")); add("North", pv); add("Center", tahvel=new Pa3(this)); tahvel.butt.setLabel("Open"); } public synchronized void pildifail(){ Image img; Frame fr=new Frame(); fr.show(); fr.hide(); FileDialog fd=new FileDialog(fr, "Load File", FileDialog.LOAD); fd.show(); String file=fd.getFile(); img=getImage(getCodeBase(), file); tahvel.a.panepilt(img); kasti(); } /*public synchronized void salvesta(){ Image img; Frame fr=new Frame(); fr.show(); fr.hide(); FileDialog fd=new FileDialog(fr, "Load File", FileDialog.SAVE); fd.show(); String file=fd.getFile(); try{ DataOutputStream dos=new DataOutputStream(new FileOutputStream(file)); dos.writeBytes(tahvel.a.pildistring()); dos.close();} catch(Exception e){tekst.setText(e+" ");}; } */ public synchronized void kasti(){ tekst.setText(tahvel.a.pildistring()); tekst.selectAll(); } public boolean action(Event e, Object arg){ if(e.target==tahvel.butt)pildifail(); if(e.target==sb)kasti(); return super.action(e, arg); } }