Pages

First full screen


********************************************************************
COMPLETE SOURCE CODE FOR : FullScreenInJava.java
********************************************************************


import java.awt.GraphicsEnvironment;
import java.awt.GraphicsDevice;

import java.awt.Frame;
import java.awt.Window;
import java.awt.Button;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.WindowListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import java.awt.FlowLayout;

import java.awt.Color;

public class FullScreenInJava
{
public static void main(String[]args)
{
GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd=ge.getDefaultScreenDevice();

ActionListener al=new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
GraphicsEnvironment ge2=GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd2=ge2.getDefaultScreenDevice();
gd2.setFullScreenWindow(null);
}
};

Frame a=new Frame();

Button b=new Button("CLICK HERE TO DISABLE FULL SCREEN");
b.addActionListener(al);

WindowListener wl=new WindowAdapter()
{
public void windowClosing(WindowEvent evt)
{
System.exit(0);
}
};

a.addWindowListener(wl);
a.setSize(300,300);

Window c=new Window(a);
c.setAlwaysOnTop(true);
c.setLayout(new FlowLayout());
c.setBackground(Color.DARK_GRAY);
c.add(b);
gd.setFullScreenWindow(c);
c.validate();
}
}


********************************************************************
JUST COMPILE AND EXECUTE IT
********************************************************************
Related Posts Plugin for WordPress, Blogger...