Draw circle, intersects Ellipse2D need help

looks like have a few error... i have no idea how to fix it now. help plz.
Circle class file.
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import javax.swing.JOptionPane;
public class Circle
     private double radius;
     private int centerX, centerY;
     private Color fillColor;
     public Circle()
          radius=0;
          centerX=0;
          centerY=0;
     public double getRadius()
          return radius;
     public void setRadius(double newRadius)
          radius=newRadius;
     public int getCenterX()
          return centerX;
     public int getCenterY()
          return centerY;
     public void setCenterX(int newCenterX)
          centerX=newCenterX;
     public void setCenterY(int newCenterY)
          centerY=newCenterY;
     public void setFillColor(Color newColor)
          fillColor=newColor;
     public Color getFillColor()
          return fillColor;
     public void draw(Graphics g)
          Graphics2D g2= (Graphics2D) g;
          radii=this.getRadius()
          if( radius>=0 )
               g2.fill( Ellipse2D.Double(radii*2,radii*2,this.centerX-radii,this.centerY-radii));
          else
               g2.fill( Ellipse2D.Double(0,0,centerX,centerY));
     public boolean intersects(Circle circle2)
          double radiusLength1 = this.getRadius();
          double radiusLength2 = circle2.getRadius();
          double totalRadius = radiusLength1+radiusLength2;
          double distance = Math.sqrt(
               (Math.pow(this.centerX-circle2.centerX,2))+
               (Math.pow(this.centerY-circle2.centerY,2))
          return boolean totalRadius >= distance;
CircleComponent class code
import java.awt.Color;
import java.util.Random;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import javax.swing.JOptionPane;
import javax.swing.JComponent;
public class CircleComponent extends JComponent
     public static void CircleComponent (String[] args)
          double radius;
          Circle circle1,circle2;x
          circle1=new Circle();
          circle2=new Circle();
          circle1.setCenterX(200);
          circle1.setCenterY(100);
          circle2.setCenterX(100);
          circle2.setCenterY(200);
          Random generator= new Random();
          Color color1 = new Color (generator.nextInt(256), generator.nextInt(256), generator.nextInt(256));
          circle1.setFillColor(color1);
          Color color2 = new Color (generator.nextInt(256), generator.nextInt(256), generator.nextInt(256));
          circle2.setFillColor(color2);
          String input=JOptionPane.showInputDialog("Set the circle1's radius ");
          radius = Integer.parseInt(input);
          circle1.setRadius(radius);
          input=JOptionPane.showInputDialog("Set the circle2's radius ");
          radius = Integer.parseInt(input);
          circle2.setRadius(radius);
     public void paintComponent (Graphics g)
          Graphics2D g2= (Graphics2D) g;
          g2.setColor(color1);
          g2.draw(circle1);
          g2.setColor(circle2.getFillColor());
          g2.draw(circle2);
          //draw String intersectsResult
          g2.setColor(Color.BLACK);
          String intersectsResult;
          if (circle1.intersects(circle2))
               intersectsResult="Two circles intersected";
          else
               intersectsResult="Two circles not intersected";
          g2.drawString(intersectsResult,20,380);
}

looks like have a few error... i have no idea howto fix it now. help plz.
what are the errors?
copy and paste themI think the code simply "does not work" as expected ;)

Similar Messages

  • Drawing Custom 2D Graph : Need Help!

    Hi,
    I'm new to this forum, but I figured this would be the best place to ask for help.
    I'm currently working on a new project; a Graphing Calculator for algoriths and such. I've been with Java for a while now, but I have ran into a few snags with my new project.
    [1] For now, I have a line wizard that seperates a algorithm (linear, polynomial only for now) into chunks. How would I go out Parsing it totally from a string, in any format. I need to include such mathmatical operations such as sin( , cos( and ect. I have not even started on a rough draft yet, because I don't know where to start.
    [2] My custom GraphClass is having a hard time repersenting different rates for minium and maxium axis size. For some reason both axis wont draw in the right spot, meaning my X() and Y() are coded wrong. This is some of my code for now:
    For the full class file goto : [http://pastebin.com/Ty9ndCc4]
    public int width = 390;
    public int length = 390;
    public static int minX = (int) -200;
    public static int maxX = (int) 200;
    public static float XScale = 390/ ( Math.abs(maxX)  +Math.abs(minX) );+
    +public static int minY = (int) -200;+
    +public static int maxY = (int) 200;+
    +public static float YScale = 390/ ( Math.abs(maxY)+  Math.abs(minY) );
    public static int X() {
         return (int) ((int) Math.round(abs(minX)*(float)XScale));*
    *public static int Y() {*
    *return (int) 390 - ((int) Math.round(abs(minY)*(float)YScale)); // 390 -  *because of the Y axis being upside down*
    *// This works very well. LineDirection is a made class. Pretty simple to figure out.*
    *public void drawLine(Graphics g, LineDirection dir) {*
    *if (!dir.isActivated())*
    *return;*
    *Point[] points = dir.getPoints();*
    *Color defaultColor = g.getColor();*
    *g.setColor(dir.getColor());*
    *for (int i = 1; i < points.length; i++) {*
    *int X1 = (int) points[i-1].getX();*
    *int Y1 = (int) points[i-1].getY();*
    *int X2 = (int) points.getX();*
    *int Y2 = (int) points[i].getY();*
    g.drawLine((int) X()  +(int)(X1XScale),(int)Y()+ (int)(Y1*YScale* -1),(int) X() +(int)(X2*XScale),(int) Y()+ (int)(Y2*YScale * -1));
    g.setColor(defaultColor);
    public void drawDefaultGrid(Graphics g) {
    g.drawLine(0, Y() , width, Y());
    g.drawLine(X(), 0, X(), length);
    [http://pastebin.com/Ty9ndCc4]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    RedDevil_05 wrote:
    [1] For now, I have a line wizard that seperates a algorithm (linear, polynomial only for now) into chunks. How would I go out Parsing it totally from a string, in any format. I need to include such mathmatical operations such as sin( , cos( and ect. I have not even started on a rough draft yet, because I don't know where to start.Here is a thread that may contain your answer: using the [JavaScript Engine|http://forums.sun.com/thread.jspa?threadID=5144807] to evaluate the String containing the expression.
    [2] My custom GraphClass is having a hard time repersenting different rates for minium and maxium axis size. For some reason both axis wont draw in the right spot, meaning my X() and Y() are coded wrong. This is some of my code for now:The X axis in Java is just standard increasing to the right and decreasing to the left, therefore, you can easily center by just dividing your maximum X by 2 for a center position. Y on the other hand is going to be a little more difficult, since the Y will be decreasing in the upward direction and increasing downward. You can easily get the center the same way as with the X axis (divid by 2), but then when you plot, you just change the sign on all of your Y coordinates.
    I prefer to use a BufferedImage for my graphics, line graphs or custom rendering for games and etc. I can work with that and it will then easily render onto the graphics context of a JPanel.
    Hope this help you out.
    BTW: your posted code seems to have been gnawed on by an ugly moster or something--it is hideously corrupted, but your link showing your full source shows decent enough code.

  • Gelly circle shape effect, need help.

    Hi, would you please help me to create in AE a "gelly" effect applied to a circle shape? I've tried to use a combination of wiggle path properties and time displacement with linear wipe transform but I'm not able to get something similar with this example.
    https://www.youtube.com/watch?v=s0xtwD9D9zw&feature=youtu.be    I just captured this sample from other video but it's for personal use.
    Thank you!

    If you want to use effects, a simple Ripple effect would be more appropriate. Otehr than that you may simply have to keyframe the path shape...
    Mylenium

  • Need help to draw a graph from the output I get with my program please

    Hi all,
    I please need help with this program, I need to display the amount of money over the years (which the user has to enter via the textfields supplied)
    on a graph, I'm not sure what to do further with my program, but I have created a test with a System.out.println() method just to see if I get the correct output and it looks fine.
    My question is, how do I get the input that was entered by the user (the initial deposit amount as well as the number of years) and using these to draw up the graph? (I used a button for the user to click after he/she has entered both the deposit and year values to draw the graph but I don't know how to get this to work?)
    Please help me.
    The output that I got looked liked this: (just for a test!) - basically this kind of output must be shown on the graph...
    The initial deposit made was: 200.0
    After year: 1        Amount is:  210.00
    After year: 2        Amount is:  220.50
    After year: 3        Amount is:  231.53
    After year: 4        Amount is:  243.10
    After year: 5        Amount is:  255.26
    After year: 6        Amount is:  268.02
    After year: 7        Amount is:  281.42
    After year: 8        Amount is:  295.49
    After year: 9        Amount is:  310.27
    After year: 10        Amount is:  325.78
    After year: 11        Amount is:  342.07
    After year: 12        Amount is:  359.17
    After year: 13        Amount is:  377.13
    After year: 14        Amount is:  395.99
    After year: 15        Amount is:  415.79
    After year: 16        Amount is:  436.57
    After year: 17        Amount is:  458.40And here is my code that Iv'e done so far:
    import javax.swing.*;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.lang.Math;
    import java.text.DecimalFormat;
    public class CompoundInterestProgram extends JFrame implements ActionListener {
        JLabel amountLabel = new JLabel("Please enter the initial deposit amount:");
        JTextField amountText = new JTextField(5);
        JLabel yearsLabel = new JLabel("Please enter the numbers of years:");
        JTextField yearstext = new JTextField(5);
        JButton drawButton = new JButton("Draw Graph");
        public CompoundInterestProgram() {
            super("Compound Interest Program");
            setSize(500, 500);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            amountText.addActionListener(this);
            yearstext.addActionListener(this);
            JPanel panel = new JPanel();
            panel.setBackground(Color.white);
            panel.add(amountLabel);
            amountLabel.setToolTipText("Range of deposit must be 20 - 200!");
            panel.add(amountText);
            panel.add(yearsLabel);
            yearsLabel.setToolTipText("Range of years must be 1 - 25!");
            panel.add(yearstext);
            panel.add(drawButton);
            add(panel);
            setVisible(true);
            public static void main(String[] args) {
                 DecimalFormat dec2 = new DecimalFormat( "0.00" );
                CompoundInterestProgram cip1 = new CompoundInterestProgram();
                JFrame f = new JFrame();
                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                f.getContentPane().add(new GraphPanel());
                f.setSize(500, 500);
                f.setLocation(200,200);
                f.setVisible(true);
                Account a = new Account(200);
                System.out.println("The initial deposit made was: " + a.getBalance() + "\n");
                for (int year = 1; year <= 17; year++) {
                      System.out.println("After year: " + year + "   \t" + "Amount is:  " + dec2.format(a.getBalance() + a.calcInterest(year)));
              @Override
              public void actionPerformed(ActionEvent arg0) {
                   // TODO Auto-generated method stub
    class Account {
        double balance = 0;
        double interest = 0.05;
        public Account() {
             balance = 0;
             interest = 0.05;
        public Account(int deposit) {
             balance = deposit;
             interest = 0.05;
        public double calcInterest(int year) {
               return  balance * Math.pow((1 + interest), year) - balance;
        public double getBalance() {
              return balance;
    class GraphPanel extends JPanel {
        public GraphPanel() {
        public void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setColor(Color.red);
    }Your help would be much appreciated.
    Thanks in advance.

    watertownjordan wrote:
    http://www.jgraph.com/jgraph.html
    The above is also good.Sorry but you need to look a bit more closely at URLs that you cite. What the OP wants is a chart (as in X against Y) not a graph (as in links and nodes) . 'jgraph' deals with links and nodes.
    The best free charting library that I know of is JFreeChart from www.jfree.org.

  • My hard disk crashed and I cannot find out how to "contact customer service" other than this forum.  The website seems to just take me in a circle. I need to de-activate a license but cannot access the software due to a crashed hard drive.  Please help.

    My hard disk crashed and I cannot find out how to "contact customer service" other than this forum.  The website seems to just take me in a circle. I need to de-activate a license but cannot access the software due to a crashed hard drive.  Please help.

    Hi Anthony ,
    Here is the link to connect with Adobe Chat Support.
    https://helpx.adobe.com/adobe-connect/kb/connect-chat-support.html
    Hope your query gets resolved .
    Regards
    Sukrit Dhingra

  • HT1338 I need help with numbers. I try to open numbers and I get a message stating that I need an update. When I go to update apple say I am up to date, but I still can't open numbers. I keep going around and circles. Help

    I cannot open numbers. When I click to open the message says that, I need to update. When I go to updates is says I am updated. I keep going around and circles. Can anyone help?

    Look in your Applications folder for the new version.
    Remove the old icon from the Dock and drag down the new one for ease of use.

  • Curves Circle Symbol Disappeared in Photoshop - Replaced With Curves Icon. Need help

    Today I watched a YouTube video on how to get rid of under eye darkness in Photoshop (I use CC). It worked beautifully! So easy. I opened another photo to do the same thing, left my computer for a couple hours, came back, and the Curves symbol disappeared-the half colored in, half not circle.  I needed to click it in order to achieve my earlier results. It was replaced with a Curves icon as shown under the Adjustments. I was desperate for an answer to this mystery - I can't find the right help anywhere. Ugh. Got anything?

    did it install ok?
    what os?

  • Hi i would like help with:  When I draw circle and add stroke I can not see stroke  I use Photoshop CS 5

    Hi i would like help with:
    When I draw circle and add stroke I can not see stroke
    I use Photoshop CS 5

    Make sure the stroke is set to a color and not to the symbol that appears here for Fill

  • Need help in drawing inside the Oval and outside it

    I need help in something
    I have an array and I want the numbers to be around the oval and I have part of the array and I want to fill part of the oval
    and when I want to put a number I would like a line from the center to point at the number
    I know its hard to explain so I have picture maybe you will know hwo its work
    http://img265.imageshack.us/i/55788522.jpg/
    I have almost everything done the oval and all the code but I have no clue how to do what I explained

    import static java.lang.Math.*;
    import java.awt.*;
    import javax.swing.*;
    @SuppressWarnings("serial") public class Trefoil extends JComponent {
            setPreferredSize(new Dimension(400, 400));
        @Override protected void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D) g.create();
            int w = getWidth(), h = getHeight();
            g2.setColor(getBackground());
            g2.fillRect(0, 0, w, h);
            g2.setColor(getForeground());
            g2.translate(w/2, h/2);
            g2.setRenderingHint(
                RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
            int rays = 100;
            for(int i=0; i<rays; ++i) {
                double angle = i*(2 * PI)/rays;
                double flange = cos(1.5* angle - PI/4);
                int r = (int)(190 * flange * flange);
                int x = (int)(r* cos(angle));
                int y = (int)(r* sin(angle));
                g2.drawLine(0, 0, x, y);
            g2.dispose();
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    JFrame f = new JFrame("Trefoil");
                    f.add(new Trefoil());
                    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    f.pack();
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }

  • Need help making ball move and bounce off of sides of JPanel

    I'm currently working on a program that creates a ball of random color. I'm trying to make the ball move around the JPanel it is contained in and if it hits a wall it should bounce off of it. I have been able to draw the ball and make it fill with a random color. However, I cannot get it to move around and bounce off the walls. Below is the code for the class that creates the ball. Should I possible be using multithreads? As part of the project requirements I will need to utilizes threads and include a runnable. However, I wanted to get it working with one first and than add to it as the final product needs to include new balls being added with each mouse click. Any help would be appreciated.
    Thanks
    import java.awt.Color;
    import java.awt.Graphics;
    import javax.swing.JPanel;
    public class Ball extends JPanel{
        Graphics g;
        int rval; // red color value
        int gval; // green color value
        int bval; // blue color value
        private int x = 1;
        private int y = 1;
        private int dx = 2;
        private int dy = 2;
        public void paintComponent(Graphics g){
            for(int counter = 0; counter < 100; counter++){
                // randomly chooses red, green and blue values changing color of ball each time
                rval = (int)Math.floor(Math.random() * 256);
                gval = (int)Math.floor(Math.random() * 256);
                bval = (int)Math.floor(Math.random() * 256);
                super.paintComponent(g);
                g.drawOval(0,0,30,30);   // draws circle
                g.setColor(new Color(rval,gval,bval)); // takes random numbers from above and creates RGB color value to be displayed
                g.fillOval(x,y,30,30); // adds color to circle
                move(g);
        } // end paintComponent
        public void move(Graphics g){
            g.fillOval(x, y, 30, 30);
            x += dx;
            y += dy;
            if(x < 0){
                x = 0;
                dx = -dx;
            if (x + 30 >= 400) {
                x = 400 - 30;
                dx = -dx;
            if (y < 0) {
                y = 0;
                dy = -dy;
            if (y + 30 >= 400) {
                y = 400 - 30;
                dy = -dy;
            g.fillOval(x, y, 30, 30);
            g.dispose();
    } // end Ball class

    Create a bounding box using the size of the panel. Each time you move the ball, check that it's still inside the box. If it isn't, then change it's direction. You know where the ball is, (x, y), so just compare those values to the boundary values.

  • Draw circles in swing..

    hello.
    I'm making a program that draws circles in a frame and has some buttons in another program.
    However, there are some stack overflow errors..
    help please~
    [error messages]
    Exception in thread "main" java.lang.StackOverflowError
    at java.util.Hashtable.get(Hashtable.java:336)
    at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:142)
    at javax.swing.UIDefaults.get(UIDefaults.java:130)
    at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:44)
    at javax.swing.UIDefaults.getColor(UIDefaults.java:380)
    at javax.swing.UIManager.getColor(UIManager.java:590)
    at javax.swing.LookAndFeel.installColors(LookAndFeel.java:58)
    at javax.swing.LookAndFeel.installColorsAndFont(LookAndFeel.java:92)
    at javax.swing.plaf.basic.BasicPanelUI.installDefaults(BasicPanelUI.java:49)
    at javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:39)
    at javax.swing.JComponent.setUI(JComponent.java:652)
    at javax.swing.JPanel.setUI(JPanel.java:131)
    at javax.swing.JPanel.updateUI(JPanel.java:104)
    at javax.swing.JPanel.<init>(JPanel.java:64)
    at javax.swing.JPanel.<init>(JPanel.java:87)
    at javax.swing.JPanel.<init>(JPanel.java:95)
    at DrawCircle.<init>(DrawCircle.java:7)
    at DrawCircle.<init>(DrawCircle.java:6)
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.*;
    public class GUI{
         DrawCircle circle = new DrawCircle(100,100,50);
         private JButton UpButton, DownButton, LeftButton, RightButton, IncreaseButton, DecreaseButton, InputButton;
         public void drawframe(){
                    final JFrame CircleFrame = new JFrame("Frame for Circle");
                    CircleFrame.getContentPane().add(circle);
                    CircleFrame.setSize(200,200);
              CircleFrame.setVisible(true);
              UpButton = new JButton("UP");
              UpButton.addActionListener(new ActionListener()     {
                   public void actionPerformed(ActionEvent e){
                                circle.up();
                                    if(circle.getY() - circle.getR() <= 0) {
                                        JOptionPane.showMessageDialog( CircleFrame, "Out of window");
                                        circle.setY(circle.getY() +10);
              RightButton = new JButton("RIGHT");
              RightButton.addActionListener(new ActionListener()     {
                   public void actionPerformed(ActionEvent e)     {
                                circle.right();
                                    if(circle.getX() + circle.getR() >= 500) {
                                        JOptionPane.showMessageDialog( CircleFrame, "Out of window");
                                        circle.setX(circle.getX() -10);
              LeftButton = new JButton("LEFT");
              LeftButton.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e){
                                circle.left();
                                    if(circle.getX() - circle.getR() <= 0) {
                                        JOptionPane.showMessageDialog( CircleFrame, "Out of window");
                                        circle.setX(circle.getX() +10);
              DownButton = new JButton("DOWN");
              DownButton.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e){
                                circle.down();
                                    System.out.println(circle.getY());
                                    if(circle.getY() + circle.getR() >= 500) {
                                        JOptionPane.showMessageDialog( CircleFrame, "Out of window");
                                        circle.setY(circle.getY() -10);
              IncreaseButton = new JButton("INCREASE");
              IncreaseButton.addActionListener(new ActionListener()     {
                   public void actionPerformed(ActionEvent e)     {
                                circle.increase();
                                    if(circle.getY() + circle.getR() >= 500) {
                                        JOptionPane.showMessageDialog( CircleFrame, "Out of window");
                                        circle.setR(circle.getR() -10);     
                                    } else if(circle.getX() + circle.getR() >= 500) {
                                        JOptionPane.showMessageDialog( CircleFrame, "Out of window");
              DecreaseButton = new JButton("decrease");
                        DecreaseButton.addActionListener(new ActionListener(){
                                public void actionPerformed(ActionEvent e)     {           
                                    circle.decrease();
              JPanel ButtonPanel = new JPanel();
              ButtonPanel.add(IncreaseButton);
              ButtonPanel.add(DecreaseButton);
              ButtonPanel.add(DownButton);
              ButtonPanel.add(LeftButton);
              ButtonPanel.add(RightButton);
              ButtonPanel.add(UpButton);
              ButtonPanel.setLayout(new BoxLayout(ButtonPanel, BoxLayout.Y_AXIS));
                    JFrame mainFrame = new JFrame("GUI for Circle Drawing");
              mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
                    mainFrame.add(ButtonPanel);
                    mainFrame.pack();
              mainFrame.setVisible(true);
         public static void main(String [] args)     {
              GUI intf = new GUI();
              intf.drawframe();
    }and the DrawCircle Class is
    import java.awt.*;
    import javax.swing.*;
    public class DrawCircle extends JPanel{
         private int x, y, r;
            DrawCircle circle = new DrawCircle(100, 100, 50);
         public DrawCircle( int x , int y , int r){
              this.x = x;
              this.y = y;
              this.r = r;
         public int getR(){
              return r;
         public int getX(){
              return x;
         public int getY(){
              return y;
         public void setX(int x)     {
              this.x = x;
                    repaint();
         public void setY(int y)     {
              this.y = y;
                    repaint();
         public void setR(int r)     {
              this.r = r;
                    repaint();
         public void paint(Graphics g){
              g.clearRect(0,0,400,400);
                    g.drawOval(x-r, y-r, r*2, r*2);
            public void up() {
              circle.setY(circle.getY() -10);
            public void down() {
                    circle.setY(circle.getY() +10);
            public void right() {
                    circle.setX(circle.getX() +10);
            public void left() {
                    circle.setX(circle.getX() -10);
            public void increase() {
                    circle.setR(circle.getR() +10);     
            public void decrease() {
                    circle.setR(circle.getR() -10);     
              

    The problem is that you're constructing a new DrawCircle each time you construct a new DrawCircle, resulting in infinite recursion causing a stack overflow.
    This line:DrawCircle circle = new DrawCircle(100, 100, 50);in your DrawCircle class is causing the problem, do you need it? Remove it and replace references to 'circle' in the class with 'this'.

  • Draw Circles

    Hi Guys,
    I need to display one field within circle(means i need to display one filed that field always has the value 'Y' or 'N')in sapscript and in report output also means both normal and alv reports.How can i do this? Is it possible in sap to draw circles? Is there any function module to achieve this? please help me.

    Hi Sai,
    For SAP Scripts you can try :
    SE71--> form name > change> window--> text element > Insert(Mnubar)> charcters--> SAP sybbols --> search for SYM_CIRCLE.
    Hope this may help you.
    Lanka

  • Draw circle by stepper motor

    hello!I have two linear slide,x and y;I am now able to slide straight line uniform motion , but My goal is to draw a circle ,So I need to have an x-axis is the sine or cosine speed changes , but I do not know what kind of impulse needs  to  control sinusoidal motion , some problem like time interval, pulse number , etc.Please give me some advice or help,thanks!

    If you can generate the series of XY locations to trace the circle, you are half done. In terms of getting the XY table to draw the circle, it depends on the controller you are using. Many provide the ability to enter X and Y values directly.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Need help to create report with jpeg/gif image

    Hello,
    I need help with creating a form with a special jpeg/gif seal. I never done this Java. Until now, I created all forms with ansi C++ with HP escape characters to draw lines, boxs, and text. This form will contain boxes which is populated with database information read from a text file.
    Since this form contains a special seal on the upper right, I don't think it can be done with old fashion ansi C++. How can I create a form with Java and create it as a simple exe to just print the form to a specified printer.
    Thanks,
    John

    Hi,
    I am creating a form with boxes (lines and text). What is special about this form is that it has an image jpeg or gif at the top right corner. Is is a state department seal. Up to this form, I had used ansi C++ and print out escape HP character to print out the lines, boxes, and text. I have no idea how to print out the image. I am new to JAVA and only 1 class in it. Is there sample code out there to create this type of form with the image? I need a starting point.
    Thanks,
    John

  • Java using GUI's mixed with opengl... needs help...urgent....

    guys, i need help.... is anyone there have an idea about opengl...? ill attach 4 files that needs to be enhanced or debug for possible errors. to see the canvas... you should have atleast all the needed lib and jar of opengl in your pc.
    its urgent, its for our thesis actually....ill be dividing the codes with the use of (" **** ")sign...
    * Main.java
    * Created on 29 January 2007, 08:12
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package longgong;
    * @author welcome
    public class Main {
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            // TODO code application logic here
            frmMain f = new frmMain();
    * frmMain.java
    * Created on November 10, 2006, 10:52 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package longgong; // create a floder named longgong and add the class inside
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    * @author all user
    public class frmMain extends JFrame implements ActionListener, ChangeListener, ItemListener{
        JPanel pnlWest, pnlEast, pnlCenter, pnlSouth, pnlTitle, pnlSlider, pnlPlayers;
        JSlider slrSpeed;
        JList lstResults;
        String varResults [] = new String[31];
        JLabel lblPlayers, lblTitle;
        JCheckBox lblPlayer1, lblPlayer2, lblPlayer3, lblPlayer4, lblPlayer5, lblPlayer6;
        ImageIcon imgDice1;
        MyCanvas canvas;
        JButton btnStart, btnStop;
        JMenuBar menuBar;
        JMenu menuFile, menuView, menuHelp;
        JMenuItem menuNew, menuExit, menuIn, menuOut, menuHigh, menuPlay, menuAbout;
        boolean isNew = false;
        /** Creates a new instance of frmMain */
        public frmMain() {
            setLayout(new BorderLayout());
            setTitle("Longgong");
            setSize(780,600);
            canvas = new MyCanvas(getSize().width, getSize().height);
            imgDice1 = new ImageIcon("c:\\java\\images\\one.png");
            menuBar = new JMenuBar();
            menuFile = new JMenu("File");
            menuView = new JMenu("View");
            menuHelp = new JMenu("Help");
            menuNew = new JMenuItem ("New Game");
            menuNew.addActionListener(this);
            menuExit = new JMenuItem ("Exit");
            menuExit.addActionListener(this);
            menuIn = new JMenuItem ("Zoom In");
            menuIn.addActionListener(this);
            menuOut = new JMenuItem ("Zoom Out");
            menuOut.addActionListener(this);
            menuHigh = new JMenuItem ("High Score");
            menuPlay = new JMenuItem ("How To Play");
            menuPlay.addActionListener(this);
            menuAbout = new JMenuItem ("About");
            menuAbout.addActionListener(this);
            menuFile.add(menuNew);
            menuFile.add(menuExit);
            menuView.add(menuIn);
            menuView.add(menuOut);
            menuView.add(menuHigh);
            menuHelp.add(menuPlay);
            menuHelp.add(menuAbout);
            menuBar.add(menuFile);
            menuBar.add(menuView);
            menuBar.add(menuHelp);
            setJMenuBar(menuBar);
            varResults[0] = "Dice Results";
            varResults[1] = "1. 3-4-2";
            varResults[2] = "2. 3-1-4";
            varResults[3] = "3. 3-6-5";
            slrSpeed = new JSlider(0, 100, 0);
            slrSpeed.setPaintTicks(true);
            slrSpeed.setMinorTickSpacing(1);
            slrSpeed.setPaintLabels(true);
            slrSpeed.setSnapToTicks(true);
            slrSpeed.addChangeListener(this);
            slrSpeed.setEnabled(false);
            btnStart =  new JButton("Start");
            btnStart.addActionListener(this);
            btnStop =  new JButton("Stop");
            btnStop.addActionListener(this);
            pnlWest = new JPanel();
            pnlEast = new JPanel();
            pnlCenter = new JPanel();
            pnlSouth = new JPanel();
            pnlTitle = new JPanel();
            pnlSlider = new JPanel();       
            pnlPlayers = new JPanel();
            pnlWest.setLayout(new BorderLayout());
            pnlEast.setLayout(new BorderLayout());
            pnlEast.setPreferredSize(new Dimension(100,400));
            pnlCenter.setLayout(new BorderLayout());
            pnlSouth.setLayout(new FlowLayout());
            pnlTitle.setLayout(new FlowLayout());
            pnlSlider.setLayout(new FlowLayout());       
            pnlPlayers.setLayout(new BoxLayout(pnlPlayers,BoxLayout.Y_AXIS));
            pnlPlayers.setPreferredSize(new Dimension(150,400));
            lblPlayers = new JLabel("  Players: Choice (s)");
            lblPlayer1 = new JCheckBox("None");
            lblPlayer1.addItemListener(this);
            lblPlayer2 = new JCheckBox("None");
            lblPlayer2.addItemListener(this);
            lblPlayer3 = new JCheckBox("None");
            lblPlayer3.addItemListener(this);
            lblPlayer4 = new JCheckBox("None");
            lblPlayer4.addItemListener(this);
            lblPlayer5 = new JCheckBox("None");
            lblPlayer5.addItemListener(this);
            lblPlayer6 = new JCheckBox("None");
            lblPlayer6.addItemListener(this);
            lstResults = new JList(varResults);
            pnlPlayers.add(lblPlayers);
            pnlPlayers.add(lblPlayer1);
            pnlPlayers.add(lblPlayer2);
            pnlPlayers.add(lblPlayer3);
            pnlPlayers.add(lblPlayer4);
            pnlPlayers.add(lblPlayer5);
            pnlPlayers.add(lblPlayer6);
            pnlSlider.add(slrSpeed);
            pnlSlider.add(btnStart);
            pnlSlider.add(btnStop);
            pnlEast.add(BorderLayout.CENTER, lstResults);
            pnlCenter.add(BorderLayout.SOUTH, pnlSlider);    
            pnlCenter.add(BorderLayout.CENTER, canvas);    
            lblTitle = new JLabel("LONGGONG DICE GAME SIMULATION");
            pnlTitle.add(lblTitle);
            getContentPane().add(BorderLayout.NORTH,pnlTitle);   
            getContentPane().add(BorderLayout.WEST,pnlPlayers);
            getContentPane().add(BorderLayout.EAST,pnlEast);
            getContentPane().add(BorderLayout.CENTER, pnlCenter);
            getContentPane().add(BorderLayout.SOUTH,pnlSouth);
            setResizable(false);
            canvas.start();
            show();       
        //name change when player is selected
        public void itemStateChanged(ItemEvent e) {
        Object source = e.getItemSelectable();
        int choice;
        if (source == lblPlayer1) {
            if (lblPlayer1.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer1);
        if (source == lblPlayer2) {
            if (lblPlayer2.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer2);
        if (source == lblPlayer3) {
            if (lblPlayer3.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer3);
        if (source == lblPlayer4) {
            if (lblPlayer4.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer4);
        if (source == lblPlayer5) {
            if (lblPlayer5.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer5);
        if (source == lblPlayer6) {
            if (lblPlayer6.isSelected()) {
                frmChoices fchoices = new frmChoices(lblPlayer6);
           // if (e.getStateChange() == ItemEvent.DESELECTED)
            //...make a note of it...
        //slider speed change
        public void stateChanged(ChangeEvent e){      
               canvas.speed(slrSpeed.getValue());
        public void actionPerformed (ActionEvent e){
            if (e.getActionCommand().equals ("Exit")){
                System.exit (0);     
            //connects to frmNew
            if (e.getActionCommand().equals ("New Game")){
                frmNew n = new frmNew(this);   
                lblPlayer1.setText("None");
                lblPlayer2.setText("None");
                lblPlayer3.setText("None");
                lblPlayer4.setText("None");
                lblPlayer5.setText("None");
                lblPlayer6.setText("None");
                isNew = true;
                lblPlayer1.setSelected(false);
                lblPlayer2.setSelected(false);
                lblPlayer3.setSelected(false);
                lblPlayer4.setSelected(false);
                lblPlayer5.setSelected(false);
                lblPlayer6.setSelected(false);
            if (e.getActionCommand().equals ("Start")){
               slrSpeed.setEnabled(true);
               canvas.setRandomDicePosition();
            if (e.getActionCommand().equals ("Stop")){
                slrSpeed.setValue(0);
                slrSpeed.setEnabled(false);
            //ADDED
             if (e.getActionCommand().equals ("New Game")){
               frmNew n = new frmNew(this);           
            if (e.getActionCommand().equals ("Zoom In")){
                canvas.zoomIn();          
            if (e.getActionCommand().equals ("Zoom Out")){
                canvas.zoomOut();          
            if (e.getActionCommand().equals ("How To Play")){
                frmPlay p = new frmPlay();           
            if (e.getActionCommand().equals ("About")){
                frmAbout a = new frmAbout();           
    package longgong;
    // Java  classes
       import java.awt.*;
       import java.awt.event.*;
       import java.net.URL;
    // GL4Java classes
       import gl4java.GLContext;
       import gl4java.awt.GLAnimCanvas;
       import gl4java.utils.textures.*;
       class MyCanvas extends GLAnimCanvas implements KeyListener, MouseListener
         // holds information on which keys are held down.
          boolean[] keys=new boolean[256];
          float     xrot;                    // X Rotation ( NEW )
          float     yrot;                    // Y Rotation ( NEW )
          float     zrot;                    // Z Rotation ( NEW )
          float[] diceRotX = new float[3];
          float[] diceRotY = new float[3];
          float[] diceRotZ = new float[3];
          float[] diceTranX = new float[3];
          float[] diceTranY = new float[3];
          float[] diceTranZ = new float[3];     
          float speedValue;
          Dice[] D;
          float zoom = -15.0f;
          public MyCanvas(int w, int h)
             super(w, h);
             //Registers this canvas to process keyboard events, and Mouse events
             addKeyListener(this);
             addMouseListener(this);  
             setAnimateFps(60); // seemed to be essential in getting any performance
             speedValue=0.0f;
             diceTranX[0] = -2.0f;
             diceTranY[0] = 2.0f;
             diceTranZ[0] = zoom;
             diceTranX[1] = 2.0f;
             diceTranY[1] = 1.0f;
             diceTranZ[1] = zoom;
             diceTranX[2] = 0.0f;
             diceTranY[2] = -2.0f;
             diceTranZ[2] = zoom;
          public void zoomIn(){
              zoom=zoom+1.0f;
           public void zoomOut(){
              zoom=zoom-1.0f;
          public void speed(float s){
            speedValue=s/100;
        /** void reshape(int width, int height) Called after the first paint command.  */  
          public void reshape(int width, int height)
             if(height==0)height=1;
             gl.glViewport(0, 0, width, height);                       // Reset The Current Viewport And Perspective Transformation
             gl.glMatrixMode(GL_PROJECTION);                           // Select The Projection Matrix
             gl.glLoadIdentity();                                      // Reset The Projection Matrix
             glu.gluPerspective(45.0f, width / height, 0.1f, 100.0f);  // Calculate The Aspect Ratio Of The Window
             gl.glMatrixMode(GL_MODELVIEW);                            // Select The Modelview Matrix
             gl.glLoadIdentity();                                      // Reset The ModalView Matrix     
       /** void preInit() Called just BEFORE the GL-Context is created. */  
          public void preInit()
          { doubleBuffer = true; stereoView = false; // buffering but not stereoview
          public void setRandomDicePosition(){
             for (int i=0; i<3; i++){
               D.setCoordinates(diceRotX[i],diceRotY[i],diceRotZ[i],diceTranX[i],diceTranY[i],diceTranZ[i]);
    D[i].getRandomDice();
    /** void init() Called just AFTER the GL-Context is created. */
    public void init()
    //float width = (float)getSize().width;
    //float height = (float)getSize().height;
    D = new Dice[5];
    D[0] = new Dice(this);
    D[1] = new Dice(this);
    D[2] = new Dice(this);
    //initialize dice location
    for (int i=0; i<3; i++){
    D[i].setCoordinates(diceRotX[i],diceRotY[i],diceRotZ[i],diceTranX[i],diceTranY[i],diceTranZ[i]);
    D[i].getRandomDice();
    gl.glEnable(GL_TEXTURE_2D);                              //Enable Texture Mapping ( NEW )
    gl.glShadeModel(GL_SMOOTH); //Enables Smooth Color Shading
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //This Will Clear The Background Color To Black
    gl.glClearDepth(1.0); //Enables Clearing Of The Depth Buffer
    gl.glEnable(GL_DEPTH_TEST); //Enables Depth Testing
    gl.glDepthFunc(GL_LEQUAL); //The Type Of Depth Test To Do
    gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); //Really Nice Perspective Calculations
    public void DrawBoundaries(){
    double x,y;
    double radius = 5.0f;
    gl.glLoadIdentity();                                             // Reset The View
    gl.glTranslatef(0.0f,0.0f,zoom-1.0f);
    gl.glRotatef(90.0f,0.0f,0.0f,1.0f);
    gl.glColor3f(0.6f,0.3f,0.3f);
    gl.glBegin(gl.GL_POLYGON);
    // angle is
    // x = radius * (cosine of angle)
    // y = radius * (sine of angle)
    for (double a=0; a<360; a++) {
    x = radius * (Math.cos(a));
    y = radius * (Math.sin(a));
    gl.glVertex3d(x, y, 0.0f);
    gl.glEnd();
    gl.glColor3f(1.0f,1.0f,1.0f);
    public void DrawGLScene()
    gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);     // Clear The Screen And The Depth Buffer
    DrawBoundaries();
    for (int i=0; i<3; i++){
    D[i].startDiceMovement();
    D[i].setTz(zoom);
    D[i].setSpeed(speedValue);
    D[i].drawDice();
    for (int i=0; i<3; i++){
    //start of loop
    if(i!=0){    
    if (D[0].getMoveLeft()==true){        
    if ( (D[0].getTx()>=D[i].getTx()-1.0f) && (D[0].getTx()<=D[i].getTx()) ){
    if (D[0].getMoveLeft()== true) D[0].setMoveLeft(false);
    else D[0].setMoveLeft(true);
    }else{
    if ( (D[0].getTx()-1<=D[i].getTx()) && (D[0].getTx()-1>=D[i].getTx()-1) ){
    if (D[0].getMoveLeft()== true) D[0].setMoveLeft(false);
    else D[0].setMoveLeft(true);
    if (D[0].getMoveUp()==true){        
    if ( (D[0].getTy()>=D[i].getTy()-1.0f) && (D[0].getTy()<=D[i].getTy()) ){
    if (D[0].getMoveUp()== true) D[0].setMoveUp(false);
    else D[0].setMoveUp(true);
    }else{
    if ( (D[0].getTy()-1<=D[i].getTy()) && (D[0].getTy()-1>=D[i].getTy()-1) ){
    if (D[0].getMoveUp()== true) D[0].setMoveUp(false);
    else D[0].setMoveUp(true);
    }//end of if i!=0
    if(i!=1){    
    if (D[1].getMoveLeft()==true){        
    if ( (D[1].getTx()>=D[i].getTx()-1.0f) && (D[1].getTx()<=D[i].getTx()) ){
    if (D[1].getMoveLeft()== true) D[1].setMoveLeft(false);
    else D[1].setMoveLeft(true);
    }else{
    if ( (D[1].getTx()-1<=D[i].getTx()) && (D[1].getTx()-1>=D[i].getTx()-1) ){
    if (D[1].getMoveLeft()== true) D[1].setMoveLeft(false);
    else D[1].setMoveLeft(true);
    if (D[1].getMoveUp()==true){        
    if ( (D[1].getTy()>=D[i].getTy()-1.0f) && (D[1].getTy()<=D[i].getTy()) ){
    if (D[1].getMoveUp()== true) D[1].setMoveUp(false);
    else D[1].setMoveUp(true);
    }else{
    if ( (D[1].getTy()-1<=D[i].getTy()) && (D[1].getTy()-1>=D[i].getTy()-1) ){
    if (D[1].getMoveUp()== true) D[1].setMoveUp(false);
    else D[1].setMoveUp(true);
    }//end of if i!=1
    if(i!=2){    
    if (D[2].getMoveLeft()==true){        
    if ( (D[2].getTx()>=D[i].getTx()-1.0f) && (D[2].getTx()<=D[i].getTx()) ){
    if (D[2].getMoveLeft()== true) D[2].setMoveLeft(false);
    else D[2].setMoveLeft(true);
    }else{
    if ( (D[2].getTx()-1<=D[i].getTx()) && (D[2].getTx()-1>=D[i].getTx()-1) ){
    if (D[2].getMoveLeft()== true) D[2].setMoveLeft(false);
    else D[2].setMoveLeft(true);
    if (D[2].getMoveUp()==true){        
    if ( (D[2].getTy()>=D[i].getTy()-1.0f) && (D[2].getTy()<=D[i].getTy()) ){
    if (D[2].getMoveUp()== true) D[2].setMoveUp(false);
    else D[2].setMoveUp(true);
    }else{
    if ( (D[2].getTy()-1<=D[i].getTy()) && (D[2].getTy()-1>=D[i].getTy()-1) ){
    if (D[2].getMoveUp()== true) D[2].setMoveUp(false);
    else D[2].setMoveUp(true);
    }//end of if i!=2
    //end of loop for i
    /** void display() Draw to the canvas. */
    // Purely a Java thing. Simple calls DrawGLScene once GL is Initialized
    public void display()
    for(int i=0;i<3;i++){
    glj.gljMakeCurrent(); //Ensure GL is initialised correctly
    DrawGLScene();
    glj.gljSwap(); //Swap buffers
    glj.gljFree(); // release GL
    // Key Listener events
    public void keyTyped(KeyEvent e){
    public void keyPressed(KeyEvent e){
    switch(e.getKeyCode())
    //Kill app
    case KeyEvent.VK_ESCAPE:
    System.exit(0);
    break;
    default :
    if(e.getKeyCode()<250) // only interested in first 250 key codes, are there more?
    keys[e.getKeyCode()]=true;     
    break;
    public void keyReleased(KeyEvent e){
    if(e.getKeyCode()<250) // only interested in first 250 key codes, are there more?
    keys[e.getKeyCode()]=false;
    // mouse listener events
    public void mouseEntered( MouseEvent evt )
    Component comp = evt.getComponent();
    if( comp.equals(this ) )
    //requestFocus();
    public void mouseExited( MouseEvent evt ){
    public void mousePressed( MouseEvent evt ){
    public void mouseReleased( MouseEvent evt ){
    public void mouseClicked( MouseEvent evt )
    Component comp = evt.getComponent();
    if( comp.equals(this ) )
    requestFocus();
    * Dice.java
    * Created on 08 February 2007, 22:26
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package longgong;
    import java.net.URL;
    import gl4java.GLContext;
    import gl4java.awt.GLAnimCanvas;
    import gl4java.utils.textures.*;
    * @author welcome
    public class Dice {
          GLAnimCanvas glCanvas ;
          URL codeBase;
          int[]texture1 = new int[1]; //Storage for one texture ( NEW )    
          int[]texture2 = new int[1]; //Storage for one texture ( NEW )    
          int[]texture3 = new int[1]; //Storage for one texture ( NEW )    
          int[]texture4 = new int[1]; //Storage for one texture ( NEW )    
          int[]texture5 = new int[1]; //Storage for one texture ( NEW )    
          int[]texture6 = new int[1]; //Storage for one texture ( NEW )    
          float rx;
          float ry;
          float rz;
          float tx;
          float ty;
          float tz;
          float speed;
          boolean txMoveLeft;
          boolean tyMoveUp;
          boolean tzMoveFront;
        /** Creates a new instance of Dice */
        public Dice(GLAnimCanvas g) {
            glCanvas = g;       
            if(!LoadGLTexture("c:\\java\\images\\one.png",texture1)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            if(!LoadGLTexture("c:\\java\\images\\two.png",texture2)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            if(!LoadGLTexture("c:\\java\\images\\three.png",texture3)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            if(!LoadGLTexture("c:\\java\\images\\four.png",texture4)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            if(!LoadGLTexture("c:\\java\\images\\five.png",texture5)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            if(!LoadGLTexture("c:\\java\\images\\six.png",texture6)){
                System.out.println("Failed to load Textures,Bailing!");
                System.exit(0);
            txMoveLeft = true;
            tyMoveUp = true;
         public boolean inCircleBoundaries(float x, float y, float radius)
            float r;       
            r = (float)Math.sqrt((x*x) + (y*y));
            if (r <= radius)
                return  true;
            else
                return false;
        public void setCoordinates(float corRx,float corRy,float corRz,float corTx,float corTy,float corTz){
            rx = corRx;
            ry = corRy;
            rz = corRz;
            tx = corTx;
            ty = corTy;
            tz = corTz;
        public void getRandomDice(){
            int num = (int)(Math.random() * 6);
            if (num==1){
                rx=0.0f;
                ry=0.0f;
                rz=0.0f;
            else if (num==2){
                rx=90.0f;
                ry=0.0f;
                rz=0.0f;
            else if (num==3){
                rx=0.0f;
                ry=-90.0f;
                rz=0.0f;
            else if (num==4){
                rx=0.0f;
                ry=90.0f;
                rz=0.0f;
            else if (num==5){
                rx=-90.0f;
                ry=0.0f;
                rz=0.0f;
            else{
                rx=180.0f;
                ry=0.0f;
                rz=0.0f;
        public float getTx(){
            return tx+0.5f;
        public float getTy(){
            return ty+0.5f;
        public float getTz(){
            return tz+0.5f;
        public void setTz(float z){
            tz=z;
        public boolean getMoveLeft(){
            return txMoveLeft;
        public boolean getMoveUp(){
            return tyMoveUp;
        public void setMoveLeft(boolean m){
            txMoveLeft = m;
        public void setMoveUp(boolean m){
            tyMoveUp = m;
        public void startDiceMovement(){    
            if (txMoveLeft==true) {
                tx+=speed;           
            else {
                tx-=speed;
            if (tyMoveUp==true) {
                ty+=speed;
            else {
                ty-=speed;
            ry+=(speed*4);
            rx+=(speed*4);
            //rz+=(speed*2);
            //tx+=speed;
            //ty+=speed;
            //tz+=speed;             
         if (inCircleBoundaries(tx,ty,3.5f)==false) {  
            if (tx>=3.0f) txMoveLeft = false;
            if (tx<=-3.0f) txMoveLeft = true;
            if (ty>=3.0f) tyMoveUp = false;
            if (ty<=-3.0f) tyMoveUp = true;
        public void setSpeed(float s){
            speed = s;
         public void drawDice(){        
             glCanvas.gl.glLoadIdentity();                                             // Reset The View
             glCanvas.gl.glTranslatef(tx,ty,tz);
             glCanvas.gl.glRotatef(rx,1.0f,0.0f,0.0f);
             glCanvas.gl.glRotatef(ry,0.0f,1.0f,0.0f);
             glCanvas.gl.glRotatef(rz,0.0f,0.0f,1.0f);
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture1[0]);        
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
                // Front Face
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f,  1.0f);
             glCanvas.gl.glEnd();
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture6[0]);
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
               // Back Face          
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, -1.0f);
             glCanvas.gl.glEnd();
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture2[0]);
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
                // Top Face
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f, -1.0f);
             glCanvas.gl.glEnd();
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture5[0]);
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
                // Bottom Face
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f,  1.0f);
             glCanvas.gl.glEnd();
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture3[0]);
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
                // Right face
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f( 1.0f,  1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f( 1.0f, -1.0f,  1.0f);
             glCanvas.gl.glEnd();
             glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, texture4[0]);
             glCanvas.gl.glBegin(glCanvas.gl.GL_QUADS);        
                // Left Face
             glCanvas.gl.glTexCoord2f(0.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f, -1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 0.0f); glCanvas.gl.glVertex3f(-1.0f, -1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(1.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f,  1.0f);
             glCanvas.gl.glTexCoord2f(0.0f, 1.0f); glCanvas.gl.glVertex3f(-1.0f,  1.0f, -1.0f);
             glCanvas.gl.glEnd();
          public boolean LoadGLTexture(String fileName, int textureNumber[])
             PngTextureLoader texLoader = new PngTextureLoader(glCanvas.gl, glCanvas.glu);
             if(codeBase!=null)  
                texLoader.readTexture(codeBase, fileName);
             else
                texLoader.readTexture(fileName);
             if(texLoader.isOk())
                //Create Texture
                glCanvas.gl.glGenTextures(1, textureNumber);
                glCanvas.gl.glBindTexture(glCanvas.gl.GL_TEXTURE_2D, textureNumber[0]);
                glCanvas.gl.glTexParameteri(glCanvas.gl.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    ill attach 4 files that needs to be
    enhanced or debug for possible errors. i hate to break it to you, but even if you post this for the seventh time, finding and fixing errors in your code remains your task.

Maybe you are looking for

  • I receipt 2 days about 18 bills

    I receipt 2 days about 18 bills in 10 minutes, by 18/07: 10 bills and 19/07= : 8 bills, I didn't play that games on my Iphone, can I get my money back ,= please help me. Thank a lot Look that one please Where's My Perry?, v1.0.3 (4+) Write a Review R

  • OC4J 9.0.3: JAAS Compliant LoginModule support !

    Hi, I have a requirement where I need to migrate my JAAS Compliant LoginModule(implements LoginModule interface) from Weblogic to OC4J. I want to use my Custom LoginModule to perform authentication at the Web Tier and Ejb Tier and let the containers

  • Getting delivered Quantity using ABAP Program

    Dear All, How can I get the delivered quantity against a sales order document (Orders in VA03).? Which tables are involved.? How can I  join the tables.? Regards, Aneel

  • Table layouts change in browsers.

    Hi All DW8 users, I have this problem which I can't locate an answer for although I am sure there is one in the data base already. I created a template for a site and while testing the layout I noticed that all the different browser display the conte

  • About to purchase

    Hi folks, mgt is about to purchase a new adobe cs 5.5 editing system, and I was told he was going to get the Nvidia Geforce GTX 580 video card, what do you think? Is this the right card for video post production editing? Thanks.