public final class TLcyFullScreenActiveSettable extends ALcyActiveSettable
ILcyActiveSettable
implementation which allows to show a Swing component in a full-screen view.
When activating the active settable:
setting it as value
for the
Action.ACCELERATOR_KEY
key.
When de-activating the full screen mode:
If needed, you can add an explicit button to your UI to leave full screen mode and go back to regular mode.
Your button simply needs to call setActive(false)
.
For example:
final TLcyFullScreenActiveSettable as = new TLcyFullScreenActiveSettable( ... );
JButton exitButton = new JButton("Exit full screen");
exitButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
as.setActive(false);
}
});
By monitoring the "active" state of the active settable, you can also auto show and hide the exit button. For example:
final TLcyFullScreenActiveSettable as = new TLcyFullScreenActiveSettable( ... );
final JButton exitButton = new JButton("Exit full screen");
exitButton.setVisible(as.isActive());
as.addPropertyChangeListener(new PropertyChangeListener(){
@Override
public void propertyChange(PropertyChangeEvent e){
if ("active".equals(e.getPropertyName())){
exitButton.setVisible((Boolean)e.getNewValue());
}
}
});
Note: it is not recommended to use this class on OS X.
To offer the least surprise to the end user of your application, it is better to use the OS X specific full screen
support.
See com.apple.eawt.FullScreenUtilities
for more information.
DEFAULT, LONG_DESCRIPTION, NAME, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, SMALL_SELECTED_ICON, VISIBLE
Constructor and Description |
---|
TLcyFullScreenActiveSettable(Component aFullScreenComponent,
Object aComponentLayoutConstraints,
ILcyLucyEnv aLucyEnv)
Creates a new active settable which can show
aFullScreenComponent in full-screen mode. |
Modifier and Type | Method and Description |
---|---|
boolean |
isActive()
Returns true if the state of this object is active, false if the state is inactive.
|
void |
setActive(boolean aActive)
Sets the active state of this object.
|
addPropertyChangeListener, firePropertyChange, getDisplayName, getIcon, getLongDescription, getName, getShortDescription, getValue, isEnabled, putValue, removePropertyChangeListener, setDisplayName, setEnabled, setIcon, setLongDescription, setName, setShortDescription
public TLcyFullScreenActiveSettable(Component aFullScreenComponent, Object aComponentLayoutConstraints, ILcyLucyEnv aLucyEnv)
aFullScreenComponent
in full-screen mode.aFullScreenComponent
- The component which will be displayed in full-screen mode
when activating this active settable.aComponentLayoutConstraints
- The layout constraints which should be used when aFullScreenComponent
is
re-added to its parent container when leaving full screen view.
This can for example be BorderLayout.CENTER
;aLucyEnv
- The Lucy back-endpublic boolean isActive()
ILcyActiveSettable
ILcyActiveSettable.setActive(boolean)
).ILcyActiveSettable.setActive(boolean)
public void setActive(boolean aActive)
ILcyActiveSettable
aActive
- True if the new state is active, false if the new state is inactive.ILcyActiveSettable.isActive()