Dinesh Katwal Dinesh Katwal - 5 months ago 52
Java Question

Why white line is visible after area addition and subtraction?

Here is my Interface

package Tools;

import java.awt.Color;
import java.io.Serializable;

* @author DELL-PC
public interface ToolsModel extends Serializable {

public void setColor(Color color);

public Color getColor();

public void setVisible(boolean b);

public boolean isVisible();

public void setID(String id);

public String getID();

public ToolsModel getShape();


And i have done some creating irregular shape using this interface and from this interface and i want to Add.Subtract on interface and it's working fine but some white raised.

Here is my code which is used to Add,Subtract on interface.

public void trimShade(ToolsModel toolsModel) {
System.out.println("I am at TrimShade");
Area area = new Area();
for (ToolsModel model : getShadeList()) {
if (model.equals(toolsModel) || model.getID().equals(toolsModel.getID())) {
area.add(new Area((Shape)model));
if (!area.isEmpty()) {
((Area) model).subtract(new Area((Shape)toolsModel));


First we draw here the polygonal irregular shape and then After we draw next shape inside the first shape.

Here is the output result:

enter image description here

How to remove this white line which raised after two area addition and subtraction. It is one the border of the second Area.


I got the solution and i fixed the problem when i comment the Anti aliasing and Quality render hints.

//g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);