Top panel is shown over full Screen window for Java Apps

Bug #898121 reported by Vitaliy Lagutin
44
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Unity
Confirmed
Low
Unassigned
unity (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

When I try to use this simple Java code which fill screen by red color. At the top of the screen still view Unity panel (like Gnome panel).

// Code example

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.KeyStroke;

public class ScreenTest extends JFrame {

 ScreenTest() {
  setUndecorated(true);
  setResizable(false);

  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  add(new TestPanel(screenSize));

        // Close application when pressed Esc
        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
             KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "Cancel");
  getRootPane().getActionMap().put("Cancel", new AbstractAction(){
            public void actionPerformed(ActionEvent e) {
             setVisible(false);
                System.exit(0);
            }
        });
 }

 public static void main(String[] args) {
  GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
  ScreenTest frame = new ScreenTest();
  device.setFullScreenWindow(frame);
  frame.setVisible(true);
 }
}

class TestPanel extends JPanel {

 Dimension screenSize;

 TestPanel(Dimension screenSize) {
  this.screenSize = screenSize;
  setOpaque(true);
  setBackground(Color.BLACK);
  setBorder(BorderFactory.createEmptyBorder());
  setPreferredSize(screenSize);
 }

 public void paintComponent(Graphics g) {
  super.paintComponent(g);
  g.setColor(Color.RED);
  g.fillRect(0, 0, screenSize.width, screenSize.height);
 }
}

Revision history for this message
Vitaliy Lagutin (lvitalii) wrote :
Revision history for this message
Marco Biscaro (marcobiscaro2112) wrote :

Confirmed. But I'm not sure this is a bug in unity or in openjdk. Smaller code that reproduces this bug:

import java.awt.Color;
import java.awt.GraphicsEnvironment;
import javax.swing.JFrame;

public class ScreenTest extends JFrame {

 ScreenTest() {
  setUndecorated(true);
  getContentPane().setBackground(Color.RED);
  setDefaultCloseOperation(EXIT_ON_CLOSE);
  setVisible(true);
 }

 public static void main(String[] args) {
  GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(new ScreenTest());
 }

}

Changed in unity:
status: New → Confirmed
Changed in unity (Ubuntu):
status: New → Confirmed
summary: - Full Screen mode for Java Apps
+ Top panel is shown over full Screen window for Java Apps
Revision history for this message
Vitaliy Lagutin (lvitalii) wrote :

Yep. It's can be openjtk. I think about it.

And I see some another bug. I can't do screenshot with PrntScrn button or Alt+PrntScrn buttons when select one of the Eclipse main menu fields.
It's strange.
I don't know for which topic this bug.
Sorry:)

Omer Akram (om26er)
Changed in unity:
importance: Undecided → Low
Changed in unity (Ubuntu):
importance: Undecided → Low
Revision history for this message
samuel (samuel-h) wrote :

Yes this happens to me to, I have been having problems with graphics drivers recentely, and thought it might be something to do with them, however, it would appear it is actually a bug in unity, interestinglly unity2D is not affected.

Revision history for this message
Diego Estévez (dgmvecuador) wrote :

This happened to me too, and I think its related with Compiz because Unity2D is not affected. The Unity plugin maybe???

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and is a duplicate of bug 734908, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally, any further discussion regarding the bug should occur in the other report. Feel free to continue to report any other bugs you may find.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.