Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Graphic angle

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Graphic angle

    So I find myself in an unknown environment, that being programming and java, with a tool I have barely poked at that being netbeans, needing to form an interactive graphic to show an angle in degrees.

    So in the beginning I would imagine centre point, 0.0, then a line represeting the fixed radius(or dynamic which ever is simpler to implement). This line would eminate from the point of origin to the mouse pointer (toward it if static or all the way to the pointer if dynamic).

    When the mouse is moved, the line starts to draw a sector, or pizza slice which ever you prefer, showing the current angle at the centre, up to full 360 degrees, or a perfect circle.

    I don't have any code to present as this really isn't my forte, but if anyone could point me to some tutorials that directly concern what I want to do, or has any step by step instructions or ideas to get me moving toward this goal, it would be very greatly appreciated!

    Noobs and code, terrible match up


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Graphic angle

    Looks like 2d drawing using Swing may be something you might want to use...see the following links. The basics of doing it this way would be to create a JFrame, add a JPanel in which the paintComponent method is overridden (this is where the drawing goes). If you want user interaction, you will want to add listeners to the JPanel (such as a MouseListener)
    Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)
    Trail: 2D Graphics (The Java™ Tutorials)

Similar Threads

  1. Graphic Environment Abstract Methods
    By striko_514 in forum Java Theory & Questions
    Replies: 2
    Last Post: July 5th, 2010, 01:01 AM