Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » I need some help with xtend
I need some help with xtend [message #997323] Sat, 05 January 2013 20:51 Go to next message
Jacob Goodson is currently offline Jacob GoodsonFriend
Messages: 1
Registered: January 2013
Junior Member
I tried posting this to the google+ group but it keeps deleting my post...


I cannot implement the abstract class KeyAdapter inside of another class like I can in Java...

class Something extends JFrame
{
class foo extends KeyAdapter
{
//this will not work, please help me understand why.
}
}

I got it rolling like this but I wonder if there was a more idiomatic well accepted way...

public class keything extends KeyAdapter
{
public static var x = 100
public static var y = 100
override void keyPressed(KeyEvent e)
{
val keyCode = e.keyCode
switch keyCode
{
case 87: y = y - 1
case 65: x = x - 1
case 83: y = y + 1
case 68: x = x + 1
}
}
}

public class Something extends JFrame
{
new()
{
addKeyListener(new keything)
setTitle("GAME")
setSize(500,500)
setResizable(false)
setVisible(true)
setDefaultCloseOperation(EXIT_ON_CLOSE)
}
override public void paint(Graphics g)
{
g.fillOval(keything::x,keything::y,15,15)
repaint
}

def static void main(String[] args)
{
new Something
}
}
Re: I need some help with xtend [message #997340 is a reply to message #997323] Sun, 06 January 2013 16:30 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
I don't know who is deleting posts on google+ and why, but that should be the place to ask, not the JDT forum.

[Updated on: Sun, 06 January 2013 16:32]

Report message to a moderator

Re: I need some help with xtend [message #999478 is a reply to message #997323] Sat, 12 January 2013 07:40 Go to previous message
shahid saif is currently offline shahid saifFriend
Messages: 4
Registered: December 2012
Junior Member




Please tet me know why coming the error in this code. this question for all?










Jacob Goodson wrote on Sat, 05 January 2013 15:51
I tried posting this to the google+ group but it keeps deleting my post...


I cannot implement the abstract class KeyAdapter inside of another class like I can in Java...

class Something extends JFrame
{
class foo extends KeyAdapter
{
//this will not work, please help me understand why.
}
}

I got it rolling like this but I wonder if there was a more idiomatic well accepted way...

public class keything extends KeyAdapter
{
public static var x = 100
public static var y = 100
override void keyPressed(KeyEvent e)
{
val keyCode = e.keyCode
switch keyCode
{
case 87: y = y - 1
case 65: x = x - 1
case 83: y = y + 1
case 68: x = x + 1
}
}
}

public class Something extends JFrame
{
new()
{
addKeyListener(new keything)
setTitle("GAME")
setSize(500,500)
setResizable(false)
setVisible(true)
setDefaultCloseOperation(EXIT_ON_CLOSE)
}
override public void paint(Graphics g)
{
g.fillOval(keything::x,keything::y,15,15)
repaint
}

def static void main(String[] args)
{
new Something
}
}

Previous Topic:Need help with installing Google plugin in Eclipse 4.2 (Juno)
Next Topic:Remove Project History (Indigo)
Goto Forum:
  


Current Time: Thu Apr 25 09:06:58 GMT 2024

Powered by FUDForum. Page generated in 0.04329 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top