Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

suspected bug in my java interpreter

Thread view: 
kvnsmnsn@hotmail.com - 23 Jul 2007 16:23 GMT
The detailed API for the <drawPolyline()> method of the <Graphics>
class says, "The figure is not closed if the first point differs from
the last point."  So the following program should result in two line
segments being drawn, one from (100,100) to (100,800) and another from
(100,800) to (800,800).  However when I execute the program I get the
triangle that would be created by closing the polyline.  Isn't that a
bug?

FYI, when I type in "java -version" I get 1.4.2.

                               ---Kevin Simonson

"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_

####################################################################

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.Color;
import java.awt.Dimension;

public class Bug extends JPanel
{
 static final long serialVersionUID = 0L;

 private Bug ()
 {
   setPreferredSize( new Dimension( 900, 900));
   setBackground( Color.black);
 }

 protected void paintComponent ( Graphics page)
 {
   super.paintComponent( page);
   int[] xCoos = { 100, 100, 800 };
   int[] yCoos = { 100, 800, 800 };
   page.setColor( Color.cyan);
   page.drawPolyline( xCoos, yCoos, 3);
 }

 public static void main ( String[] arguments)
 {
   Bug    bugPanel = new Bug();
   JFrame bugFrame = new JFrame( "Bug");
   bugFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE);
   bugFrame.getContentPane().add( bugPanel);
   bugFrame.pack();
   bugFrame.setVisible( true);
 }
}
Patricia Shanahan - 23 Jul 2007 16:39 GMT
> The detailed API for the <drawPolyline()> method of the <Graphics>
> class says, "The figure is not closed if the first point differs from
[quoted text clipped - 5 lines]
>
> FYI, when I type in "java -version" I get 1.4.2.

It works as you expected, two lines rather than a triangle, when I run
it, 1.6.0_01.

Patricia
Roedy Green - 23 Jul 2007 20:17 GMT
>It works as you expected, two lines rather than a triangle, when I run
>it, 1.6.0_01.

ditto for me on 1.6.0_02, Vista Home Premium.

Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Eric Sosman - 23 Jul 2007 16:49 GMT
kvnsmnsn@hotmail.com wrote On 07/23/07 11:23,:
> The detailed API for the <drawPolyline()> method of the <Graphics>
> class says, "The figure is not closed if the first point differs from
[quoted text clipped - 5 lines]
>
> FYI, when I type in "java -version" I get 1.4.2.

   Works fine for me, on two Java versions:

java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

Solaris 9 (SPARC) -- What's your platform?

Signature

Eric.Sosman@sun.com

Thomas Fritsch - 23 Jul 2007 17:12 GMT
> The detailed API for the <drawPolyline()> method of the <Graphics>
> class says, "The figure is not closed if the first point differs from
[quoted text clipped - 5 lines]
>
> FYI, when I type in "java -version" I get 1.4.2.
When executing your program I got 2 lines, not the triangle.
==> I couldn't reproduce the bug.
(Tested with Java 1.4.2_05, 1.5.0_10, 1.6.0_01, all on WinXP)

Signature

Thomas

HightowerC - 23 Jul 2007 17:18 GMT
2 lines, no triangle for me,

version 1.6.0_02

HightowerC
Patricia Shanahan - 23 Jul 2007 18:17 GMT
> The detailed API for the <drawPolyline()> method of the <Graphics>
> class says, "The figure is not closed if the first point differs from
[quoted text clipped - 3 lines]
> triangle that would be created by closing the polyline.  Isn't that a
> bug?
...

Given the general inability to reproduce the problem, how sure are you
that the source code you posted is the test case you ran? Any
possibility that you are running a different version of the program?

Patricia


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.