1 31 32 package org.objectweb.proactive.examples.penguin; 33 34 public class PenguinFrame extends javax.swing.JFrame { 35 36 private javax.swing.JPanel imagePanel; 38 private javax.swing.JLabel imageLabel; 39 40 41 public PenguinFrame(javax.swing.ImageIcon f, String location, int index) { 42 super("Agent " + index); 43 imagePanel = buildImagePanel(f); 44 this.addWindowListener(new java.awt.event.WindowAdapter () { 45 public void windowClosing(java.awt.event.WindowEvent e) { 46 System.exit(0); 47 } 48 }); 49 getContentPane().setLayout(new java.awt.BorderLayout ()); 50 getContentPane().add(new javax.swing.JLabel (location), java.awt.BorderLayout.NORTH); 51 getContentPane().add(imagePanel, java.awt.BorderLayout.CENTER); 52 pack(); 53 toFront(); 54 setVisible(true); 55 } 56 57 61 private javax.swing.JPanel buildImagePanel(javax.swing.ImageIcon i) { 62 javax.swing.JPanel temp = new javax.swing.JPanel (); 63 imageLabel = new javax.swing.JLabel (i); 64 temp.add(imageLabel); 65 return temp; 66 } 67 68 } 69 | Popular Tags |