如何从JFrame中仅删除“最大化”按钮?

问题描述:

我有一个 JFrame 并且想要删除最大化按钮。

I have a JFrame and want to remove the maximize button from that.

我编写了下面的代码,但它删除了最大化,最小化和关闭来自我的 JFrame

I wrote the code below, but it removed maximize, minimize, and close from my JFrame.

JFrame frame = new JFrame();
frame.add(kart);
frame.setUndecorated(true);
frame.setVisible(true);
frame.setSize(400, 400);

我只想从 JFrame $ c中删除最大化按钮$ c>。

使其无法调整大小:

frame.setResizable(false);

您仍然可以使用最小化和关闭按钮。

You will still have the minimize and close buttons.