Java Code Examples for javax.swing.JFrame#NORMAL

The following examples show how to use javax.swing.JFrame#NORMAL . These examples are extracted from open source projects. 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
@Override
public void windowToScale() {
	if (!isFullscreen() && getExtendedState() == JFrame.NORMAL) {
		int dx = getWidth() - surface.getWidth();
		int dy = getHeight() - surface.getHeight();

		int sw = Math.max(640, (int)(config.uiScale * 6.40 + 1));
		int sh = Math.max(480, (int)(config.uiScale * 4.80 + 1));

		Rectangle mxs = getGraphicsConfiguration().getBounds();

		setSize(Math.min(mxs.width, Math.max(sw + dx, getWidth())), Math.min(mxs.height, Math.max(sh + dy, getHeight())));
		
		commons.text().setFontScaling(config.uiScale / 100d);
	}
}
 
Example 2
Source Project: Spark   File: RoarMessageListener.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void messageReceived(ChatRoom room, Message message) {

    try {
        ChatRoom activeroom = SparkManager.getChatManager().getChatContainer().getActiveChatRoom();

        int framestate = SparkManager.getChatManager().getChatContainer().getChatFrame().getState();

        if (framestate == JFrame.NORMAL && activeroom.equals(room) && room.isShowing()
                && (isOldGroupChat(room) || isMessageFromRoom(room, message))) {
            // Do Nothing
        } else {
            decideForRoomAndMessage(room, message);
        }

    } catch (ChatRoomNotFoundException e) {
        // i don't care
    }

}
 
Example 3
Source Project: littleluck   File: LuckWindowAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public void windowStateChanged(WindowEvent e)
{
    Window window = (Window) e.getSource();

    if (window instanceof JFrame)
    {
        JFrame frame = (JFrame) window;

        JRootPane rootPane = frame.getRootPane();

        if(rootPane.getUI() instanceof LuckRootPaneUI)
        {
            LuckRootPaneUI rootPaneUI = (LuckRootPaneUI) rootPane.getUI();

            rootPaneUI.getTitlePane().setState(e.getNewState());
        }

        if (e.getNewState() == JFrame.MAXIMIZED_BOTH)
        {
        	rootPane.setBorder(null);
        }
        else if (e.getNewState() == JFrame.NORMAL)
        {
        	rootPane.setBorder(UIManager.getBorder(LuckRootPaneUIBundle.FRAME_BORDER));
        }
    }
}
 
Example 4
Source Project: littleluck   File: LuckTitlePanel.java    License: Apache License 2.0 4 votes vote down vote up
public LuckTitlePanel(boolean isResizeableOnInit, int initStyle)
{
    setOpaque(false);

    setLayout(createLayout());

    this.isResizeableOnInit = isResizeableOnInit;

    this.initStyle = initStyle;

    this.state = JFrame.NORMAL;

    Object obj = UIManager.get(LuckRootPaneUIBundle.TITLEPANEL_BG_IMG);

    if(obj != null)
    {
        np = new SwingNinePatch((BufferedImage) obj);
    }

    installTitle();

    installBtn();
}