You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Patrik Karlström <pa...@trixon.se> on 2018/05/11 04:32:30 UTC
[PLATFORM] Listening to Show Only Editor changes
Hi,
How do I listen to Show Only Editor changes and at the same time, get the
state it's in?
My primary need is to do this from a TopComponent that needs to adapt to
the changes, but I'm also intereseted in a more 'global scope',
(WindowManager?).
-Patrik
Re: [PLATFORM] Listening to Show Only Editor changes
Posted by Patrik Karlström <pa...@trixon.se>.
Den fre 11 maj 2018 kl 06:32 skrev Patrik Karlström <pa...@trixon.se>:
> Hi,
> How do I listen to Show Only Editor changes and at the same time, get the
> state it's in?
>
Inspired by the source of
https://github.com/apache/incubator-netbeans/blob/master/core.windows/src/org/netbeans/core/windows/EditorOnlyDisplayer.java
I came up with this piece of code for my top component that got me the
result I wanted.
addHierarchyListener((HierarchyEvent e) -> {
if (e.getChangedParent() instanceof JLayeredPane) {
Dimension d = ((JFrame)
WindowManager.getDefault().getMainWindow()).getContentPane().getPreferredSize();
final boolean showOnlyEditor = 1 == d.height && 1 ==
d.width;
if (showOnlyEditor) {
} else {
}
}
});