Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FORKS CLASS:
- import java.awt.*;
- import javax.swing.JFrame;
- public class forks extends JFrame
- {
- public static void main(String args[])
- {
- DisplayMode dm = new DisplayMode(1000, 600, 16, DisplayMode.REFRESH_RATE_UNKNOWN);
- forks f = new forks();
- f.run(dm);
- }
- public void run(DisplayMode dm)
- {
- setBackground(Color.PINK);
- setForeground(Color.WHITE);
- setFont(new Font("Arial", Font.PLAIN, 52));
- spoons s = new spoons();
- try
- {
- s.setScreen(dm, this);
- try
- {
- Thread.sleep(5000);
- }catch(Exception ex){}
- }finally
- {
- s.restoreScreen();
- }
- }
- public void paint(Graphics g)
- {
- g.drawString("This is gonna be amazing.", 200, 200);
- }
- }
- SPOONS CLASS:
- import java.awt.*;
- import javax.swing.JFrame;
- public class spoons
- {
- private GraphicsDevice VideoCard;
- public spoons()
- {
- GraphicsEnvironment Environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
- VideoCard = Environment.getDefaultScreenDevice();
- }
- public void setScreen(DisplayMode dm, JFrame w)
- {
- w.setUndecorated(true);
- w.setResizable(false);
- VideoCard.setFullScreenWindow(w);
- if(dm != null && VideoCard.isDisplayChangeSupported())
- {
- try
- {
- VideoCard.setDisplayMode(dm);
- }catch(Exception e){}
- }
- }
- public Window getFullScreenWindow()
- {
- return VideoCard.getFullScreenWindow();
- }
- public void restoreScreen()
- {
- Window w = VideoCard.getFullScreenWindow();
- if(w != null)
- {
- w.dispose();
- }
- VideoCard.setFullScreenWindow(null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment