Hello everyone on daniweb!:) I'm trying to make a programme which will move a picture to the sides when pressing the right or left arrowkeys. I did successfully put a picture in and I was able to change the side coordinates(called "side" in the programme) to make the picture move. However now I want it to be done with KeyListener. I have been trying to browse the internet for help but I havnt yet found anything which worked. One problem is that I dont know what to add the keylistener to(now its added to "img" because I dont know better). …

Member Avatar
Member Avatar
+0 forum 3

Hello everyone on Daniweb!:) I'm all new with working with swing and I'm having some problems making my paint method work:/. Atm I'm just tryin to make it write a ball, which I can control into different directions. Right now there is quite alot of unnecessary stuff in my code but please don't bother about that:P. Here's the code: [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.lang.*; import java.awt.event.KeyEvent.*; import java.awt.event.KeyListener.*; import java.awt.Graphics.*; public class Boll { JFrame frame=new JFrame("hej"); JLabel panel=new JLabel(); private int x=250, y=250; private boolean ball=true; private boolean jump=false; private final int MAXX=500, MAXY=500; private int …

Member Avatar
Member Avatar
+0 forum 14

I'm currently working on a tic-tac-toe program and it is working to the point that it runs and X's and O's appear. However when the right combination is made or the board gets full the method "Resultat();" should recognize it and "Clear();" should clear out the board and a JFrame should open asking if i want to exit or restart. This doesn't happen. The board just gets filled without reacting:/ If any one has a clue what I'm doing wrong please help me out. Thank you in advance!:) (please dont mind that some of the variables have wierd names, im …

Member Avatar
Member Avatar
+0 forum 2

Hello! My name is Angelika and I'm 17 years old. I live in Sweden and is currenly studying Java in my education and it has turned out to be like a little side hobby:) Looking forward to learn some new things from you all(: x

Member Avatar
Member Avatar
+0 forum 1

The End.