// Panel settings
setOpaque ( false );
setWebColoredBackground ( false );
setMargin ( 2, 5, 2, 5 );
setLayout ( new TableLayout ( new double[][]{ { TableLayout.FILL, 4, TableLayout.PREFERRED, 4, TableLayout.PREFERRED },
{ TableLayout.PREFERRED, TableLayout.PREFERRED } } ) );
palette = new PaletteColorChooser ();
palette.setOpaque ( false );
palette.setWebOnlyColors ( isWebOnlyColors () );
final ChangeListener paletteListener = new ChangeListener ()
{
@Override
public void stateChanged ( final ChangeEvent e )
{
color = palette.getColor ();
updateColors ( color, UpdateSource.palette );
}
};
palette.addChangeListener ( paletteListener );
add ( palette, "0,0" );
lineColorChooser = new LineColorChooser ();
lineColorChooser.setOpaque ( false );
lineColorChooser.setWebOnlyColors ( isWebOnlyColors () );
lineColorChooser.addChangeListener ( new ChangeListener ()
{
@Override
public void stateChanged ( final ChangeEvent e )
{
palette.setSideColor ( lineColorChooser.getColor () );
}
} );
add ( lineColorChooser, "2,0" );
final JPanel infoPanel = new JPanel ();
infoPanel.setLayout ( new TableLayout ( new double[][]{ { TableLayout.PREFERRED, 4, TableLayout.FILL },
{ 3, TableLayout.FILL, 5, TableLayout.PREFERRED, 4, TableLayout.PREFERRED, 1, TableLayout.PREFERRED, 1,
TableLayout.PREFERRED, 1, TableLayout.PREFERRED, 3 } } ) );
infoPanel.setOpaque ( false );
add ( infoPanel, "4,0" );
doubleColorField = new DoubleColorField ();
doubleColorField.addDoubleColorFieldListener ( new DoubleColorFieldListener ()
{
@Override
public void newColorPressed ( final Color newColor )
{
//
}
@Override
public void oldColorPressed ( final Color currentColor )
{
setColor ( doubleColorField.getOldColor () );
}
} );
updateDoubleColorField ( color );
doubleColorField.setOldColor ( oldColor );
infoPanel.add ( doubleColorField, "0,1,2,3" );
infoPanel.add ( new WebSeparator ( WebSeparator.HORIZONTAL ), "0,5,2,5" );
final JPanel colorsPanel = new JPanel ();
colorsPanel.setLayout ( new TableLayout ( new double[][]{ { TableLayout.FILL, 5, TableLayout.PREFERRED, 4, TableLayout.PREFERRED },
{ TableLayout.PREFERRED, 0, TableLayout.PREFERRED, 0, TableLayout.PREFERRED, 1, TableLayout.PREFERRED, 1,
TableLayout.PREFERRED, 0, TableLayout.PREFERRED, 0, TableLayout.PREFERRED } } ) );
colorsPanel.setOpaque ( false );
infoPanel.add ( colorsPanel, "0,7,2,7" );