From ddb10cb84dddfeef1ef9946f2e13cef3c93e6cc4 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Wed, 20 Nov 2019 20:49:12 -0500
Subject: [PATCH] New maze

---
 cCheckBox.java |   41 +++++++++++++++++++++++++++++++----------
 1 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/cCheckBox.java b/cCheckBox.java
index bf26b8b..8135140 100644
--- a/cCheckBox.java
+++ b/cCheckBox.java
@@ -1,19 +1,40 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
 
-/**
- *
- * @author nbriere
- */
+import javax.swing.ImageIcon;
+
 public class cCheckBox extends javax.swing.JCheckBox
 {
     cCheckBox(String name, boolean enabled)
     {
         super(name, enabled);
-        
-        setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
+
+        setBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0));
         //setBorder(new javax.swing.border.EtchedBorder());
     }
+
+    cCheckBox(ImageIcon icon, boolean enabled)
+    {
+        super("", enabled);
+
+        this.image = icon.getImage();
+        iconWidth = icon.getIconWidth();
+
+        setBorder(new javax.swing.border.EmptyBorder(8, 0, 8, 24)); // top, left, bottom, right
+        //setBorder(new javax.swing.border.EtchedBorder());
+    }
+    
+    private java.awt.Image image;
+    private int iconWidth;
+
+    @Override
+    protected void paintComponent(java.awt.Graphics g)
+    {
+        super.paintComponent(g);
+        if (image != null)
+        {
+            //if (getWidth() > image.getWidth(null) + 8)
+            {
+                g.drawImage(image, 18, 6, this);
+            }
+        }
+    }
 }

--
Gitblit v1.6.2