Java Code Examples for java.awt.im.InputContext#getInstance()

The following examples show how to use java.awt.im.InputContext#getInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Game.java    From JavaGame with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * @author Redomar
 * @version Alpha 1.8.4
 */
public Game() {
	context = InputContext.getInstance();

	// The game can only be played in one distinct window size
	setMinimumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
	setMaximumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
	setPreferredSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));

	setFrame(new JFrame(NAME));                                             // Creates the frame with a defined name
	getFrame().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);              // Exits the program when user closes the frame
	getFrame().setLayout(new BorderLayout());
	getFrame().add(this, BorderLayout.CENTER);                       // Centers the canvas inside the JFrame
	getFrame().pack();                                                      // Sizes the frame so that all its contents are at or above their preferred sizes
	getFrame().setResizable(false);
	getFrame().setLocationRelativeTo(null);                                 // Centres the window on the screen
	getFrame().setVisible(true);

	requestFocus();
	setDevMode(false);
	setClosing(false);
}
 
Example 2
Source File: Window.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 3
Source File: InputHandler.java    From JavaGame with GNU Affero General Public License v3.0 5 votes vote down vote up
public InputHandler(Game game) {
	InputContext context = InputContext.getInstance();
	// Important to know whether the keyboard is in Azerty or Qwerty.
	// Azerty countries used QZSD instead of WASD keys.
	isAzertyCountry = context.getLocale().getCountry().equals("BE")
			|| context.getLocale().getCountry().equals("FR");
	game.addKeyListener(this);
}
 
Example 4
Source File: Window.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 5
Source File: Window.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 6
Source File: Window.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 7
Source File: Window.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 8
Source File: Window.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 9
Source File: Window.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 10
Source File: Window.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 11
Source File: Window.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 12
Source File: Window.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 13
Source File: Window.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 14
Source File: Window.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 15
Source File: Window.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 16
Source File: Window.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 17
Source File: Window.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 18
Source File: Window.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 19
Source File: Window.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}
 
Example 20
Source File: Window.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the input context for this window. A window always has an input context,
 * which is shared by subcomponents unless they create and set their own.
 * @see Component#getInputContext
 * @since 1.2
 */
public InputContext getInputContext() {
    synchronized (inputContextLock) {
        if (inputContext == null) {
            inputContext = InputContext.getInstance();
        }
    }
    return inputContext;
}