Created
October 30, 2011 19:44
-
-
Save mikecann/1326337 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nme.display.Sprite; | |
import org.aswing.border.EmptyBorder; | |
import org.aswing.FlowLayout; | |
import org.aswing.Insets; | |
import org.aswing.JButton; | |
import org.aswing.JFrame; | |
import org.aswing.JLabel; | |
import org.aswing.JPanel; | |
class Main extends Sprite | |
{ | |
public function new() : Void | |
{ | |
super(); | |
var frame : JFrame = new JFrame( this, "AsWingApplication" ); | |
frame.getContentPane().append( createCenterPane() ); | |
frame.setSize(new IntDimension( 200, 120 ) ); | |
frame.show(); | |
} | |
private function createCenterPane() : JPanel | |
{ | |
var pane : JPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); | |
label = new JLabel(labelPrefix+"0"); | |
button = new JButton("I'm a AsWing button!"); | |
pane.append(button); | |
pane.append(label); | |
pane.setBorder(new EmptyBorder(null, new Insets(10,5,10,5))); | |
initHandlers(); | |
return pane; | |
} | |
private function initHandlers() : Void | |
{ | |
//button.addActionListener( __pressButton ); | |
button.addEventListener(MouseEvent.MOUSE_UP, __pressButton); | |
} | |
private function __pressButton( e : Event ) : Void | |
{ | |
numClicks++; | |
label.setText(labelPrefix+numClicks); | |
label.revalidate(); | |
} | |
static function main() | |
{ | |
new Main(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment