Package

Source Code of Main

import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.event.AWTEventListener;
import java.awt.event.KeyEvent;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

/**
*
* @author AvrDragon
*/
public class Main {

  public static void main(final String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        fmain(args);
      }
    });
  }
  public static void fmain(String[] args) {
    JFrame frame = new JFrame() {
      {
        getToolkit().addAWTEventListener(new AWTEventListener() {
          public void eventDispatched(AWTEvent e) {

            KeyEvent keyEvent = (KeyEvent) e;
            if (keyEvent.getID() == KeyEvent.KEY_RELEASED) {
              if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) {
                dispose();
              }
            }
          }
        }, AWTEvent.KEY_EVENT_MASK);
        getContentPane().setBackground(Color.GRAY);
      }
    };
   
//    BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
//    Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, new Point(0, 0), "blank cursor");
//    frame.getContentPane().setCursor(blankCursor);
   
    frame.setTitle("Rect Editor");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(new RectEditor());

    frame.setSize(800, 600);
    frame.setLocationRelativeTo(null);
    frame.setLocation(frame.getLocation().x + 1600, frame.getLocation().y);
    frame.setVisible(true);
  }

}
TOP

Related Classes of Main

TOP
Copyright © 2018 www.massapi.com. 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.