As camickr has already said, would need to make a customized BasicInternalFrameTitlePane
:

import java.awt.*;
import java.util.Arrays;
import javax.swing.*;
import javax.swing.plaf.basic.*;
import javax.swing.plaf.metal.*;
public class InternalFrameTitlePaneTest {
public JInternalFrame makeInternalFrame() {
return new JInternalFrame("basic", true, true, true, true) {
@Override public void updateUI() {
super.updateUI();
setUI(new MetalInternalFrameUI(this) {
@Override protected JComponent createNorthPane(JInternalFrame w) {
BasicInternalFrameTitlePane p = new BasicInternalFrameTitlePane(w) {
@Override public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.height = 24;
return d;
}
@Override public void createButtons() {
super.createButtons();
Arrays.asList(closeButton, maxButton, iconButton).forEach(b -> {
b.setContentAreaFilled(false);
b.setBorder(BorderFactory.createEmptyBorder(2, 5, 2, 5));
});
}
};
p.setBorder(BorderFactory.createMatteBorder(
0, 0, 1, 0, MetalLookAndFeel.getPrimaryControlDarkShadow()));
return p;
}
});
}
};
}
public JComponent makeUI() {
JInternalFrame f1 = makeInternalFrame();
f1.setSize(150, 100);
f1.setLocation(0, 0);
f1.setVisible(true);
JInternalFrame f2 = new JInternalFrame("metal", true, true, true, true);
f2.setSize(150, 100);
f2.setLocation(80, 50);
f2.setVisible(true);
JDesktopPane desktop = new JDesktopPane();
desktop.add(f1);
desktop.add(f2);
return desktop;
}
public static void main(String[] args) {
EventQueue.invokeLater(() -> {
JFrame f = new JFrame();
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.getContentPane().add(new InternalFrameTitlePaneTest().makeUI());
f.setSize(320, 240);
f.setLocationRelativeTo(null);
f.setVisible(true);
});
}
}