Package com.jmex.awt.swingui

Examples of com.jmex.awt.swingui.JMEDesktop


    //create a node for our GUI and change which render queue it's in
    guiNode = new Node("gui node");
    guiNode.setRenderQueueMode(Renderer.QUEUE_ORTHO); //this is make sure it is drawn correctly
   
    //create the actual desktop object and attach it to our node
    final JMEDesktop gui = new JMEDesktop("GUI", 500, 400, input);
    guiNode.attachChild(gui);
   
    //set the desktop's location
    gui.getLocalTranslation().set(display.getWidth() / 2 - 30, display.getHeight() / 2 + 50, 0);
   
    //Swing stuff can't happen in the jMonkey thread, so we use SwingUtilities's
    //invokeLater method to create a new thread in which all the Swing stuff is
    //setup. It's a round-about way of doing things, but it's necessary.
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        gui.getJDesktop().setBackground(new Color(0f, .6f, .2f, .8f)); //set the background color
       
        //create our GUI components
        JTextArea txtChat = new JTextArea("Hello World", 4, 20);
        JButton btnSubmit = new JButton("Submit");
       
        //add our components to the desktop
        gui.getJDesktop().add(txtChat);
        gui.getJDesktop().add(btnSubmit);
       
        //set their locations and sizes
        txtChat.setLocation(200, 200);
        btnSubmit.setLocation(200, 275);
        txtChat.setSize(txtChat.getPreferredSize());
View Full Code Here

TOP

Related Classes of com.jmex.awt.swingui.JMEDesktop

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.