Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package core;
- import java.awt.*;
- import javax.swing.JFrame;
- public class Screen {
- private GraphicsDevice vc;
- public Screen(){
- GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
- vc = env.getDefaultScreenDevice();
- }
- public void setScreenSize(DisplayMode dm, JFrame window) {
- window.setUndecorated(false);
- window.setResizable(false);
- window.setSize(800, 600);
- if (dm !=null && vc.isDisplayChangeSupported()){
- try{
- vc.setDisplayMode(dm);
- }catch(Exception ex){
- }
- }
- }
- public Window getWindow(){
- return vc.getFullScreenWindow();
- }
- public void RestoreScreen(){
- Window w = vc.getFullScreenWindow();
- if(w != null){
- w.dispose();
- }
- vc.setFullScreenWindow(null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment