Disabling the maximize-icon in a JFrame

First thing you can try is changing the resizable property from the Frame class:

 
import javax.swing.*;
import java.awt.*;
  
public class DisableMax extends JFrame {
 
   public DisableMax() {
      setSize(100, 100);

      setResizable(false);
   }
 
   public static void main(String args[]) {
      new DisableMax().setVisible(true);     
   }
}

However, in this example the maximize icons will still be there. Moreover, the frame will not be resizable anymore (might not be the functionality you want!).
Extend from a JDialog instead and your window will only have the X icon visible.

 
import javax.swing.*;
import java.awt.*;
   
public class DisableMax2 extends JDialog {
 
   public DisableMax2() {
      setSize(100, 100);
 
      setResizable(false);
   }
 
   public static void main(String args[]) {
      new DisableMax2().setVisible(true);     
   }
}