--- /dev/null
+package com.axyus.swing.components.wizard;
+
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+
+/**
+ * @author CBO
+ * @TODO : Replace image by a BufferedImage
+ */
+public class WizardImagePanel extends javax.swing.JPanel {
+
+ private Image image;
+ private ImageRenderStyle imageRenderStyle = ImageRenderStyle.BOTTOM;
+
+ public static enum ImageRenderStyle {
+ SCALE, BOTTOM
+ }
+
+ public WizardImagePanel() {
+ initComponents();
+ }
+
+ public void setImage(Image image) {
+ Image oldImage = image;
+ this.image = image;
+ firePropertyChange("image", oldImage, image);
+ invalidate();
+ repaint();
+ }
+
+ public Image getImage() {
+ return image;
+ }
+
+ @Override
+ protected void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ Graphics2D graphics2D = (Graphics2D) g;
+ if (image != null) {
+ if (imageRenderStyle.equals(ImageRenderStyle.SCALE)) {
+ Image tempImage = image.getScaledInstance(getWidth(), getHeight(), BufferedImage.SCALE_SMOOTH);
+ graphics2D.drawImage(tempImage, (getWidth() - tempImage.getWidth(null)) / 2, (getHeight() - tempImage.getHeight(null)) / 2, null);
+ } else if (imageRenderStyle.equals(ImageRenderStyle.BOTTOM)) {
+ graphics2D.drawImage(image, (getWidth() - image.getWidth(null)) / 2, getHeight() - image.getHeight(null), null);
+ }
+ }
+ }
+
+ /** 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() {
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 400, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 300, Short.MAX_VALUE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ // End of variables declaration//GEN-END:variables
+}