Results 1 to 7 of 7
  1. #1
    tmparisi is offline Member
    Join Date
    May 2011
    Posts
    4
    Rep Power
    0

    Default Hide taskbar and make window full screen

    I would like to be able to make my application go completely full screen when it is run. This means that the windows taskbar/startbar should not be viewable and the window buttons (minimize, maximize, close) should also not be available. I want to keep employees from exiting out of the application and/or clicking on anything in the start bar. My current code looks like:

    Java Code:
    	public void start() {
    		try {
    			PlasticXPLookAndFeel.setMyCurrentTheme(new ExperienceBlue());
    			UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
    			//UIManager.setLookAndFeel(new javax.swing.plaf.nimbus.NimbusLookAndFeel());
    			UIManager.put("ComboBox.is3DEnabled", Boolean.FALSE);
    		} catch (Exception e) {
    		}
    
    		rootView = RootView.getInstance();
    
    		TransparentPanel panel = new TransparentPanel(new BorderLayout());
    		panel.setOpaque(true);
    		panel.add(rootView);
    
    		posWindow.setContentPane(panel);
    		posWindow.setSize(ApplicationConfig.getPreferences().getInt("wwidth", 900), ApplicationConfig.getPreferences().getInt("wheight", 650));
    		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    		posWindow.setLocation(ApplicationConfig.getPreferences().getInt("wlocx", ((screenSize.width - posWindow.getWidth()) >> 1)), ApplicationConfig.getPreferences().getInt("wlocy", ((screenSize.height - posWindow.getHeight()) >> 1)));
    		posWindow.setMinimumSize(new Dimension(800, 600));
    		posWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    		posWindow.setVisible(true);
    
    		initDatabase();
    	}

  2. #2
    Solarsonic is offline Senior Member
    Join Date
    Mar 2011
    Posts
    261
    Rep Power
    4

    Default

    What's the error/problem?

  3. #3
    tmparisi is offline Member
    Join Date
    May 2011
    Posts
    4
    Rep Power
    0

    Default

    No error, just want to be able to hide the taskbar and the minimize/maximize/close buttons.

    I added:

    Java Code:
    posWindow.setUndecorated(true);
    to get rid of the frame buttons (minimize/maximize/close buttons) and now I need to figure out how to hide the taskbar, this way the program is effectively showing full screen.

    Current code is as follows:

    Java Code:
    private Application() {
    		applicationIcon = new ImageIcon(getClass().getResource("/icons/icon.png"));
    		posWindow = new PosWindow();
                    //Get rid of minimize,maximize,close buttons
                    posWindow.setUndecorated(true);
    		posWindow.setGlassPaneVisible(true);
    		posWindow.setTitle(getTitle());
    		posWindow.setIconImage(applicationIcon.getImage());
    		posWindow.addWindowListener(new WindowAdapter() {
    			public void windowClosing(WindowEvent e) {
    				shutdownPOS();
    				
    			}
    		});
    	}
    
    	public void start() {
    		try {
    			PlasticXPLookAndFeel.setMyCurrentTheme(new ExperienceBlue());
    			UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
    			//UIManager.setLookAndFeel(new javax.swing.plaf.nimbus.NimbusLookAndFeel());
    			UIManager.put("ComboBox.is3DEnabled", Boolean.FALSE);
    		} catch (Exception e) {
    		}
    
    		rootView = RootView.getInstance();
    
    		TransparentPanel panel = new TransparentPanel(new BorderLayout());
    		panel.setOpaque(true);
    		panel.add(rootView);
    
    		posWindow.setContentPane(panel);
    		posWindow.setSize(ApplicationConfig.getPreferences().getInt("wwidth", 900), ApplicationConfig.getPreferences().getInt("wheight", 650));
    		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    		posWindow.setLocation(ApplicationConfig.getPreferences().getInt("wlocx", ((screenSize.width - posWindow.getWidth()) >> 1)), ApplicationConfig.getPreferences().getInt("wlocy", ((screenSize.height - posWindow.getHeight()) >> 1)));
    		posWindow.setMinimumSize(new Dimension(800, 600));
    		posWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    		posWindow.setVisible(true);
    
    		initDatabase();
    	}

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

  5. #5
    tmparisi is offline Member
    Join Date
    May 2011
    Posts
    4
    Rep Power
    0

    Default

    Thanks, that seems to work except it causes 1 problem now:

    I have a shutdown button that displays an 'are you sure?' type message.

    Java Code:
    public void shutdownPOS() {
    		int option = JOptionPane.showOptionDialog(getPosWindow(), com.floreantpos.POSConstants.SURE_SHUTDOWN_, com.floreantpos.POSConstants.CONFIRM_SHUTDOWN, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
    		if(option != JOptionPane.YES_OPTION) {
    			return;
    		}
    		
    		int width = posWindow.getWidth();
    		int height = posWindow.getHeight();
    		ApplicationConfig.getPreferences().putInt("wwidth", width);
    		ApplicationConfig.getPreferences().putInt("wheight", height);
    
    		Point locationOnScreen = posWindow.getLocationOnScreen();
    		ApplicationConfig.getPreferences().putInt("wlocx", locationOnScreen.x);
    		ApplicationConfig.getPreferences().putInt("wlocy", locationOnScreen.y);
    
    		System.exit(0);
    	}
    When I click the 'shutdown' button now, the entire application minimizes into the taskbar. Once I click on its icon in the taskbar to bring it back up, the shutdown verification message is displayed.

    Any idea why the entire application is minimizing?

    My current code for the window looks like:

    Java Code:
    private Application() {
    		applicationIcon = new ImageIcon(getClass().getResource("/icons/icon.png"));
    		posWindow = new PosWindow();
                    
                    
                    
                    //Get rid of minimize,maximize,close buttons
                    posWindow.setUndecorated(true);
                    posWindow.setResizable(false);
                    GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(posWindow); //Delete
                    //posWindow.setVisible(true); //delete
                    posWindow.setGlassPaneVisible(true);
    		posWindow.setTitle(getTitle());
    		posWindow.setIconImage(applicationIcon.getImage());
    		posWindow.addWindowListener(new WindowAdapter() {
    			public void windowClosing(WindowEvent e) {
    				shutdownPOS();
    				
    			}
    		});
    	}
    
    	public void start() {
    		try {
    			PlasticXPLookAndFeel.setMyCurrentTheme(new ExperienceBlue());
    			UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
    			//UIManager.setLookAndFeel(new javax.swing.plaf.nimbus.NimbusLookAndFeel());
    			UIManager.put("ComboBox.is3DEnabled", Boolean.FALSE);
    		} catch (Exception e) {
    		}
    
    		rootView = RootView.getInstance();
    
    		TransparentPanel panel = new TransparentPanel(new BorderLayout());
    		panel.setOpaque(true);
    		panel.add(rootView);
    
    		posWindow.setContentPane(panel);
    		
    		posWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    		posWindow.setVisible(true);
    
    		initDatabase();
    	}
    Please help!

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default

    Well, there's a reason behind the word exclusive in the description of the API.

    Exit full screen mode before you attempt to show the dialog.

    db

  7. #7
    tmparisi is offline Member
    Join Date
    May 2011
    Posts
    4
    Rep Power
    0

    Default

    db: So there is no other way to accomplish this full screen task besides this API? Unfortunately the open source application that I am customizing uses far too many dialogs, and using this full screen method makes the application unusable.

    Is it better that I just hide the taskbar an then increase the size of the window? If so, how would this be accomplished, and small examples would be very much appreciated!

Similar Threads

  1. Replies: 7
    Last Post: 08-19-2010, 02:56 PM
  2. Full Screen window over toolbar
    By vmcg in forum AWT / Swing
    Replies: 3
    Last Post: 07-10-2010, 04:43 AM
  3. Full-Screen Window is not supporting KeyListener
    By AnOdeToCode in forum Java 2D
    Replies: 1
    Last Post: 02-13-2009, 09:08 PM
  4. XTerm window appearing in full screen swing app
    By clarose in forum AWT / Swing
    Replies: 1
    Last Post: 11-17-2008, 11:56 PM
  5. Hide Object in the Taskbar when Frame is down to Tray
    By hannehomuth in forum Advanced Java
    Replies: 2
    Last Post: 07-12-2008, 07:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •