/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * ImagePanel.java * * Created on Nov 3, 2009, 4:25:01 PM */ package com.server.gui; import java.io.File; import javax.swing.ImageIcon; /** * * @author Administrator */ public class ImagePanel extends javax.swing.JPanel { private String imageFileName = ""; private int imageNumber = -1; /** Creates new form ImagePanel */ public ImagePanel() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { imageLabel = new javax.swing.JLabel(); setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { formMouseClicked(evt); } }); imageLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/server/icons/defaultClient.PNG"))); // NOI18N imageLabel.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { imageLabelMouseClicked(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(imageLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(imageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(24, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked // TODO add your handling code here: }//GEN-LAST:event_formMouseClicked private void imageLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_imageLabelMouseClicked // TODO add your handling code here: if (evt.getClickCount() == 2) { ImageViewerDialog imageViewerDialog = new ImageViewerDialog(null, true); imageViewerDialog.setFileName(imageFileName); imageViewerDialog.setImageCount(imageNumber); imageViewerDialog.setLocationRelativeTo(null); imageViewerDialog.setVisible(true); } }//GEN-LAST:event_imageLabelMouseClicked // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel imageLabel; // End of variables declaration//GEN-END:variables public void setFileName(String imageFileName) { this.imageFileName = imageFileName; } public void setImageForPane(ImageIcon imageIcon) { imageLabel.setIcon(imageIcon); } public void setIMageNumber(int imageNumber) { this.imageNumber = imageNumber; } }