Results 1 to 2 of 2
  1. #1
    devunion is offline Member
    Join Date
    Jun 2008
    Posts
    56
    Rep Power
    0

    Default Fullscreen mode problems

    Hello all, I've tried to create simple fullscreen app in Java. And I have some problems with it. Take a look at dialog which need to be displayed above the form. Try to drag it. (I've tested on JDK 5 and 6) Does it possible to fix such problems at all?

    Java Code:
    import javax.swing.*;
    import java.awt.*;
    
    /**
     * @author Victar Liaskovich
     */
    public class Fullscreen {
    
        public static void main(String[] args) throws Exception {
            System.out.println("Probando Full Screen...");
            JFrame fr = new JFrame();
            fr.setTitle("Test Title");
            fr.getContentPane().add(new JLabel("Test content"));
            fr.setResizable(false);
    //        fr.setPreferredSize(new Dimension(1024, 768));
    //        fr.pack();
    
            if (!fr.isDisplayable()) {
                fr.setUndecorated(true);
            }
            GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
            gd.setFullScreenWindow(fr);
            fr.setVisible(true);
    
            MyDialog dlg = new MyDialog(fr);
            dlg.setLocationRelativeTo(fr);
            dlg.setVisible(true);
    
    
            Thread.sleep(10000);
            System.exit(0);
        }
    
        static class MyDialog extends JDialog {
            MyDialog(Frame frame) throws HeadlessException {
                super(frame, "Parent dialog", false);
    
                initComponents();
                setPreferredSize(new Dimension(640, 480));
                pack();
            }
    
            private void initComponents() {
                JPanel panel = new JPanel(new FlowLayout(0, 0, FlowLayout.CENTER));
    
                JButton jButton = new JButton("Show dialog");
    
                panel.add(jButton);
    
                getContentPane().setLayout(new BorderLayout());
                getContentPane().add(panel, BorderLayout.NORTH);
            }
        }
    }
    Thanks.
    Try Controls4J - Advanced Swing Components.

  2. #2
    faisalcmpm is offline Member
    Join Date
    Feb 2009
    Posts
    22
    Rep Power
    0

    Default

    instead of
    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice();
    gd.setFullScreenWindow(fr);

    try
    fr.setSize(Toolkit.getDefaultToolkit().getScreenSi ze());

Similar Threads

  1. Finding the Mode in An Array
    By carlodelmundo in forum New To Java
    Replies: 23
    Last Post: 10-31-2010, 12:44 PM
  2. Setting JPanel to a fullscreen
    By hitmen in forum New To Java
    Replies: 3
    Last Post: 03-15-2009, 04:27 PM
  3. How to enable debug mode in eclipse
    By msgbharath in forum New To Java
    Replies: 3
    Last Post: 01-10-2009, 02:20 AM
  4. Replies: 1
    Last Post: 12-21-2008, 11:24 PM
  5. [SOLVED] Array Mode Problem
    By Banjo in forum New To Java
    Replies: 6
    Last Post: 12-09-2008, 04:35 AM

Posting Permissions

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