Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 Got it. Thank you so much! Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by vortex_1 In my opinion, implementing a feature in a bouncing balls simulation where a new ball is created when two balls collide can add an interesting and dynamic element to the simulation. This feature can introduce a sense of complexity and unpredictability, making the simulation more engaging and challenging for users. It could also provide an … Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 Great reply, vortex! Agree with all your points. Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by Digital_39 Hi, Its helpful for me. I got my answer. Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 … array list), and then called the move and the fill oval methods, the program froze. Can you tell me why? What… Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa Some minor syntax fixes. Some things to consider are the collision and distance of drawing the next ball. A ball inside a ball's radius will cause numerous collisions. Even the starting ball locations can be already causing collisions. I added a collision counter display. Increased the maximum balls to make to 50. The timer delay can also impact … Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 Thank you so much for your reply and additions! It is certainly working as I wanted. I will read through the code you have added and ask you any questions I might have. I hope you don't mind. Regards Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by Dani I’ll mark this question solved :) Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by Dani … oh, sorry, missed the bit about you still needing clarifications. Feel feee to ask :) I’ll now unmark this topic as solved. /facepalm Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa I cleaned up the code some more. Removed some things that were not being used. I ran into a couple problems which caused the freeze you mentioned. It was memory heap space and array allocating. E.g., if x or y becomes negative, and also infinite recursion. I added a x/y coordinate display for a ball, and tinkered with the placement of the … Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 Hello, Thank you again so much! All your additions are clear, but it seems like whenever two balls collide, more than one ball is added to the arraylist and painted. Any way to have just one ball added to the panel for every collision? Have some kind of a toggle flag in paintcomponent? Regards Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa Yes, this is true. Overlapping ball spawns can do that causing a chain reaction. Something like that could be done. How you handle the spawning of the new ball is what I played with a bit before. You will see better collision detection changing to: g.fillOval(ball.getX(), ball.getY(), 1 * ball.getRadius(), 1 * ball.getRadius()); Oval shape does not display Programming Software Development by skiabox …*/ public class Oval extends javax.swing.JFrame { /** * Creates new form Oval */ public Oval() { initComponents();… { public void run() { new Oval().setVisible(true); } }); } // … Re: drawing oval in a jpanel Programming Software Development by VernonDozier …reworked my code. it works mostly except for putting an oval at launch by default, which im not sure cant be… extends JPanel? [QUOTE=Lensva;846928] also all but the last oval disapear on resize. is there any way around that without… (g); [/code] the same behavior should occur (only the last oval is visible). I think that is the root cause of… creating shape like circle or oval(i wanted to design my own circle shape) Programming Software Development by karhong Hi, I'm trying to draw circle and oval by myself without using ".addEllipse" Can I draw it by pointer? which mean i point 4 point and then make it to become the shape of circle and oval. I tried to find solution in the net, but i dont seems to get any solution. Any Idea? creating a moving Oval Programming Software Development by Luckymeera hi everyone i would be thankful if anyone could post a simple example where you continuously create a new oval after a random period of time( e.g A new moving oval is created after every 10 -15 seconds), and is destroyed when it reaches a particular X or Y coordinate. Looking forward for a reply.. Re: drawing oval in a jpanel Programming Software Development by Lensva …my code. it works mostly except for putting an oval at launch by default, which im not sure …achieve the same functionality? also all but the last oval disapear on resize. is there any way around … void paintComponent(Graphics g) { if(mouseEvent!=null) //draws an oval at launch without this g.fillOval(mouseX, mouseY, 10, 10… creating an oval when clicking on a canvas by means of a mouse Programming Software Development by nish88 Hi!! Actually,i am doing a simulation and i want a dot (small oval) to pop up when i click(by mouse) on the canvas. can anyone please help me or if possible give me the piece of codes to perform this. thanks in advance... drawing oval in a jpanel Programming Software Development by Lensva its supposed to draw an oval on MouseClicked: [code="java"] import java.awt.event.*; … Pictuerbox as oval Programming Software Development by tqmd1 Dear Experts How to display picturebox as oval shape. Please help Java help Programming Software Development by Fiery Demon …Location ovalOffset; private Location pictureLocation; private Color color; private Oval oval; private Size size; private Location ovalOffset2; private Color color2…0, 0, 0); size = new Size(100, 200); oval = new Oval(pictureLocation, ovalOffset, size, color); ovalOffset2 = new Location(10… Re: Java help Programming Software Development by Alex Edwards …{ private Location ovalOffset; private Location pictureLocation; private Color color; private Oval oval; private Size size; private Location ovalOffset2; private Color color2; private… Color(0, 0, 0); size = new Size(100, 200); oval = new Oval(pictureLocation, ovalOffset, size, color); ovalOffset2 = new Location(10,10); color2… build but not run... need a second set of eyes Programming Software Development by Ortal …) { switch (drawType) { case 0: // Oval MyShape oval = new MyShape(); oval.x = Math.min(x, arg0.getX()); oval.y = Math.min(y, arg0.getY…x - arg0.getX()); oval.h = Math.abs(y - arg0.getY()); oval.color = color; oval.fill = fill; oval.type = drawType; shapes.add(oval); break; case 1… Re: build but not run... need a second set of eyes Programming Software Development by Ortal … (drawType) { case 0: // Oval MyShape oval = new MyShape(); oval.x = Math.min(x, arg0.getX()); oval.y = Math.min(y, arg0.getY… arg0.getX()); oval.h = Math.abs(y - arg0.getY()); oval.color = color; oval.fill = fill; oval.type = drawType; shapes.add(oval); break; case… Re: Java help Programming Software Development by Fiery Demon Thanks :):) However, I can't get the oval, oval2, neck, eye, eyes to move up and down. I'm using the code my instructor gave me and it isn't that helpufl :S Re: Java help Programming Software Development by VernonDozier …=Fiery Demon;732078]Thanks :):) However, I can't get the oval, oval2, neck, eye, eyes to move up and down. I… application to applet Programming Software Development by starsinthesky …("rect"); rect.addActionListener(this); JButton oval = new JButton("Oval"); oval.setActionCommand("oval"); oval.addActionListener(this); JP9.add(rect); JP9… GUI and inheritance Programming Software Development by asian_al ….parseInt(height.getText()); if (pshape.getSelectedIndex() == 0) { shape[q] = new Oval(x, y, w, h, scolor.getSelectedIndex(), filled.isSelected()); q++; } else… Basic Graphics Package This sub class will define a half oval */ import java.awt.*; import javax.swing.*; import java.awt.event… register_namespace multiple namespaces with same URL but diff "anchor" tag Programming Software Development by kumarswamy_10 … "http://oval.mitre.org/XMLSchema/oval-definitions-5#windows") ET.register_namespace('', "http://oval.mitre.org/XMLSchema/oval-definitions-5#independent…") ns = "{http://oval.mitre.org/XMLSchema/oval-definitions-5}"… who knows? Programming Software Development by starsinthesky …setActionCommand("rect"); JButton oval = new JButton("Oval"); oval.setActionCommand("oval"); oval.addActionListener(this); JP9.add(rect…); JP9.add(oval); JPanel JP12 = new …