JFrame Maximize window
问题 I'm putting together a quick and dirty animation using swing. I would like the window to be maximized. How can I do that? 回答1: Provided that you are extending JFrame: public void run() { MyFrame myFrame = new MyFrame(); myFrame.setVisible(true); myFrame.setExtendedState(myFrame.getExtendedState() | JFrame.MAXIMIZED_BOTH); } 回答2: Something like this.setExtendedState(this.getExtendedState() | this.MAXIMIZED_BOTH); import java.awt.*; import javax.swing.*; public class Test extends JFrame {