This site requires JavaScript, please enable it in your browser!
Greenfoot back

What is happening right now?

Taeyo

reply to hi, how do I run my ball image using jbutton arrow and players img using keyarrows the panel1 is set in Grid layout .(java eclipse)

By Taeyo - about 1 hour ago
JButton walls = new JButton;
the jbutton walls and jbutton images are kept in gridlayout panel using 2d array
for(int i = 0;i<13;i++) { for(int j = 0; j<16; j++) { JButton wall = new JButton (); wall.setBackground(Color.white); wall.setBorderPainted(false); wall.setIcon(new ImageIcon("C:\\Users\\dell\\Downloads\\images (2)\\images\\grey.jpg")); walls=wall; if(j == 7 || j == 8) { wall.setIcon(new ImageIcon("C:\\Users\\dell\\Downloads\\images (2)\\images\\wall.jpg")); walls=wall; } panel_1.add(walls); }
danpost

reply to Sharing a variable across actors

By danpost - about 2 hours ago
RcCookie wrote...
There are multiple ways to do this: <Code Omitted>
Immediately after this, you will need to check for a null reference: <Code Omitted>
<Code Omitted>
Line 4 must not be executed without first checking that the list is not empty. Also, the list object must be type cast to Actor before it can be assigned to the reference variable: <Code Omitted>
<Code Omitted>
Similar to the first code set.
<Code Omitted>
Similar to the second code set. ****************************************************** Once you have the actor referenced, you will need to type cast it as a Crab object before you can access the crabHealth field: <Code Omitted>