⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 centereddialog.java

📁 java 调用windows的api
💻 JAVA
字号:
package org.jawin.browser.dialog;

import javax.swing.JDialog;
import java.awt.*;

/**
 * A dialog that centers itself on show
 *
 * <p>Title: Jawin Code Generation GUI</p>
 * <p>Description: GUI for exploring type libraries and generating Java code</p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: Open Source Incentive</p>
 * @author Josh Passenger
 * @version 1.0
 */

public class CenteredDialog extends JDialog
{
	public static final Dimension BUTTON_DIMENSION = new Dimension(75, 27);

	public CenteredDialog()
	{
		super();
	}

	public CenteredDialog(Frame owner)
	{
		super(owner);
	}

	public CenteredDialog(Frame owner, boolean modal)
	{
		super(owner, modal);
	}

	public CenteredDialog(Frame owner, String title, boolean modal)
	{
		super(owner, title, modal);
	}

	public CenteredDialog(Dialog owner, String title, boolean modal)
	{
		super(owner, title, modal);
	}

	public CenteredDialog(Frame owner, String title)
	{
		super(owner, title);
	}

	public void center()
	{
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		Dimension dialogSize = getSize();

		if (dialogSize.height > screenSize.height)
		{
			dialogSize.height = screenSize.height;
		}

		if (dialogSize.width > screenSize.width)
		{
			dialogSize.width = screenSize.width;
		}

		setLocation((screenSize.width - dialogSize.width) / 2, (screenSize.height - dialogSize.height) / 2);
	}

	public void show()
	{
		center();
		super.show();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -