java(Swing)获取任务栏的高度

import java.awt.Insets;
import java.awt.Toolkit;

import javax.swing.JFrame;
public class TaskHeightTest extends JFrame{
	private static final long serialVersionUID = 6587866382008362321L;

	public static void main(String[] args) {
		TaskHeightTest t=new TaskHeightTest();
		//获取屏幕边界
		Insets   screenInsets   =   Toolkit.getDefaultToolkit().getScreenInsets(t.getGraphicsConfiguration()); 
		//取得底部边界高度,即任务栏高度
		int taskHeight=screenInsets.bottom;     
		     System.out.println(taskHeight);
	}

}
 

你可能感兴趣的:(swing)