Search:

Type: Posts; User: ICEPower

Search: Search took 0.30 seconds.

  1. Replies
    1
    Views
    1,032

    Self written timer with System.nanoTime()

    Hello,
    I'm just trying to make a rectangle move over the horizontal direction. Below you can find the code I have written, but it doesn't work when I click drop-button.
    I don't understand why it...
  2. Replies
    1
    Views
    1,135

    Swing timer, falling object

    I'm trying to simulate a falling object with an initial horizontal speed. I understand how to make it move horizontally (no acceleration) but I have some trouble making it move vertically because of...
  3. Replies
    3
    Views
    1,485

    Re: CardLayout which between JPanels

    Thank you for the reply.

    so I did addActionListener(this) to every button and implemented ActionListener with actionPerfomed method.
    But I don't understand fully how to change the Card now in...
  4. Replies
    3
    Views
    1,485

    CardLayout which between JPanels

    I want to switch between JPanels by clicking buttons on the JPanels.

    For example:
    I have a JPanel sim with a JButton simknop and a JPanel help with JButton helpknop
    I want to switch between...
  5. Replies
    11
    Views
    1,897

    Re: addActionListener to JButton

    The only other class I've made is a JFrame to show a GUI, except that I haven't written any other program.
    I still don't understand why it doesn't recognize actionperformed for the Button but I...
  6. Replies
    11
    Views
    1,897

    Re: addActionListener to JButton

    I don't think I understand the problem, but I also don't really understand what you're saying about a program that shows the problem. I'm kind of really new to Java.
    Thank you for the help though!
  7. Replies
    11
    Views
    1,897

    Re: addActionListener to JButton

    When I click a button, suppose PLAY, it should print out "hello". It doesn't do that, so I think the THIS in knop.addActionListener(THIS) is for the ActionListener and is supposed to be written in...
  8. Replies
    11
    Views
    1,897

    Re: addActionListener to JButton

    If I modify the constructor like this (with JButton knop) the ActionListener works and does print "Hello" like it is written in the actionPerformed method.
    so from that I can see that the problem...
  9. Replies
    11
    Views
    1,897

    Re: addActionListener to JButton

    It doesnt give an error message, the ActionListener just doesn't work. When I click a button it does nothing..

    Thank you for your response!


    public class MainMenu extends JPanel implements...
  10. Replies
    11
    Views
    1,897

    addActionListener to JButton

    Hello,

    I'm trying to write a method that makes a JButton and adds actionlistener but it doesn't work.
    The code below is written in a Class that extends JPanel implements ActionListener.

    I...
  11. Replies
    2
    Views
    1,225

    Re: Cannot draw graphics on JPanel

    Thank you, I think I will have to read more about paintComponent method. I wanted to try it with the BalPaneel variable since our teacher said that was one way you could make it work (the way we did...
  12. Replies
    2
    Views
    1,225

    Cannot draw graphics on JPanel

    Hi,
    I'm new here and am just starting programming Java. (Started last year but failed :( )
    I'm trying to figure out why my code doesn't work. I get the JFrame and JPanel but I just wanted to test...
  13. Replies
    13
    Views
    2,215

    Re: Using variable in different class

    This line doesn't work when I do 'startsnelheid = 0;' in BeginsnelheidPaneel. Whatever I type 'startsnelheid' equals to 0 in SimulatiePaneel...
  14. Replies
    13
    Views
    2,215

    Re: Using variable in different class

    If you look at the code of SimulatiePaneel, you'll see what the idea is.

    I have a car and 'startsnelheid' is it's startvelocity. So when startsnelheid has a value for example 5. the car should be...
  15. Replies
    13
    Views
    2,215

    Re: Using variable in different class

    public BeginsnelheidPaneel(FlashedFrame fframe, double startsnelheid)
    {
    this.ff = fframe;
    this.setLayout(null);
    .
    .
    .}

    this also doesn't work because that only listens to what's in the...
  16. Replies
    13
    Views
    2,215

    Re: Using variable in different class

    So what you are saying is:



    That's something that I had already done and it didn't work. That's why I suggested to make a new variable.
  17. Replies
    13
    Views
    2,215

    Re: Using variable in different class

    Please can someone help me out with this? I really don't see why it doesn't work. I tried everything I know of doing
  18. Replies
    13
    Views
    2,215

    Re: Using variable in different class

    What I understand from what you just said is:

    I should make a new variable x in BeginsnelheidPaneel, and in the constructor of BeginsnelheidPaneel I should equal x to startsnelheid. And in...
  19. Replies
    13
    Views
    2,215

    Re: Using variable in different class

    Thnx guys. As i already said i'm new to java. I read the link you uploaded but I still can't figure out why my code is not working.

    I do t get any errors but I know that the value of...
  20. Replies
    13
    Views
    2,215

    Using variable in different class

    Hi everyone,

    I'm new on this forum and also with Java. I was wondering if someone could help me out with this problem i'm having.

    I have 2 classes and I need to use a variable from one class in...
Results 1 to 20 of 20