@Test public void testGetColor() { JColorChooser colorChooser = new JColorChooser(); colorChooser.setColor(Color.BLACK); Whitebox.setInternalState(panLine, "colorChooser", colorChooser); String actual = panLine.getColor(); String expected = "000000"; assertEquals(expected, actual); }
public String getColor() { Color color = colorChooser.getColor(); String red = Integer.toHexString(color.getRed()); if(red.length()==1)red="0"+red; String green = Integer.toHexString(color.getGreen()); if(green.length()==1)green="0"+green; String blue = Integer.toHexString(color.getBlue()); if(blue.length()==1)blue="0"+blue; String rgbHexValue = red + green + blue; return rgbHexValue; }
PanLine extends JPanel { public String getColor() { Color color = colorChooser.getColor(); String red = Integer.toHexString(color.getRed()); if(red.length()==1)red="0"+red; String green = Integer.toHexString(color.getGreen()); if(green.length()==1)green="0"+green; String blue = Integer.toHexString(color.getBlue()); if(blue.length()==1)blue="0"+blue; String rgbHexValue = red + green + blue; return rgbHexValue; } }
PanLine extends JPanel { public String getColor() { Color color = colorChooser.getColor(); String red = Integer.toHexString(color.getRed()); if(red.length()==1)red="0"+red; String green = Integer.toHexString(color.getGreen()); if(green.length()==1)green="0"+green; String blue = Integer.toHexString(color.getBlue()); if(blue.length()==1)blue="0"+blue; String rgbHexValue = red + green + blue; return rgbHexValue; } PanLine(); }
PanLine extends JPanel { public String getColor() { Color color = colorChooser.getColor(); String red = Integer.toHexString(color.getRed()); if(red.length()==1)red="0"+red; String green = Integer.toHexString(color.getGreen()); if(green.length()==1)green="0"+green; String blue = Integer.toHexString(color.getBlue()); if(blue.length()==1)blue="0"+blue; String rgbHexValue = red + green + blue; return rgbHexValue; } PanLine(); String getAlign(); String getThickness(); String getCustomWidth(); String getCustomWidthUnit(); String getColor(); void setAlign(EnumAlign enumAlign); void setThickness(String thickness); void setCustomWidth(String width); void setCustomWidthUnit(EnumWidthUnit enumWidthUnit); void setColor(String hexValue); }
PanLine extends JPanel { public String getColor() { Color color = colorChooser.getColor(); String red = Integer.toHexString(color.getRed()); if(red.length()==1)red="0"+red; String green = Integer.toHexString(color.getGreen()); if(green.length()==1)green="0"+green; String blue = Integer.toHexString(color.getBlue()); if(blue.length()==1)blue="0"+blue; String rgbHexValue = red + green + blue; return rgbHexValue; } PanLine(); String getAlign(); String getThickness(); String getCustomWidth(); String getCustomWidthUnit(); String getColor(); void setAlign(EnumAlign enumAlign); void setThickness(String thickness); void setCustomWidth(String width); void setCustomWidthUnit(EnumWidthUnit enumWidthUnit); void setColor(String hexValue);  }