Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Gioco del 15! - LookImg.java

LookImg.java

Caricato da:
Scarica il programma completo

  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. /*
  7.  * LookImg.java
  8.  *
  9.  * Created on 21-apr-2010, 21.44.20
  10.  */
  11.  
  12. package game.graphics;
  13.  
  14. import java.awt.Image;
  15. import java.awt.image.FilteredImageSource;
  16. import java.awt.image.ReplicateScaleFilter;
  17. import javax.swing.ImageIcon;
  18.  
  19. /**
  20.  *
  21.  * @author paolo
  22.  */
  23. public class LookImg extends javax.swing.JFrame {
  24.  
  25.     /** Creates new form LookImg */
  26.     public LookImg(Image pImg) {
  27.         initComponents();
  28.         this.initImage(pImg);
  29.     }
  30.  
  31.     private void initImage(Image pImg) {
  32.         ReplicateScaleFilter scala= new ReplicateScaleFilter(150, 150);
  33.         FilteredImageSource fis= new FilteredImageSource(pImg.getSource(), scala);
  34.         pImg= createImage(fis);
  35.         this.jLabel1.setIcon(new ImageIcon(pImg));
  36.     }
  37.  
  38.  
  39.     /** This method is called from within the constructor to
  40.      * initialize the form.
  41.      * WARNING: Do NOT modify this code. The content of this method is
  42.      * always regenerated by the Form Editor.
  43.      */
  44.     @SuppressWarnings("unchecked")
  45.     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  46.     private void initComponents() {
  47.  
  48.         jPanel1 = new javax.swing.JPanel();
  49.         jLabel1 = new javax.swing.JLabel();
  50.  
  51.         setResizable(false);
  52.  
  53.         jPanel1.setBackground(new java.awt.Color(224, 14, 14));
  54.  
  55.         jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
  56.  
  57.         javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  58.         jPanel1.setLayout(jPanel1Layout);
  59.         jPanel1Layout.setHorizontalGroup(
  60.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  61.             .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
  62.         );
  63.         jPanel1Layout.setVerticalGroup(
  64.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  65.             .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
  66.         );
  67.  
  68.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  69.         getContentPane().setLayout(layout);
  70.         layout.setHorizontalGroup(
  71.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  72.             .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  73.         );
  74.         layout.setVerticalGroup(
  75.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  76.             .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  77.         );
  78.  
  79.         pack();
  80.     }// </editor-fold>//GEN-END:initComponents
  81.  
  82.     // Variables declaration - do not modify//GEN-BEGIN:variables
  83.     private javax.swing.JLabel jLabel1;
  84.     private javax.swing.JPanel jPanel1;
  85.     // End of variables declaration//GEN-END:variables
  86.  
  87. }