Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » My buttons are not shown in JFrame Fullscreen
My buttons are not shown in JFrame Fullscreen [message #838883] Sat, 07 April 2012 20:44
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 6
Registered: December 2011
Junior Member
I'm using the following code to create a fullscreen JFrame from my Eclipse plugin. The JFrame is shown, but I can't see my button. I have no idea why not. It works if I instantiate this class from a normal Java project.

public class MainFrame extends JFrame {
    
    	private static final long serialVersionUID = 1L;
    
    	public MainFrame() {
    		super();
    			
    		createComponents();
    		setFullScreen();
    	
    		this.setVisible(true);
    	}
    	
    	private void createComponents() {
    		System.out.println("Create components");
    		JButton exit = new JButton("Exit");
    		
    		exit.setVisible(true);
    		exit.setBackground(Color.YELLOW);
    		exit.setSize(new Dimension(500, 500));
    		exit.addActionListener(new ActionListener() {
    			
    			@Override
    			public void actionPerformed(ActionEvent arg0) {
    				System.out.println("Exit by button");
    				System.exit(0);
    			}
    		});
    		
    		this.setBackground(Color.RED);
    		
    		
    		this.getContentPane().setLayout(new BorderLayout());
    		this.getContentPane().add(exit, BorderLayout.CENTER);
    	}
    	
    	private void setFullScreen() {
    		
    		this.setResizable(false);
    		this.setUndecorated(true);
    		this.setAlwaysOnTop(true);
    		
    		GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
    		GraphicsDevice[] devices = env.getScreenDevices();
    		
    		devices[0].setFullScreenWindow(this);
    	}
    	
    }
Previous Topic:Logging URLs that are loaded with the internal browser
Next Topic:Prompt user for an application to open a file with?
Goto Forum:
  


Current Time: Thu Mar 28 12:05:12 GMT 2024

Powered by FUDForum. Page generated in 0.04794 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top