Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by jprog1000 …[i]; } timer = new Timer(delay, this); timer.start(); } public void actionPerformed(ActionEvent e) { repaint(); } public void paintComponent( Graphics g ) { super.paintComponent… Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa …(balls)); timer = new Timer(delay, this); timer.start(); } public void actionPerformed(ActionEvent e) { repaint(); } public void paintComponent(Graphics g) { super.paintComponent… Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa …(balls)); timer = new Timer(delay, this); timer.start(); } public void actionPerformed(ActionEvent e) { repaint(); } public void paintComponent(Graphics g) { super.paintComponent… 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 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()); 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 aishamushtaq Hi, Its helpful for me. I got my answer. Re: First JLIST, used with GUI Inventory Programming Software Development by Ezzaral ActionPerformed will only get triggered by hitting enter in the text … Re: How to get date in JDateChooser Programming Software Development by peter_budo actionPerformed is what you need. If you not getting date it will be down to the fact that you have somewhere a problem. However without any additional code we will not be able to help Re: how to search existing object in an arrayList Programming Software Development by JamesCherrill actionPerformed is called on the Swing thread, so the appends should be OK as they are. Re: Java inner class problem Programming Software Development by JamesCherrill actionPerformed is called when you click the menu item, so that's sensible. You tell me, when do you want displayListSize to be called? actionPerformed won't work Programming Software Development by CuteCat …roadblock because what I say in the actionPerformed section just doesn't happen. I … remember that the things currently in the actionPerformed section are only there so I can see…p.setVisible(true); p.addKeyListener(new KeyListen()); } public void actionPerformed(ActionEvent e) { Izzy.hittable(); Izzy.movement(); if(rar … ActionPerformed no reload of table Programming Software Development by ceyesuma Hello The ActionPerformed will not unload the viewPort to load… a way to reload the table? The first actionPerformed supplies the table but the next will not remove…;to add combobox: "); //add(tableNamesCB); } [b] public void actionPerformed(ActionEvent evt) { if (evt.getSource() == tableNamesCB) { // show the… Re: actionPerformed in applet Programming Software Development by javaAddict …implement the ActionListener interface, then you will declare the actionPerformed method and write code inside it. Then you … java GUI). If you want to call the actionPerformed method explicitely meaning you want to call the code… either call directly the code you put inside the actionPerformed method, or trigger the button clicked yourself. The… Re: actionPerformed won't work Programming Software Development by javaAddict In order for this method to execute: [CODE] public void actionPerformed(ActionEvent e) { Izzy.hittable(); Izzy.movement(); if(rar == 'T') { System.…: [CODE] p.addKeyListener(new KeyListen()); [/CODE] When you want the actionPerformed method to execute? Also since it it the gameinit class… actionPerformed and exceptions help? Programming Software Development by PennyBoki …applet and how to[B] add [/B]actionPerformed to other buttons. This applet calculates the … class Racunaj implements ActionListener throws new Isklucok() { public void actionPerformed(ActionEvent e) { a = Double.parseDouble(A.getText()); b… ActionPerformed problem Programming Software Development by Toc7777 …of the code [code] new ActionListener() { public void actionPerformed( ActionEvent event ) { BetScreen betScreen = new BetScreen();…betScreen.setVisible(false); }//end if }//end method actionPerformed }//end method actionListener );//end call to addActionListener [/code] actionPerformed in applet Programming Software Development by vijaykavin10 … so inside of the init() method can we use the actionPerformed method or can't?.If we couldn't which place…. Also you just give me the syntax for creating the actionperformed method in applet.And that applet must have implements init… void is an invalid type for the variable actionperformed Programming Software Development by janetheath …addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { actionPerformed(e); } }); btnAddEmployee.setBounds(189…(new ActionListener() { public void actionPerformed(ActionEvent e) { actionPerformed(e); } }); btnAddEmployee.setBounds(189… Java value assigned from within ActionPerformed not maintained Programming Software Development by kekkaishi … value seems to be lost as soon as ActionPerformed method ends. here's the code [CODE]….add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Login logs = new Login(user.getText…the usertype is assigned any value within the ActionPerformed method and it does. what am i … Re: Java value assigned from within ActionPerformed not maintained Programming Software Development by BestJewSinceJC ….out.println(usertype);[/CODE] If you do that in your actionPerformed, then you print userType from within another method, [I]after… like this: [CODE=Java] button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Login logs = new Login(user.getText(), pass.getText… cancelling the actionPerformed Programming Software Development by Caled … to cancel or abort the execution of current actionPerformed? My problem is that, when the control … JOP. when user click OK, then the actionPerformed method should stop from executing the rest of … the app. Below is the code: [CODE]public void actionPerformed(ActionEvent nextbtn) { Object source = nextbtn.getSource(); if(source… Re: Java value assigned from within ActionPerformed not maintained Programming Software Development by kekkaishi [QUOTE=BestJewSinceJC;1022360]In actionPerformed, you create a new "Login", [I]not[/I] …(pass); panel.add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Login lg = new Login(user.getText(), pass.getText… Re: Java value assigned from within ActionPerformed not maintained Programming Software Development by quuba ….add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { label.setText("" + logUI.…(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //Login lg = new Login(… Re: Java value assigned from within ActionPerformed not maintained Programming Software Development by kekkaishi …, just do a System.out.println(getUsertype()); inside of the actionPerformed method at some point after you set the usertype.[/QUOTE….println(usertype) or System.out.println(getUsertype) was added inside actionPerformed to check if the value is there and it is…