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 …java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JPanel; import javax.swing.…new Timer(delay, this); timer.start(); } public void actionPerformed(ActionEvent e) { repaint(); } public void paintComponent( Graphics g )… Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa …java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JPanel; import javax.swing.…new Timer(delay, this); timer.start(); } public void actionPerformed(ActionEvent e) { repaint(); } public void paintComponent(Graphics g) {… Re: Bouncing Balls: Creating a new ball when two balls collide Programming Software Development by toneewa …java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JPanel; import javax.swing.…new Timer(delay, this); timer.start(); } public void actionPerformed(ActionEvent e) { repaint(); } public void paintComponent(Graphics g) {… 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()); ActionEvent for multiple JButtons Programming Software Development by DoubleGee … buttons work. Here is my actionPerformed method: public void actionPerformed(ActionEvent evt) { if(evt.getSource().equals(printButton)) // This is the first… Re: ActionEvent for multiple JButtons Programming Software Development by DoubleGee …. Any suggestions what the problem might be? public void actionPerformed(ActionEvent evt) { if(evt.getSource().equals(printButton)) { System.out.println(inResult… GUI Actions With Objects, ActionEvent ActionListener Programming Software Development by kezkez … like ... class Action2 implements ActionListener { public void actionPerformed (ActionEvent e) { String record1 = field2.getText(); String record2 =…,400)); } class Action implements ActionListener { public void actionPerformed (ActionEvent e) { String newDatabaseName = field1.getText(); StudentDB db =… Faking An ActionEvent Programming Software Development by ajst … currently have a method that is called on a ActionEvent of being clicked. Now I want to call that … want to call. [CODE] private void gameEndTurnBtnActionPerformed(java.awt.event.ActionEvent evt) { if(theGame.WhosTurn() == 1) { theGame.SetWhosTurn(2);… If statement non functional in button ActionEvent Programming Software Development by shayan_doust … java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.*; import java.awt.event.*; public…(true); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ if(parseduserguess > numberToGuess){ result.setText("… Re: If statement non functional in button ActionEvent Programming Software Development by Heanre …awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.*; import java.awt.…); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int numberToGuess = rand.nextInt(100); int… Re: actionListener & actionEvent in diffirent classes Programming Software Development by Dean_Grobler … normaly you do that and then you have a method actionEvent/actionPerformed method in the same class that then says what… is clicked. What I want to do, is have this actionEvent/actionPerformed method, in ANOTHER class. Make sense? Re: Faking An ActionEvent Programming Software Development by JamesCherrill Since your method's code doesn't actually use the ActionEvent parameter, you could just call gameEndTurnBtnActionPerformed(null); from anywhere in your class (or anywhere else if you make it public). Re: Faking An ActionEvent Programming Software Development by ajst … needs to know [CODE] private void gameEndTurnBtnActionPerformed(java.awt.event.ActionEvent evt) { if(theGame.WhosTurn() == 1) { theGame.SetWhosTurn(2); theGame.ResetMoved… The e.getSource() method from ActionEvent e in a listener Programming Software Development by mastr924 In the listener for a button in the actionPerformed(ActionEvent e) part, if you call e.getSource it returns a type object. So how can I turn that object that it returns into the original button? actionListener & actionEvent in diffirent classes Programming Software Development by Dean_Grobler Hi there, I just wanted to find out if one can have a actionListener() in one .class file and then have the actionEvent() in another .class file? If not, how would I go about to get the same effect? Thanks! Re: actionListener & actionEvent in diffirent classes Programming Software Development by JamesCherrill This question doesn't quite make sense - the actionEvent is created by Swing normally. Can you please explain exactly what you want to achieve? JFrame Code Programming Software Development by hadisur_rahman …lt;/editor-fold> private void memoryreadActionPerformed(java.awt.event.ActionEvent evt) { display1.setText(String.valueOf(memorydisplay.getText())); } private void onedividedbyxActionPerformed… Help with subtotal Programming Software Development by onlinegear …TableList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { } }); //Order 1 numberLabel1 =….addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (DrinksCombo10.getSelectedItem().equals("… Need guidance Programming Software Development by nljavaingineur …{ this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.button15_actionPerformed(e); } } class … { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.button1_actionPerformed(e); } } } class … Currency Conversion Programming Software Development by Matt89 …} private void ZeroActionPerformed(java.awt.event.ActionEvent evt) { Money.setText(Money.getText()+Zero… private void EightActionPerformed(java.awt.event.ActionEvent evt) { Money.setText(Money.getText… need help wth java calculator app Programming Software Development by darylglenng …(jTextField1.getText()+B3.getText()); } private void B5ActionPerformed(java.awt.event.ActionEvent evt) { jTextField1.setText(jTextField1.getText()+B5.getText()); } private void B6ActionPerformed… parent/child Programming Software Development by ceyesuma …private void crnewacctActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getActionCommand()==("…} private void CreditActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling…