Package megamek.client.ui.preferences
Class JWindowPreference
java.lang.Object
megamek.client.ui.preferences.PreferenceElement
megamek.client.ui.preferences.JWindowPreference
- All Implemented Interfaces:
ComponentListener,WindowStateListener,EventListener
public class JWindowPreference
extends PreferenceElement
implements ComponentListener, WindowStateListener
JWindowPreference monitors the size (width and height), location, and maximization state of a Window. It sets the
saved values when a dialog is loaded and changes them as they change.
Call preferences.manage(new JWindowPreference(Window)) to use this preference, on a Window that has called setName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidvoidprotected voiddispose()Cleans the preference resources.intintintprotected StringgetValue()Gets the current value for the preference.intgetWidth()protected voidinitialize(String value) Sets the initial value for the preference.booleanvoidsetHeight(int height) voidsetMaximized(boolean maximized) voidsetScreenX(int screenX) voidsetScreenY(int screenY) voidsetWidth(int width) voidMethods inherited from class megamek.client.ui.preferences.PreferenceElement
getName
-
Constructor Details
-
JWindowPreference
- Throws:
Exception
-
-
Method Details
-
getWeakReference
-
getWidth
public int getWidth() -
setWidth
public void setWidth(int width) -
getHeight
public int getHeight() -
setHeight
public void setHeight(int height) -
getScreenX
public int getScreenX() -
setScreenX
public void setScreenX(int screenX) -
getScreenY
public int getScreenY() -
setScreenY
public void setScreenY(int screenY) -
isMaximized
public boolean isMaximized() -
setMaximized
public void setMaximized(boolean maximized) -
getValue
Description copied from class:PreferenceElementGets the current value for the preference.- Specified by:
getValuein classPreferenceElement- Returns:
- the value of the preference.
-
initialize
Description copied from class:PreferenceElementSets the initial value for the preference.- Specified by:
initializein classPreferenceElement- Parameters:
value- initial value.- Throws:
Exception- if there's an error during initialization
-
dispose
protected void dispose()Description copied from class:PreferenceElementCleans the preference resources.- Specified by:
disposein classPreferenceElement
-
componentResized
- Specified by:
componentResizedin interfaceComponentListener
-
componentMoved
- Specified by:
componentMovedin interfaceComponentListener
-
componentShown
- Specified by:
componentShownin interfaceComponentListener
-
componentHidden
- Specified by:
componentHiddenin interfaceComponentListener
-
windowStateChanged
- Specified by:
windowStateChangedin interfaceWindowStateListener
-