How does one push a JInternalFrame
to the top of all the frames in a JDesktopPane?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
try grabFocus() and requestFocus(). One of the should work. I personally used only requestFocus().
The OP has noted that
setSelected
was not working, and he needed to callactivateFrame
manually. This sounds similar to an issue I was having withGTKLookAndFeel
. I had an application that was all wired up to usesetSelected
to eventually triggeractivateFrame
. Worked fine with Windows and Mac native look and feel;activateFrame
would get called automatically.On Ubuntu, the system selected LaF was
GTKLookAndFeel
and for whatever reason this was not callingactivateFrame
. It didn't appear thatsetSelected
was throwing an error or anything, it just wasn't getting around to callingactivateFrame
as the other LaFs seem to do. I think it's aGTKLookAndFeel
compatibility issue.In the end I punted on this and just prohibited
GTKLookAndFeel
, replacing it withMetal
.Motif
also had the compatible behavior (but it's so ugly...). The code looks something like this:Read the JInternalFrame API and follow the link to the Swing tutorial on "How to Use Internal Frames" where you will find a working example of how to "select" the active internal frame.
/*make current JInternalFrame deselected by calling JInternalFrame method setSelected(false)
*/then select new JInternalFrame using the same method; ie setSelected(true)
sample code:
try{ jframe1.setSelected(false); jframe2.setSelected(true); }catch (PropertyVetoException ex) {}
Closing a modal JInternalFrame see the post by Mr. Zen(me)
In this example, a
javax.swing.Action
is used to select frames from a menu.