Joe*_*han 28
如果您希望窗口只显示并且既没有标题栏也没有出现在任务栏中,请使用a JWindow
.
如果您希望窗口显示并具有标题栏但未显示在任务栏中,请使用a JDialog
.
Mas*_*dul 13
JDK 1.7为您提供方法setType.使用以下方法.
JFrame.setType(javax.swing.JFrame.Type.UTILITY)
Run Code Online (Sandbox Code Playgroud)
小智 5
"你所要做的就是将你的JFrame"type"属性设置为"UTILITY"并且你拥有它!"
这确实有效,至少在Java 1.7下,它与上面的"myframe".setType(Type.UTILITY)相同,而不是Type.POPUP.测试类型弹出窗口(在win 7下)无法从任务栏中删除它,Type.UTILITY可以.
未修饰将没有所需的结果(因为它从窗口中删除标题栏,而不是任务栏)
public class Window extends Container implements Accessible {
/**
* Enumeration of available <i>window types</i>.
*
* A window type defines the generic visual appearance and behavior of a
* top-level window. For example, the type may affect the kind of
* decorations of a decorated {@code Frame} or {@code Dialog} instance.
* <p>
* Some platforms may not fully support a certain window type. Depending on
* the level of support, some properties of the window type may be
* disobeyed.
*
* @see #getType
* @see #setType
* @since 1.7
*/
public static enum Type {
/**
* Represents a <i>normal</i> window.
*
* This is the default type for objects of the {@code Window} class or
* its descendants. Use this type for regular top-level windows.
*/
NORMAL,
/**
* Represents a <i>utility</i> window.
*
* A utility window is usually a small window such as a toolbar or a
* palette. The native system may render the window with smaller
* title-bar if the window is either a {@code Frame} or a {@code
* Dialog} object, and if it has its decorations enabled.
*/
UTILITY,
/**
* Represents a <i>popup</i> window.
*
* A popup window is a temporary window such as a drop-down menu or a
* tooltip. On some platforms, windows of that type may be forcibly
* made undecorated even if they are instances of the {@code Frame} or
* {@code Dialog} class, and have decorations enabled.
*/
POPUP
}
Run Code Online (Sandbox Code Playgroud)