All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.becausetesting.commonswindow.utils.ui.JCommonWindowFrame Maven / Gradle / Ivy

package com.github.becausetesting.commonswindow.utils.ui;

/*-
 * #%L
 * commons-window
 * $Id:$
 * $HeadURL:$
 * %%
 * Copyright (C) 2016 Alter Hu
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */


import java.awt.GraphicsConfiguration;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRootPane;
import javax.swing.KeyStroke;


@SuppressWarnings("serial")
public class JCommonWindowFrame extends JFrame implements JStatusBar {



	private JLabel jlStatusBar;
	
	public JCommonWindowFrame() {
		super();
	}

	public JCommonWindowFrame(GraphicsConfiguration gc) {
		super(gc);
	}

	public JCommonWindowFrame(String title) {
		super(title);
	}

	public JCommonWindowFrame(String title, GraphicsConfiguration gc) {
		super(title, gc);
	}

	
	
	public void initMainPane() {
		
	}
	
	public void initStatusBar() {

	}
	

	@Override
	protected JRootPane createRootPane() {
		JRootPane rootPane = new JRootPane();

		// Escape key closes dialogs
		KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
		rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(stroke, "escapeKey");
		rootPane.getActionMap().put("escapeKey", new AbstractAction() {
			@Override
			public void actionPerformed(ActionEvent e) {
				setVisible(false);
				dispose();
			}
		});
		return rootPane;
	}
	
	@Override
	public void setStatusBarText(String status) {
		// TODO Auto-generated method stub
		jlStatusBar.setText(status);
		
	}

	@Override
	public void setDefaultStatusBarText() {
		// TODO Auto-generated method stub
		
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy