JInternalFrameのタイトルバーと枠の長さを取得
JFrameだとgetInsets().topの中にタイトルバーの長さも含まれてるんですが、
JInternalFrameだとLook&Feel(これがまたややこしくて資料が少ない)っぽいのを使ってるぽくて
よく分からないんですけど、すこしめんどいことをしないと取得できないっぽいです。
・追記
http://blog.livedoor.jp/lalha_java/archives/50747986.html
Look&Feelはただのスキンのことでした。自作もできるらしいです。
Look&Feelを変更することによっていろんなスキンのウィンドウになるっぽいです。
import java.awt.*; import javax.swing.*; import javax.swing.plaf.basic.*; class InternalTest extends JFrame { JInternalFrame iframe; void p(Object o) { System.out.println(o); } public void paint(Graphics g) { super.paint(g); BasicInternalFrameUI ui = (BasicInternalFrameUI)iframe.getUI(); Component north = ui.getNorthPane(); // JInternalFrameのタイトルバーの高さを取得 p("titlebar height = " + north.getHeight()); // JInternalFrameのボーダーの長さを取得 Insets in = iframe.getInsets(); p("left = " + in.left + " right " + in.right); p("top = " + in.top + " bottom = " + in.bottom); } InternalTest() { JLabel label = new JLabel(new ImageIcon("test.png")); JDesktopPane desktop = new JDesktopPane(); iframe = new JInternalFrame(); iframe.add(label); iframe.pack(); desktop.add(iframe); add(desktop); setSize(640, 480); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); iframe.setVisible(true); } public static void main(String[] args) { new InternalTest(); }}