From 480ad70047e54b2b92f974e6c2ac5a6c0bdc5a5c Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 18 Aug 2019 13:56:09 -0400 Subject: [PATCH] Fix new + checkbox --- Grafreed.java | 40 +++++++++++++++++++++++++++++++++++----- 1 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Grafreed.java b/Grafreed.java index 2c1cfc9..8de12f4 100644 --- a/Grafreed.java +++ b/Grafreed.java @@ -881,7 +881,6 @@ // try{Thread.sleep(5000);}catch(Exception e){} // PlayAudio("/Users/nbriere/Downloads/Footsteps-6.wav", 4, 1); - /**/ if (Globals.NIMBUSLAF) { @@ -934,6 +933,8 @@ ui = UIManager.getDefaults(); + x = ui.get("RadioButton.icon"); + ArrayList gradient = new java.util.ArrayList(5); gradient.add(1.0); gradient.add(0.0); @@ -943,9 +944,9 @@ ui.put("Button.gradient", gradient); - //ui.put("RadioButton.icon", ObjEditor.GetIcon("icons/white-sphere-icon.png")); - //ui.put("RadioButtonMenuItem.checkIcon", ObjEditor.GetIcon("icons/fit.png")); - //ui.put("RadioButtonMenuItem.arrowIcon", ObjEditor.GetIcon("icons/fit.png")); + //ui.put("RadioButton.icon", new CheckBox()); //ObjEditor.GetIcon("icons/white-sphere-icon.png"))); + ui.put("CheckBox.icon", new CheckBox()); //ObjEditor.GetIcon("icons/white-sphere-icon.png"))); + //ui.put("CheckBoxMenuItem.checkIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png")); ui.put("Slider.foreground", new javax.swing.plaf.ColorUIResource(0,0,0)); ui.put("Slider.horizontalThumbIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png")); @@ -1015,7 +1016,9 @@ //Monitor mon=MonitorFactory.start("myFirstMonitor"); standAlone = true; - grafreed = new Grafreed(); + + grafreed = new Grafreed(); + grafreed.materials = ReadGFD(grafreed.getClass().getClassLoader().getResourceAsStream("gfd/materials.gfd")); grafreed.universe = new cGroup(); @@ -1035,6 +1038,33 @@ javax.swing.ToolTipManager.sharedInstance().setEnabled(Globals.TOOLTIPS); } + static class CheckBox extends javax.swing.plaf.metal.MetalCheckBoxIcon + { + java.awt.image.BufferedImage image; + + CheckBox() + { + try + { + image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream("icons/checkbox.png")); + } + catch (Exception e) + { + } + } + + protected void drawCheck(Component c, Graphics g, int x, int y) + { + super.drawCheck(c, g, x, y); + } + + public void paintIcon(Component c, Graphics g, int x, int y) + { + g.drawImage(image, x-1, y-1, 19, 19, null); + super.paintIcon(c, g, x+2, y+2); + } + } + static Object3D materials; static Object3D ReadGFD(java.io.InputStream istream) -- Gitblit v1.6.2