本文整理汇总了Java中sun.awt.SunToolkit.checkAndSetPolicy方法的典型用法代码示例。如果您正苦于以下问题:Java SunToolkit.checkAndSetPolicy方法的具体用法?Java SunToolkit.checkAndSetPolicy怎么用?Java SunToolkit.checkAndSetPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.awt.SunToolkit
的用法示例。
在下文中一共展示了SunToolkit.checkAndSetPolicy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import sun.awt.SunToolkit; //导入方法依赖的package包/类
private void init(GraphicsConfiguration gc) {
GraphicsEnvironment.checkHeadless();
syncLWRequests = systemSyncLWRequests;
weakThis = new WeakReference<Window>(this);
addToWindowList();
setWarningString();
this.cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
this.visible = false;
gc = initGC(gc);
if (gc.getDevice().getType() !=
GraphicsDevice.TYPE_RASTER_SCREEN) {
throw new IllegalArgumentException("not a screen device");
}
setLayout(new BorderLayout());
/* offset the initial location with the original of the screen */
/* and any insets */
Rectangle screenBounds = gc.getBounds();
Insets screenInsets = getToolkit().getScreenInsets(gc);
int x = getX() + screenBounds.x + screenInsets.left;
int y = getY() + screenBounds.y + screenInsets.top;
if (x != this.x || y != this.y) {
setLocation(x, y);
/* reset after setLocation */
setLocationByPlatform(locationByPlatformProp);
}
modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
disposerRecord = new WindowDisposerRecord(appContext, this);
sun.java2d.Disposer.addRecord(anchor, disposerRecord);
SunToolkit.checkAndSetPolicy(this);
}
示例2: readObject
import sun.awt.SunToolkit; //导入方法依赖的package包/类
private void readObject(ObjectInputStream s)
throws ClassNotFoundException, IOException, HeadlessException
{
GraphicsEnvironment.checkHeadless();
java.io.ObjectInputStream.GetField fields =
s.readFields();
ModalityType localModalityType = (ModalityType)fields.get("modalityType", null);
try {
checkModalityPermission(localModalityType);
} catch (AccessControlException ace) {
localModalityType = DEFAULT_MODALITY_TYPE;
}
// in 1.5 or earlier modalityType was absent, so use "modal" instead
if (localModalityType == null) {
this.modal = fields.get("modal", false);
setModal(modal);
} else {
this.modalityType = localModalityType;
}
this.resizable = fields.get("resizable", true);
this.undecorated = fields.get("undecorated", false);
this.title = (String)fields.get("title", "");
blockedWindows = new IdentityArrayList<>();
SunToolkit.checkAndSetPolicy(this);
initialized = true;
}
示例3: init
import sun.awt.SunToolkit; //导入方法依赖的package包/类
private void init(String title, GraphicsConfiguration gc) {
this.title = title;
SunToolkit.checkAndSetPolicy(this);
}
示例4: Dialog
import sun.awt.SunToolkit; //导入方法依赖的package包/类
/**
* Constructs an initially invisible <code>Dialog</code> with the
* specified owner <code>Window</code>, title and modality.
*
* @param owner the owner of the dialog. The owner must be an instance of
* {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any
* of their descendents or <code>null</code>
* @param title the title of the dialog or <code>null</code> if this dialog
* has no title
* @param modalityType specifies whether dialog blocks input to other
* windows when shown. <code>null</code> value and unsupported modality
* types are equivalent to <code>MODELESS</code>
*
* @exception java.lang.IllegalArgumentException if the <code>owner</code>
* is not an instance of {@link java.awt.Dialog Dialog} or {@link
* java.awt.Frame Frame}
* @exception java.lang.IllegalArgumentException if the <code>owner</code>'s
* <code>GraphicsConfiguration</code> is not from a screen device
* @exception HeadlessException when
* <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code>
* @exception SecurityException if the calling thread does not have permission
* to create modal dialogs with the given <code>modalityType</code>
*
* @see java.awt.Dialog.ModalityType
* @see java.awt.Dialog#setModal
* @see java.awt.Dialog#setModalityType
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Toolkit#isModalityTypeSupported
*
* @since 1.6
*/
public Dialog(Window owner, String title, ModalityType modalityType) {
super(owner);
if ((owner != null) &&
!(owner instanceof Frame) &&
!(owner instanceof Dialog))
{
throw new IllegalArgumentException("Wrong parent window");
}
this.title = title;
setModalityType(modalityType);
SunToolkit.checkAndSetPolicy(this);
initialized = true;
}
示例5: Dialog
import sun.awt.SunToolkit; //导入方法依赖的package包/类
/**
* Constructs an initially invisible {@code Dialog} with the
* specified owner {@code Window}, title and modality.
*
* @param owner the owner of the dialog. The owner must be an instance of
* {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any
* of their descendants or {@code null}
* @param title the title of the dialog or {@code null} if this dialog
* has no title
* @param modalityType specifies whether dialog blocks input to other
* windows when shown. {@code null} value and unsupported modality
* types are equivalent to {@code MODELESS}
*
* @exception java.lang.IllegalArgumentException if the {@code owner}
* is not an instance of {@link java.awt.Dialog Dialog} or {@link
* java.awt.Frame Frame}
* @exception java.lang.IllegalArgumentException if the {@code owner}'s
* {@code GraphicsConfiguration} is not from a screen device
* @exception HeadlessException when
* {@code GraphicsEnvironment.isHeadless()} returns {@code true}
* @exception SecurityException if the calling thread does not have permission
* to create modal dialogs with the given {@code modalityType}
*
* @see java.awt.Dialog.ModalityType
* @see java.awt.Dialog#setModal
* @see java.awt.Dialog#setModalityType
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Toolkit#isModalityTypeSupported
*
* @since 1.6
*/
public Dialog(Window owner, String title, ModalityType modalityType) {
super(owner);
if ((owner != null) &&
!(owner instanceof Frame) &&
!(owner instanceof Dialog))
{
throw new IllegalArgumentException("Wrong parent window");
}
this.title = title;
setModalityType(modalityType);
SunToolkit.checkAndSetPolicy(this);
initialized = true;
}