Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
balls
- Page 1
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by Traevel
…from the terribly confusing naming for
balls
and lists of
balls
, you call `updateball` to add
balls
every few ticks, then you … other tick, you update their position and redraw the
balls
on their new position, this probably also means you'… clear the entire panel, and redraw pacman and the
balls
on that every tick. And I'd strongly suggest using…
Java array of balls
Programming
Software Development
13 Years Ago
by Stevo812
…/**Ball class which contains the code for creating the
balls
and setting the * boundaries of the screen. …2; /**double which declares the friction applied to the
balls
when traveling * along the table. */ private double friction… contains the code for collisions between * the
balls
. */ collision.update(this, b, b2); …
problem in showing balls
Programming
Software Development
10 Years Ago
by toring
… void updateball(){ for(
Balls
bb:ball){ ball.add(new
Balls
(xPos,yPos)); } } } class
Balls
{ int x,y; public
Balls
(){ } public
Balls
(int x,int y…
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by toring
…, yPos = 35; int arcMouth=300;
Balls
pacmanball = new
Balls
(); List<
Balls
>ball = new ArrayList<
Balls
>(); public Mypanel(){ myTimer(); } protected void…
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by toring
…int arcMouth=300;
Balls
pacmanball = new
Balls
(); List<
Balls
>listball = new ArrayList<
Balls
>(); public Mypanel…fillArc(xPos,yPos,30,30,30,arcMouth); for(
Balls
b:listball){ b.drawballs(g); } } public…
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by toring
…i < 10; i++) { listball.add(new
Balls
(xPos+5,yPos+15)); } myTimer(); } protected …fillArc(xPos,yPos,30,30,30,arcMouth); for(
Balls
b:listball){ b.drawballs(g); } } public…
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
1 Year Ago
by toneewa
… = 50; public BallPanel(Ball[]
balls
) { b.addAll(Arrays.asList(
balls
)); timer = new Timer(delay, …new ball's parameters } } } } } // draw the
balls
for (int i = 0; i < b.size(); …
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
1 Year Ago
by toneewa
…50; public BallPanel(Ball[]
balls
) { b.addAll(Arrays.asList(
balls
)); timer = new Timer(…s parameters } } } } } // Draw the
balls
for (Ball ball : b) { // Draw the…
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by Traevel
…words, you can't draw the
balls
until the jPanel **has** a Graphics…after the repaint method or the
balls
will never stay visible long …repaint(); updateball(); } public void updateball(){ for(
Balls
b:listball){ b.moveBalls(); if(super.getGraphics()!=…
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by Traevel
Because
Balls
does not extend jPanel (more specifically, a jComponent). You're … means it has to be present in the super class.
Balls
doesn't have a super class.
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by toring
@Traevel, so if i will not extend my Class
Balls
to JPanel,I could not use the method paintComponent in my
Balls
Class ?... Thank you in avdvance.
Re: how to add more balls ?
Programming
Software Development
13 Years Ago
by autorunman22
… addBalls(); System.out.println("!"); Thread.sleep(4000);
Balls
balls
= new
Balls
();
balls
.paintMe(g); }catch(Exception ex){} } public static void main… directionX =2; static int directionY = 2; static int widx; public
Balls
() { Thread gameThread = new Thread() { public void run() { while(true)…
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by Traevel
If by behind you mean they don't get updated at the same pace as pacman it's because you're only updating the
balls
when pacman has its mouth open.
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by toring
why is it cannot replace the drawballs method in my
Balls
Class into this protected void paintComponent(Graphics g) { super.paintComponent(…
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by Traevel
If you don't extend
Balls
to a jComponent, then no you can't use that method in that manner.
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by Traevel
… in drawing position? If I run your code now the
balls
are not moving and it just draws a rectangle at…
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by Traevel
I don't know what your goal is, but what I'm seeing is a blue rectangle moving away from pacman yes. It could be that there are 10
balls
that all start in the same spot moving at the same pace, judging from what I'm seeing in your constructor though.
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by toring
….RED); g.fillArc(xPos,yPos,30,30,30,arcMouth); for(
Balls
b:listball){//how to perform this without inside b.drawballs…
Re: problem in showing balls
Programming
Software Development
10 Years Ago
by toring
….RED); g.fillArc(xPos,yPos,30,30,30,arcMouth); for(
Balls
b:listball){//how to perform this without inside b.drawballs…
Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
1 Year Ago
by jprog1000
….paintComponent( g ); g.setColor(Color.red); // move the
balls
for (int i = 0; i <b.length; i… b[i].changeDirection(b[j]); } } } // draw the
balls
for (int i = 0; i <b.length; i…
Bouncing Balls in Panel
Programming
Software Development
14 Years Ago
by renovatiotr
…swing-book/Chapter8_files/image002.gif[/URL] There are moving
balls
in seperate panels(not imaages). Smaller the panel's… area, faster the
balls
move. I did the JSplitPane and Panels but failed… to do the Moving
Balls
Part. [CODE] import java.awt.*; import javax.swing.*;…
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
1 Year 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: how to add more balls ?
Programming
Software Development
13 Years Ago
by JamesCherrill
…;Ball> is like an array of
Balls
except that it grows and shrinks to fit… the number of
Balls
in it at any time. Experienced Java …allBalls) { [/I] loop just loops through all the
Balls
in the ArrayList - it's normally called a for/… can just create a big-enough array of
Balls
, and have a variable to keep track of…
Guts or Balls
Community Center
Geeks' Lounge
17 Years Ago
by Ancient Dragon
We've all heard about people having guts or
balls
. But do you really know the difference between them? In …;Are you still cleaning, or are you flying somewhere?"
BALLS
- is coming home late after a night out with the… collar, slapping your wife on the butt and having the
balls
to say: "You're next." I hope this…
Re: Colliding Balls
Programming
Software Development
12 Years Ago
by Taywin
… inside a closed container at once. Then you will see
balls
collide one another? =) Anyway, what are you trying to do… real collision detection needs to know the center of both
balls
(assume
balls
are perfectly circle) and their radiuses. The estimate needs… corner of their boundary box and the size of the
balls
.
Re: Guts or Balls
Community Center
Geeks' Lounge
17 Years Ago
by Lardmeister
[quote=Ancient Dragon;449457]I may have snow on the roof but I'm not dead yet :)[/quote]Since you are still alive, you either don't have guts,
balls
or a wife.
Re: Guts or Balls
Community Center
Geeks' Lounge
17 Years Ago
by EnderX
[quote=Lardmeister;449919]Since you are still alive, you either don't have guts,
balls
or a wife.[/quote] Not necessarily true. It is possible, after all, that Ancient Dragon has all three but also the wisdom to know when [I]not[/I] to allow the first two to have their moment.
Re: Guts or Balls
Community Center
Geeks' Lounge
17 Years Ago
by Lardmeister
If your guts or
balls
don't have a moment, then you don't have them.
A BlackBerry with no balls
Hardware and Software
Linux and Unix
15 Years Ago
by happygeek
… with a 2GB microSDHC card) but no GPS. And no
balls
. I don't just mean the underwhelming spec, but literally… it has no
balls
. Instead of the usual trackball the Curve 8250 comes with…
how to bounce balls in open gl
Programming
Software Development
14 Years Ago
by nearest
… c++.I have made a quad a
balls
.Now i want to bounce the
balls
on quad repeadetly but i donot know…
1
2
3
17
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
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
© 2025 DaniWeb® LLC