Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 679 results for
oval
- Page 1
Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
4 Weeks Ago
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
4 Weeks Ago
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
4 Weeks Ago
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
4 Weeks Ago
by Dani
I’ll mark this question solved :)
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
4 Weeks Ago
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
4 Weeks Ago
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
3 Weeks Ago
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
3 Weeks Ago
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());
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Weeks Ago
by jprog1000
Got it. Thank you so much!
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Weeks Ago
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
2 Weeks Ago
by jprog1000
Great reply, vortex! Agree with all your points.
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Weeks Ago
by aishamushtaq
Hi, Its helpful for me. I got my answer.
Oval shape does not display
Programming
Software Development
12 Years Ago
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
15 Years Ago
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
15 Years Ago
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
15 Years Ago
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
15 Years Ago
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
16 Years Ago
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
15 Years Ago
by Lensva
its supposed to draw an
oval
on MouseClicked: [code="java"] import java.awt.event.*; …
Pictuerbox as oval
Programming
Software Development
14 Years Ago
by tqmd1
Dear Experts How to display picturebox as
oval
shape. Please help
Re: Oval shape does not display
Programming
Software Development
12 Years Ago
by NormR1
Is the JPanel added after the GUI is made visible? Try calling setVisible after adding the JPanel.
Re: Oval shape does not display
Programming
Software Development
12 Years Ago
by NormR1
There could be a conflict between the layout managers you are using. Try getting rid f the one used by the IDE and creating the layout yourself. I can not test the code bBecause the code uses packages not in the Java SE
Re: Oval shape does not display
Programming
Software Development
12 Years Ago
by skiabox
I add the JPanel in the constructor (it is the second line).
Re: Oval shape does not display
Programming
Software Development
12 Years Ago
by NormR1
What layout manager is being used? Does it accept a call to add() without any constraints/parameters? For example: add(component, BorderLayout,CENTER);
Oval drawn is jagged instead of smooth
Programming
Software Development
15 Years Ago
by VernonDozier
OK, this is a follow-up to this thread, which I have marked solved. [url]http://www.daniweb.com/forums/thread152797.html[/url] I changed things from GIF to PNG and that seems to solve the saving issue, but there is a new issue. I'm trying to create a semi-transparent circle as an image, which can be saved. The saving and retrieving seems to…
Re: Oval drawn is jagged instead of smooth
Programming
Software Development
15 Years Ago
by Ezzaral
I would just guess it stems from the fact you created a fixed size buffer image and rendered the red circle on it without anti-aliasing. You then draw that image in paintComponent. The image itself will be unchanged and I don't think turning on anti-aliasing in paintComponent will affect that image.
Re: Oval drawn is jagged instead of smooth
Programming
Software Development
15 Years Ago
by VernonDozier
[QUOTE=Ezzaral;719098]I would just guess it stems from the fact you created a fixed size buffer image and rendered the red circle on it without anti-aliasing. You then draw that image in paintComponent. The image itself will be unchanged and I don't think turning on anti-aliasing in paintComponent will affect that image.[/QUOTE] Yes, I think …
Re: creating shape like circle or oval(i wanted to design my own circle shape)
Programming
Software Development
15 Years Ago
by selvaganapathy
Do you want to implement the Circle, or Line Drawing Algorithm instead of using Graphics.DrawLine(), DrawEllipse () Method? Or You want to make application like paint ? rubberband elastic Drawing?
Re: creating shape like circle or oval(i wanted to design my own circle shape)
Programming
Software Development
15 Years Ago
by karhong
Actually, I created other shape such as trapezium, parallelogram, by using the addlines. I created them by having a middle point of the shape start from (x,y) - (100,100) but when i straight use the build in function to draw ellipse, i can't find any ways to set the mid point of the ellipse start from (100,100) I do that is because when …
Re: creating shape like circle or oval(i wanted to design my own circle shape)
Programming
Software Development
15 Years Ago
by selvaganapathy
Hi, You can perform the Transformation on your Points(By just adding or subtracting (100, 100) to each points). GDI+ uses (0,0) is the Mid point. But it provides Matrix class to Transform the Coordinate System. Example to Transform the Coordinate System [CODE=CSharp] private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g …
1
2
3
12
Next
Last
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC