Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 11, 2007, 10:41 AM   #1
whitehexagon
macrumors regular
 
Join Date: May 2007
Fullscreen Java

I've noticed a problem with Java fullscreen on OSX. If I try to display any kind of popup during full screen mode, the whole screen just goes black. This work on windows, solaris and linux. Any tips for OSX please?
whitehexagon is offline   0 Reply With Quote
Old Mar 4, 2009, 09:22 AM   #2
duncanj
macrumors newbie
 
Join Date: Mar 2009
JComboBox in OSX fullscreen mode

I have exactly the same problem. Whenever I click on a JComboBox (dropdown) the screen goes completely black and the window ceases to respond to mouse or keyboard events.

I see this problem with OSX 10.4.11 and java 1.5.0_16. It happens whether I choose the Aqua (native) look and feel or the cross-platform (Metal) look and feel.


SSCE:

Code:
import java.awt.DisplayMode;
import java.awt.FlowLayout;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class FullScreenTest {
    
    public FullScreenTest() {
    }
    
    public static void main(String[] args) {

        // bug happens with both native and cross-plaform (Metal) look and feels.
        
//        String laf = UIManager.getSystemLookAndFeelClassName();
        String laf = UIManager.getCrossPlatformLookAndFeelClassName();
        try {
            UIManager.setLookAndFeel(laf);
        } catch (Exception e) {
        }
        
        final JFrame frame = new JFrame("FullScreenTest");
        frame.getContentPane().setLayout(new FlowLayout());
        frame.getContentPane().add(new JComboBox(new String[]{"One", "Two", "Three"}));
        JButton quit = new JButton("Quit");
        quit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                frame.dispose();
            }});
        frame.getContentPane().add(quit);
        frame.setUndecorated(true);
        
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gs = ge.getDefaultScreenDevice();
        
        try {                
            gs.setFullScreenWindow( frame );
            DisplayMode dm = gs.getDisplayMode();
            frame.setVisible(true);
        } catch (Exception e){
            System.err.println("Exception: "+e);
            gs.setFullScreenWindow(null);                
        }

        while( frame.isVisible() ) {
            try { Thread.currentThread().sleep(1000); } catch( InterruptedException e ) { }                
        }

        gs.setFullScreenWindow(null);
    }
}
duncanj is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Java Applet not working on Lion jake4ever Mac OS X 10.7 Lion 19 Feb 1, 2013 09:44 AM
Fullscreen Video causes a return to the "sign in menu" zachleon11 MacBook Pro 5 Nov 17, 2011 10:57 AM
Safari/Quicktime video - fullscreen - screen dims and turns off - solution? jdavtz Mac Applications and Mac App Store 3 Mar 10, 2011 09:19 AM
Using accessors in Java constructors (marc) Mac Programming 4 Dec 3, 2010 09:37 AM
Small Java Problem finnschi Mac Programming 9 Nov 25, 2010 04:26 PM


All times are GMT -5. The time now is 01:55 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC