/* * PROGRAM:写真の表示 */ import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class album1 extends Applet implements ActionListener{ Button b00;Button b01;Button b02;Button b03;Button b04; Button b05;Button b06;Button b07;Button b08;Button b09; Button b10;Button b11;Button b12;Button b13;Button b14; Button b15;Button b16;Button b17;Button b18;Button b19; Button b20;Button b21;Button b22;Button b23;Button b24; Button b25;Button b26;Button b27;Button b28;Button b29; Button b30;Button b31;Button b32;Button b33;Button b34; Button b35;Button b36;Button b37;Button b38;Button b39; Button b40;Button b41;Button b42;Button b43;Button b44; Button b45;Button b46;Button b47;Button b48;Button b49; Button b50;Button b51;Button b52;Button b53;Button b54; Button b55;Button b56;Button b57;Button b58;Button b59; Button b[] = {b00,b01,b02,b03,b04,b05,b06,b07,b08,b09, b10,b11,b12,b13,b14,b15,b16,b17,b18,b19, b20,b21,b22,b23,b24,b25,b26,b27,b28,b29, b30,b31,b32,b33,b34,b35,b36,b37,b38,b39, b40,b41,b42,b43,b44,b45,b46,b47,b48,b49, b50,b51,b52,b53,b54,b55,b56,b57,b58,b59}; Image[] img; String[] name; double w,h; String s; Panel p1; int f; int no_l; int no_c; int no ; public void init(){ s = getParameter("no"); no = Integer.parseInt(s.substring(0,s.indexOf(','))); no_l = Integer.parseInt(s.substring(s.indexOf(',')+1,s.length())); no_c = no+1/no_l; img = new Image[no]; name = new String[no]; p1 = new Panel(); p1.setLayout(new GridLayout(no_l,no_c)); for (int i =0; i < no; i++){ s = getParameter("file"+i); name[i] = s.substring(0,s.indexOf(',')); img[i] = getImage(getDocumentBase(),s.substring(s.indexOf(',')+1,s.length())); p1.add(b[i] = new Button(name[i])); b[i].addActionListener(this); } setLayout(new BorderLayout()); add ("South",p1); } public void actionPerformed(ActionEvent e) { f=0; for(int i=0;i