[Solved] Exception in Thread “AWT-EventQueue-0” Tower Defense [closed]

In the Room class, the block variable (or one of its elements) is null. Because the error happens on this line: public void draw(Graphics g) { > for(int y=0;y<block.length;y++) { for(int x=0;x<block[0].length;x++) { block[y][x].draw(g); } } } I’d say you haven’t called define() (which seems to initialize the block variable) on your room by the … Read more

[Solved] Change Coordinates directely in the graphe [closed]

Take a look at Oracle’s tutorial: http://docs.oracle.com/javase/tutorial/2d/advanced/user.html They describe how to recognize clicks within the Graphics2D. They also show how to move a single shape. You have to advance this approach a little bit in order to support multiple elements. 1 solved Change Coordinates directely in the graphe [closed]

[Solved] The image’s event handler shows error in Java GUI

Why are you creating new instance of JButton in roll? You just need to change the icon of the buttons which are already displayed on the screen This… public void roll() { value = nextValue() ; if (value==1){ Icon i=new ImageIcon(getClass().getResource(“1.png”)); c= new JButton(i); add(c); } else if(value==2){ Icon im=new ImageIcon(getClass().getResource(“2.png”)); c= new JButton(im); add(c); … Read more

[Solved] java.AWT – setSize() method

Take this code import java.awt.Frame; public class AwtPrac { private static void init(){ Frame fm = new Frame(“Java Programm”); fm.setTitle(“AwtPrac”); fm.setSize(300,300); fm.setVisible(true); } public static void main(String[] args) { init(); } } 3 solved java.AWT – setSize() method