KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > examples > imageviewer > ImageFrame


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package examples.imageviewer;
21
22 /** Instances of this class create internal frames to display given images.
23  */

24 public class ImageFrame extends javax.swing.JInternalFrame JavaDoc {
25
26     /** ImageFrame constructor.
27      * It creates new internal frame containing the given image and displays it.
28      */

29     public ImageFrame(String JavaDoc imageName ) {
30         initComponents();
31         setTitle(imageName);
32         imageLabel.setIcon(new javax.swing.ImageIcon JavaDoc(imageName) );
33     }
34
35     /** This method is called from within the constructor to
36      * initialize the form.
37      * WARNING: Do NOT modify this code. The content of this method is
38      * always regenerated by the FormEditor.
39      */

40     private void initComponents() {//GEN-BEGIN:initComponents
41
jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
42         imageLabel = new javax.swing.JLabel JavaDoc();
43
44         setClosable(true);
45         setIconifiable(true);
46         setResizable(true);
47         getAccessibleContext().setAccessibleName("Image Internal Frame");
48         getAccessibleContext().setAccessibleDescription("Image internal frame.");
49         jScrollPane1.setViewportView(imageLabel);
50         imageLabel.getAccessibleContext().setAccessibleName("Image Label");
51         imageLabel.getAccessibleContext().setAccessibleDescription("Image label.");
52
53         getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
54
55     }//GEN-END:initComponents
56

57
58     // Variables declaration - do not modify//GEN-BEGIN:variables
59
private javax.swing.JLabel JavaDoc imageLabel;
60     private javax.swing.JScrollPane JavaDoc jScrollPane1;
61     // End of variables declaration//GEN-END:variables
62

63 }
64
Popular Tags