English 中文(简体)
如何改变 Java 中已有 JFrame 窗口的 SetAlways OnTop () 属性?
原标题:How can I change the setAlwaysOnTop() property of an existing JFrame window in Java?

我有一个方法窗口Frame (), 它扩展了 Jframe, 并为我的程序设置了 GUI, 在主方法中的例子就是 MyFrame 。 默认情况下它设置了 AlwaysOnTop( false) 。 但是在窗口Frame () 方法中, 我有一个 JcheckBox 方法, 我想用它来将上面的属性变真或变假。 我的问题是, 我怎样才能对已经存在的 MyFrame 窗口 GUI 进行这样的操作?

我拥有听众和所有东西, 但我只是不知道如何在主方法中提及我的Frame窗口, 因为 JcheckBox 和听众在窗口Frame () 方法中, 但这个例子当然是他们外部的。 我尝试了使用这个。 setAlwaysOnTop( true), 并且只是设置了“ 永远OnTop( true) ” ( true), 但当然这行不通 。

补充信息:所有东西都包裹在同一个主类中,我只需要一个窗口的例子。

问题回答
  • 如果< a href=> http://docs.oracle.com/javase/tumentive/uiswing/upports/frame.html' rel=“nofollow” >JFrame 没有肮脏的黑客,则无法做到这一点。

  • 您必须使用适当的容器, 然后您可以看到 < a href=> http://docs. oracle.com/javase/tumental/ uiswing/tument/ uiswing/ partments/ dialog.html" rel= “ no follow” > JDialog , 方法 < a href=" http://docs. oracle.com/javase/7/ api/java/awt/ Window.html# setAlwaysOnTop% 28boolean% 29" rel=“ no follow” > JJalog# set AlwaysOnTop( bolean always OnTop)





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签