Search:

Type: Posts; User: Fermen

Search: Search took 0.21 seconds.

  1. Replies
    8
    Views
    1,309

    [SOLVED] Re: KeyListener won't listen

    Yeah, :D I made it work!


    if(e.getKeyCode() == 38)
    {
    y = player1.getY();
    System.out.println("Pressed");
    // y = 200;
    ...
  2. Replies
    8
    Views
    1,309

    [SOLVED] Re: KeyListener won't listen

    Because the Y value is the components Y - value. When I change the Y value
    int y = 100; the component is changing it's position. Then I just thought it sounded reasonable that it would also change...
  3. Replies
    8
    Views
    1,309

    [SOLVED] Re: KeyListener won't listen

    Because I change the value of y:
    y = y + 10;

    Or?? wouldn't that work?
  4. Replies
    8
    Views
    1,309

    [SOLVED] Re: KeyListener won't listen

    I tried using the .setFocusable(true) in "public Spelplan". I also kept the printline "Pressed" inside the if-statement. Now it says "Pressed", but the component does not move.
  5. Replies
    8
    Views
    1,309

    [SOLVED] KeyListener won't listen

    Why won't my "player1" move???
    Class with main


    import java.awt.Color;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
  6. Replies
    5
    Views
    887

    Re: Showing JPanel error

    Oh, I think I found out the error now. I should have extended my VisaStapel - class with JPanel instead of JFrame...

    Thanks for the help everyone :)
  7. Replies
    5
    Views
    887

    Re: Showing JPanel error

    Yes, this change make it work. But it should, according to my instructions work the way I wrote it to. This is the error:

    Exception in thread "main" java.lang.IllegalArgumentException: adding a...
  8. Replies
    5
    Views
    887

    Showing JPanel error

    Why do I get this error? --> Exception in thread "main" java.lang.IllegalArgumentException: adding a window to a container

    It's ridiculous... I'm just adding a JPanel to a JFrame..or?

    Class...
  9. Replies
    2
    Views
    720

    [SOLVED] Re: Painted component won't show up

    Thank you very much sir. Start to get the thing with the drawing now :D
  10. Replies
    2
    Views
    720

    [SOLVED] Painted component won't show up

    Hello, I wonder why my oval doesn't show up on the frame.


    Class with the oval



    import java.awt.Color;
    import java.awt.Graphics;
    import javax.swing.JPanel;
  11. Thread: img flowlayout

    by Fermen
    Replies
    1
    Views
    922

    img flowlayout

    Hi,

    I use this to draw up an image file on the JFrame. But instead of giving x and y pos I want the img to go with the flowlayout like the rest of my code (JButtons and such). How do I do?


    ...
  12. Replies
    2
    Views
    1,574

    [SOLVED] Re: Compiled .jar won't work (Error-sound)

    Thanks :D I looked further and fixed my manifest as it was not correctly made.
  13. Replies
    2
    Views
    1,574

    [SOLVED] Compiled .jar won't work (Error-sound)

    I'm going to compile a project. I do like in this example below marked in red and the cmd says it compresses to a jar. The .jar ends up in the same folder as the mainclass and when I press the .jar...
  14. [SOLVED] Re: Picture won't go with the .jar (Wrong code or compile error?)

    I do like in this example below marked in red and the cmd says it compresses to a jar. The .jar ends up in the same folder as the mainclass and when I press the .jar file I just hear that "windows...
  15. [SOLVED] Picture won't go with the .jar (Wrong code or compile error?)

    Hi :cool:,

    I want to have a picture on the JFrame and for that I use the 2 lines of code below this patagraph. The problem is that when I compile it to .jar, I can only see the picture on the...
  16. Replies
    2
    Views
    758

    Re: Repressable button in GUI

    It's solved now :D Ok I should think of that
  17. Replies
    2
    Views
    758

    Repressable button in GUI

    This class shows a GUI with a JLabel, a JButton and a JTextField. When klicking the button, an array of Strings in another class randomizes a String from the array and adds it to the textfield in...
  18. [SOLVED] Re: Return randomized String to other class in project

    Ok yes thanks a lot :), it helped me understand a bit about classes. Then I looked on the code of a almost similar program we wrote in school and did it like this.


    CLASS 1

    public class...
  19. [SOLVED] Return randomized String to other class in project

    Hi, I want to return a randomized string from Class2 to Class1 (the classes are in same "Project". How do I do to make the returned String relevant in Class1?

    CLASS 1

    public class p12NameGen
    {...
Results 1 to 19 of 19