@Test public void testSetColor() { JColorChooser colorChooser = new JColorChooser(); colorChooser.setColor(Color.BLACK); Whitebox.setInternalState(panLine, "colorChooser", colorChooser); panLine.setColor("FFFFFF"); Color expected = Color.WHITE; Color actual = colorChooser.getColor(); assertEquals(expected, actual); }
public void setColor(String hexValue) { if (hexValue.length() != 6) { throw new RuntimeException("Invalid hex color for panel"); } Integer red = Integer.parseInt(hexValue.substring(0, 2),16); Integer green = Integer.parseInt(hexValue.substring(2, 4),16); Integer blue = Integer.parseInt(hexValue.substring(4, 6),16); Color color = new Color(red, green, blue); colorChooser.setColor(color); }
PanLine extends JPanel { public void setColor(String hexValue) { if (hexValue.length() != 6) { throw new RuntimeException("Invalid hex color for panel"); } Integer red = Integer.parseInt(hexValue.substring(0, 2),16); Integer green = Integer.parseInt(hexValue.substring(2, 4),16); Integer blue = Integer.parseInt(hexValue.substring(4, 6),16); Color color = new Color(red, green, blue); colorChooser.setColor(color); } }
PanLine extends JPanel { public void setColor(String hexValue) { if (hexValue.length() != 6) { throw new RuntimeException("Invalid hex color for panel"); } Integer red = Integer.parseInt(hexValue.substring(0, 2),16); Integer green = Integer.parseInt(hexValue.substring(2, 4),16); Integer blue = Integer.parseInt(hexValue.substring(4, 6),16); Color color = new Color(red, green, blue); colorChooser.setColor(color); } PanLine(); }
PanLine extends JPanel { public void setColor(String hexValue) { if (hexValue.length() != 6) { throw new RuntimeException("Invalid hex color for panel"); } Integer red = Integer.parseInt(hexValue.substring(0, 2),16); Integer green = Integer.parseInt(hexValue.substring(2, 4),16); Integer blue = Integer.parseInt(hexValue.substring(4, 6),16); Color color = new Color(red, green, blue); colorChooser.setColor(color); } 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 void setColor(String hexValue) { if (hexValue.length() != 6) { throw new RuntimeException("Invalid hex color for panel"); } Integer red = Integer.parseInt(hexValue.substring(0, 2),16); Integer green = Integer.parseInt(hexValue.substring(2, 4),16); Integer blue = Integer.parseInt(hexValue.substring(4, 6),16); Color color = new Color(red, green, blue); colorChooser.setColor(color); } 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);  }