Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16094/src/net/sourceforge/bprocessor/gui/attrview
Modified Files:
AttributeView.java MyMouseListener.java
Log Message:
Removed dependency of awt.Color from Material
Index: AttributeView.java
===================================================================
RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** AttributeView.java 13 Jan 2006 09:29:29 -0000 1.18
--- AttributeView.java 13 Jan 2006 10:19:41 -0000 1.19
***************
*** 7,10 ****
--- 7,11 ----
package net.sourceforge.bprocessor.gui.attrview;
+ import net.sourceforge.bprocessor.model.Material;
import net.sourceforge.bprocessor.model.Observer;
import net.sourceforge.bprocessor.model.Selection;
***************
*** 190,193 ****
--- 191,206 ----
}
+
+ /**
+ * Get AWT color for material
+ * @param material The material
+ * @return The AWT color
+ */
+ private Color getMaterialColor(Material material) {
+ float[] rgb = material.getColor3fv();
+ return new Color(rgb[0], rgb[1], rgb[2]);
+ }
+
+
/**
* Display the surface
***************
*** 242,246 ****
Border blackline = BorderFactory.createLineBorder(Color.black);
front.setBorder(blackline);
! Color frontColor = o.getFrontMaterial().getColor();
front.setBackground(frontColor);
con.weightx = 1.0;
--- 255,259 ----
Border blackline = BorderFactory.createLineBorder(Color.black);
front.setBorder(blackline);
! Color frontColor = getMaterialColor(o.getFrontMaterial());
front.setBackground(frontColor);
con.weightx = 1.0;
***************
*** 277,281 ****
Border blackline = BorderFactory.createLineBorder(Color.black);
back.setBorder(blackline);
! Color backColor = o.getBackMaterial().getColor();
back.setBackground(backColor);
con.weightx = 1.0;
--- 290,294 ----
Border blackline = BorderFactory.createLineBorder(Color.black);
back.setBorder(blackline);
! Color backColor = getMaterialColor(o.getBackMaterial());
back.setBackground(backColor);
con.weightx = 1.0;
Index: MyMouseListener.java
===================================================================
RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/MyMouseListener.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MyMouseListener.java 13 Jan 2006 10:10:07 -0000 1.2
--- MyMouseListener.java 13 Jan 2006 10:19:41 -0000 1.3
***************
*** 40,44 ****
}
!
/**
* Handles mouse event
--- 40,53 ----
}
! /**
! * Get AWT color for material
! * @param material The material
! * @return The AWT color
! */
! private Color getMaterialColor(Material material) {
! float[] rgb = material.getColor3fv();
! return new Color(rgb[0], rgb[1], rgb[2]);
! }
!
/**
* Handles mouse event
***************
*** 50,54 ****
if (currentSide) {
if (currentSurface.getFrontMaterial() != null) {
! defaultColor = currentSurface.getFrontMaterial().getColor();
}
Color frontColor = JColorChooser.showDialog(GUI.getInstance(),
--- 59,63 ----
if (currentSide) {
if (currentSurface.getFrontMaterial() != null) {
! defaultColor = getMaterialColor(currentSurface.getFrontMaterial());
}
Color frontColor = JColorChooser.showDialog(GUI.getInstance(),
***************
*** 64,68 ****
} else {
if (currentSurface.getBackMaterial() != null) {
! defaultColor = currentSurface.getBackMaterial().getColor();
}
Color backColor = JColorChooser.showDialog(GUI.getInstance(),
--- 73,77 ----
} else {
if (currentSurface.getBackMaterial() != null) {
! defaultColor = getMaterialColor(currentSurface.getBackMaterial());
}
Color backColor = JColorChooser.showDialog(GUI.getInstance(),
|