Java Code Examples for org.jfree.chart.plot.dial.DialCap#setFillPaint()

The following examples show how to use org.jfree.chart.plot.dial.DialCap#setFillPaint() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for the dial cap.
 */
public void testCapListener() {
    DialPlot p = new DialPlot();
    DialCap c1 = new DialCap();
    p.setCap(c1);
    p.addChangeListener(this);
    this.lastEvent = null;
    c1.setFillPaint(Color.red);
    assertNotNull(this.lastEvent);

    DialCap c2 = new DialCap();
    p.setCap(c2);
    this.lastEvent = null;
    c1.setFillPaint(Color.blue);
    assertNull(this.lastEvent);
    c2.setFillPaint(Color.green);
    assertNotNull(this.lastEvent);
}
 
Example 2
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for the dial cap.
 */
public void testCapListener() {
    DialPlot p = new DialPlot();
    DialCap c1 = new DialCap();
    p.setCap(c1);
    p.addChangeListener(this);
    this.lastEvent = null;
    c1.setFillPaint(Color.red);
    assertNotNull(this.lastEvent);
    
    DialCap c2 = new DialCap();
    p.setCap(c2);
    this.lastEvent = null;
    c1.setFillPaint(Color.blue);
    assertNull(this.lastEvent);
    c2.setFillPaint(Color.green);
    assertNotNull(this.lastEvent);
}
 
Example 3
Source File: DialCapTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    DialCap c1 = new DialCap();
    DialCap c2 = new DialCap();
    assertTrue(c1.equals(c2));

    // radius
    c1.setRadius(0.5);
    assertFalse(c1.equals(c2));
    c2.setRadius(0.5);
    assertTrue(c1.equals(c2));

    // fill paint
    c1.setFillPaint(new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.green));
    assertFalse(c1.equals(c2));
    c2.setFillPaint(new GradientPaint(1.0f, 2.0f, Color.blue,
            3.0f, 4.0f, Color.green));

    // outline paint
    c1.setOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.white,
            3.0f, 4.0f, Color.gray));
    assertFalse(c1.equals(c2));
    c2.setOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.white,
            3.0f, 4.0f, Color.gray));

    assertTrue(c1.equals(c2));

    // outline stroke
    c1.setOutlineStroke(new BasicStroke(1.1f));
    assertFalse(c1.equals(c2));
    c2.setOutlineStroke(new BasicStroke(1.1f));
    assertTrue(c1.equals(c2));

    // check an inherited attribute
    c1.setVisible(false);
    assertFalse(c1.equals(c2));
    c2.setVisible(false);
    assertTrue(c1.equals(c2));
}
 
Example 4
Source File: DialCapTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    DialCap c1 = new DialCap();
    DialCap c2 = new DialCap();
    assertTrue(c1.equals(c2));
    
    // radius
    c1.setRadius(0.5);
    assertFalse(c1.equals(c2));
    c2.setRadius(0.5);
    assertTrue(c1.equals(c2));
    
    // fill paint
    c1.setFillPaint(new GradientPaint(1.0f, 2.0f, Color.blue, 
            3.0f, 4.0f, Color.green));
    assertFalse(c1.equals(c2));
    c2.setFillPaint(new GradientPaint(1.0f, 2.0f, Color.blue, 
            3.0f, 4.0f, Color.green));
    
    // outline paint
    c1.setOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.white, 
            3.0f, 4.0f, Color.gray));
    assertFalse(c1.equals(c2));
    c2.setOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.white, 
            3.0f, 4.0f, Color.gray));
    
    assertTrue(c1.equals(c2));

    // outline stroke
    c1.setOutlineStroke(new BasicStroke(1.1f));
    assertFalse(c1.equals(c2));
    c2.setOutlineStroke(new BasicStroke(1.1f));
    assertTrue(c1.equals(c2));
    
    // check an inherited attribute
    c1.setVisible(false);
    assertFalse(c1.equals(c2));
    c2.setVisible(false);
    assertTrue(c1.equals(c2));
}
 
Example 5
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    DialPlot p1 = new DialPlot();
    DialPlot p2 = new DialPlot();
    assertTrue(p1.equals(p2));

    // background
    p1.setBackground(new DialBackground(Color.green));
    assertFalse(p1.equals(p2));
    p2.setBackground(new DialBackground(Color.green));
    assertTrue(p1.equals(p2));

    p1.setBackground(null);
    assertFalse(p1.equals(p2));
    p2.setBackground(null);
    assertTrue(p1.equals(p2));

    // dial cap
    DialCap cap1 = new DialCap();
    cap1.setFillPaint(Color.red);
    p1.setCap(cap1);
    assertFalse(p1.equals(p2));
    DialCap cap2 = new DialCap();
    cap2.setFillPaint(Color.red);
    p2.setCap(cap2);
    assertTrue(p1.equals(p2));

    p1.setCap(null);
    assertFalse(p1.equals(p2));
    p2.setCap(null);
    assertTrue(p1.equals(p2));

    // frame
    StandardDialFrame f1 = new StandardDialFrame();
    f1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
            4.0f, Color.white));
    p1.setDialFrame(f1);
    assertFalse(p1.equals(p2));
    StandardDialFrame f2 = new StandardDialFrame();
    f2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
            4.0f, Color.white));
    p2.setDialFrame(f2);
    assertTrue(p1.equals(p2));

    // view
    p1.setView(0.2, 0.0, 0.8, 1.0);
    assertFalse(p1.equals(p2));
    p2.setView(0.2, 0.0, 0.8, 1.0);
    assertTrue(p1.equals(p2));

    // layer
    p1.addLayer(new StandardDialScale());
    assertFalse(p1.equals(p2));
    p2.addLayer(new StandardDialScale());
    assertTrue(p1.equals(p2));
}
 
Example 6
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    DialPlot p1 = new DialPlot();
    DialPlot p2 = new DialPlot();
    assertTrue(p1.equals(p2));
    
    // background
    p1.setBackground(new DialBackground(Color.green));
    assertFalse(p1.equals(p2));
    p2.setBackground(new DialBackground(Color.green));
    assertTrue(p1.equals(p2));
    
    p1.setBackground(null);
    assertFalse(p1.equals(p2));
    p2.setBackground(null);
    assertTrue(p1.equals(p2));
    
    // dial cap
    DialCap cap1 = new DialCap();
    cap1.setFillPaint(Color.red);
    p1.setCap(cap1);
    assertFalse(p1.equals(p2));
    DialCap cap2 = new DialCap();
    cap2.setFillPaint(Color.red);
    p2.setCap(cap2);
    assertTrue(p1.equals(p2));
    
    p1.setCap(null);
    assertFalse(p1.equals(p2));
    p2.setCap(null);
    assertTrue(p1.equals(p2));
    
    // frame
    StandardDialFrame f1 = new StandardDialFrame();
    f1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 
            4.0f, Color.white));
    p1.setDialFrame(f1);
    assertFalse(p1.equals(p2));
    StandardDialFrame f2 = new StandardDialFrame();
    f2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 
            4.0f, Color.white));
    p2.setDialFrame(f2);
    assertTrue(p1.equals(p2));
    
    // view
    p1.setView(0.2, 0.0, 0.8, 1.0);
    assertFalse(p1.equals(p2));
    p2.setView(0.2, 0.0, 0.8, 1.0);
    assertTrue(p1.equals(p2));
    
    // layer
    p1.addLayer(new StandardDialScale());
    assertFalse(p1.equals(p2));
    p2.addLayer(new StandardDialScale());
    assertTrue(p1.equals(p2));
}