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

Similar Threads
thread Thread Starter Forum Replies Last Post
Some apps prompt to install Java 6 even when Java 7 is installed MacMan988 OS X Mavericks (10.9) 1 Apr 18, 2014 07:56 AM
Java 6 or Java 7 for OSX Mavericks for your Macbook Pro? Starfyre MacBook Pro 3 Dec 22, 2013 03:49 PM
Java 6.x security risk (?) vs Java 7.x and broken apps w/ v7.x installs? mgiamo Mac Basics and Help 1 Dec 15, 2013 03:48 PM
Chrome on OS X -- Java plugin / Java 7 vs Java 6 Issue booyahbooyah Mac Applications and Mac App Store 4 May 31, 2013 09:13 AM
Installed Java 7.07 but doesn't show up in Java preferences? -mattias- OS X 10.8 Mountain Lion 21 Aug 31, 2012 04:49 PM

Forum Jump

All times are GMT -5. The time now is 08:50 AM.

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

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