150 lines
3.0 KiB
Java
150 lines
3.0 KiB
Java
package com.flaremicro.flaretv.visualforecast;
|
|
|
|
import java.awt.BorderLayout;
|
|
import java.awt.EventQueue;
|
|
import java.awt.event.KeyEvent;
|
|
import java.awt.event.KeyListener;
|
|
import java.awt.event.WindowEvent;
|
|
import java.awt.event.WindowListener;
|
|
|
|
import javax.swing.JFrame;
|
|
|
|
import com.flaremicro.flaretv.visualforecast.providerapi.ForecastProviderManager;
|
|
|
|
public class VisualForecastFrame extends JFrame implements WindowListener, KeyListener{
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 1L;
|
|
private RenderPanel renderPane;
|
|
private ForecastProviderManager forecastProviderManager;
|
|
private Executor executor;
|
|
private PropertyManager propertyManager;
|
|
private boolean isFullscreen = false;
|
|
|
|
/**
|
|
* Launch the application.
|
|
*/
|
|
public static void main(String[] args) {
|
|
EventQueue.invokeLater(new Runnable() {
|
|
public void run() {
|
|
try {
|
|
VisualForecastFrame frame = new VisualForecastFrame();
|
|
frame.setVisible(true);
|
|
frame.init();
|
|
//GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[1].setFullScreenWindow(frame);
|
|
frame.createBufferStrategy(2);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public void end()
|
|
{
|
|
if(executor != null)
|
|
executor.end();
|
|
}
|
|
|
|
public void init()
|
|
{
|
|
end();
|
|
executor = new Executor(this.renderPane, 30);
|
|
executor.begin();
|
|
|
|
forecastProviderManager = new ForecastProviderManager();
|
|
|
|
}
|
|
|
|
/**
|
|
* Create the frame.
|
|
*/
|
|
public VisualForecastFrame() {
|
|
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
|
setBounds(100, 100, 640*2, 480*2);
|
|
renderPane = new RenderPanel();
|
|
renderPane.setBorder(null);
|
|
renderPane.setLayout(new BorderLayout(0, 0));
|
|
setContentPane(renderPane);
|
|
setUndecorated(true);
|
|
addWindowListener(this);
|
|
addKeyListener(this);
|
|
}
|
|
|
|
@Override
|
|
public void windowOpened(WindowEvent e) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void windowClosing(WindowEvent e) {
|
|
|
|
end();
|
|
}
|
|
|
|
@Override
|
|
public void windowClosed(WindowEvent e) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void windowIconified(WindowEvent e) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void windowDeiconified(WindowEvent e) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void windowActivated(WindowEvent e) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void windowDeactivated(WindowEvent e) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void keyTyped(KeyEvent e) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void keyPressed(KeyEvent e) {
|
|
if(e.getKeyCode() == KeyEvent.VK_F11)
|
|
{
|
|
if(isFullscreen)
|
|
{
|
|
isFullscreen = false;
|
|
this.getGraphicsConfiguration().getDevice().setFullScreenWindow(null);
|
|
setBounds(100, 100, 640*2, 480*2);
|
|
|
|
}
|
|
else
|
|
{
|
|
isFullscreen = true;
|
|
this.getGraphicsConfiguration().getDevice().setFullScreenWindow(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void keyReleased(KeyEvent e) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
}
|