Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

class Demo
{
    JFrame jf;
    Demo()
    {
        jf=new JFrame("Demo");
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.setSize(5000,5000);
        jf.setVisible(true);
        System.out.println(jf.getSize());
    }
    public static void main(String[] args)
    {
        SwingUtilities.invokeLater(new Runnable()
        {

            @Override
            public void run()
            {
                new Demo();
            }
        });
    }
}

I use jf.setSize(5000, 5000) for JFrame but after that getSize returns other size: java.awt.Dimension[width=1386,height=788] (my screen resolution is 1366x768) Can I set frame size greater than screen size? probably such behaviour is provided with some frame properties but I don't know about them.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
201 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try using setPreferredSize instead of setSize. Works in my case (Ubuntu 12.04+GNOME 3).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...