Package squidpony.squidgrid.gui

Examples of squidpony.squidgrid.gui.SGKeyListener


            //don't do anything if it failed, the default Java icon will be used
        }

        Font font = new Font("Lucidia", Font.PLAIN, fontSize);

        keyListener = new SGKeyListener(true, SGKeyListener.CaptureType.DOWN);
        frame.addKeyListener(keyListener);

        Container panel = frame.getContentPane();
        panel.setBackground(SColor.BLACK);
        panel.setLayout(new BorderLayout());
View Full Code Here


            //don't do anything if it failed, the default Java icon will be used
        }

        Font font = new Font("Lucidia", Font.PLAIN, fontSize);

        keyListener = new SGKeyListener(true, SGKeyListener.CaptureType.DOWN);
        frame.addKeyListener(keyListener);

        panel = new JPanel();
        panel.setBackground(SColor.BLACK);
        panel.setLayout(new BorderLayout());
View Full Code Here

    public static void main(String[] args) {
        JFrame frame = new JFrame("SGKeyListenerDemo -- Press 'x' to exit");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        SGKeyListener key = new SGKeyListener(true, CaptureType.DOWN);
        frame.addKeyListener(key);

        JLabel label = new JLabel("Pressed Character");
        frame.add(label);

        frame.pack();
        frame.setVisible(true);
        frame.setLocationRelativeTo(null);//center the frame on the screen

        char c;
        do {
            frame.repaint();
            c = key.next().getKeyChar();
            label.setText("\nKey pressed: " + c);
        } while (true);
    }
View Full Code Here

TOP

Related Classes of squidpony.squidgrid.gui.SGKeyListener

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.