Search Results

Search found 2 results on 1 pages for 'user552279'.

Page 1/1 | 1 

  • Distinguish between a single click and a double click in Java

    - by user552279
    Hi, I search the forum and see this codes: public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { System.out.println(" and it's a double click!"); wasDoubleClick = true; } else { Integer timerinterval = (Integer) Toolkit.getDefaultToolkit().getDesktopProperty( "awt.multiClickInterval"); timer = new Timer(timerinterval.intValue(), new ActionListener() { public void actionPerformed(ActionEvent evt) { if (wasDoubleClick) { wasDoubleClick = false; // reset flag } else { System.out.println(" and it's a simple click!"); } } }); timer.setRepeats(false); timer.start(); } } but the code runs incorrectly(Sometime it prints out " and it's a single click!" 2 times . It should print out " and it's a double click!"). Can anybody show me why? or can you give me some better ways to do this? Thank you!

    Read the article

  • A Question about dereferencing pointer to incomplete type In C programming

    - by user552279
    Hi, can you explain this error for me? Blockquote /////////////////////////////// In my A.h file: struct TreeNode; struct TreeHead; typedef struct TreeNode * Node; typedef struct TreeHead * Head; /////////////////////////////// In my A.c file: struct TreeNode { char* theData; Node Left; Node Right; } ; struct TreeHead{ int counter; char type; Node Root; }; Head Initialisation() { Head treeHead; treeHead = malloc(sizeof (struct TreeHead)); treeHead-Root = malloc(sizeof (struct TreeNode)); return treeHead; } /////////////////////////////// In my Main.c file: Head head; Node tree; int choose =5; head = Initialisation(); (head-Root) = tree; //When compiling, this line has an error: error: dereferencing pointer to incomplete type Blockquote haed-Root will return a Node pointer, tree is also a Node pointer. So why error is dereferencing pointer to "incomplete" type?

    Read the article

1