graphics.drawPolygon() : right side of Hexagon not drawn, why?

I'm new to Java and one thing I wanted to do is translate the code of a C# project I made earlier this year into Java. This project involves Hexagonal Buttons, I have therefore made a JButton subclass which creates a Polygon in the constructor and saves that into a variable.

Polygon buttonShape;


public PolygonButton(String label, int size, Point location) {


    this.setSize(size, size);

    int xPoints[] = {0,(this.getWidth()/2),this.getWidth(),this.getWidth(),(this.getWidth()/2),0};
    int yPoints[] = {(this.getWidth()/4),0,(this.getWidth()/4),(3*this.getWidth()/4),this.getWidth(),(3*this.getWidth()/4)};
    int nPoints = 6;

    Polygon poly = new Polygon(xPoints,yPoints,nPoints); 


The Polygon is used in the paintBorder Method

   protected void paintBorder(Graphics g) {


But when the code is executed the Hexagon is missing it's right side and what looks like it's bottom corner. The Points chosen are fine and the Graphics.drawPolygon Method doesn't say anything about this, so I really don't know what's going on here.

Help would be aprecciated.


Need Your Help

.net Installer, Custom Action, stop and uninstall windows service

.net windows-services installer uninstall custom-action

I'm facing an issue in my .net installer application which will install three windows application together. In these three apps, one is a Windows Service. So, my installer project has three primary

Specify images to act as a bullet point using CSS

html css styling

I have shown my code below. For some reason, It's not working.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.