import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.Invalidatable;
import net.sf.openrocket.util.MemoryManagement;
-import net.sf.openrocket.util.Prefs;
public class GUIUtil {
private static final LogHelper log = Application.getLogger();
}
-
-
+
+
/**
* Set suitable options for a single-use disposable dialog. This includes
* setting ESC to close the dialog, adding the appropriate window icons and
}
-
+
/**
* Add the correct action to close a JDialog when the ESC key is pressed.
* The dialog is closed by sending is a WINDOW_CLOSING event.
}
-
+
/**
* Change the behavior of a component so that TAB and Shift-TAB cycles the focus of
* the components. This is necessary for e.g. <code>JTextArea</code>.
}
-
+
/**
* Set the OpenRocket icons to the window icons.
*
}
-
+
/**
* Set the best available look-and-feel into use.
*/
}
-
+
/**
* Automatically remember the size of a window. This stores the window size in the user
* preferences when resizing/maximizing the window and sets the state on the first call.
@Override
public void componentResized(ComponentEvent e) {
log.debug("Storing size of " + window.getClass().getName() + ": " + window.getSize());
- ((Prefs) Application.getPreferences()).setWindowSize(window.getClass(), window.getSize());
+ ((SwingPreferences) Application.getPreferences()).setWindowSize(window.getClass(), window.getSize());
if (window instanceof JFrame) {
if ((((JFrame) window).getExtendedState() & JFrame.MAXIMIZED_BOTH) == JFrame.MAXIMIZED_BOTH) {
log.debug("Storing maximized state of " + window.getClass().getName());
- ((Prefs) Application.getPreferences()).setWindowMaximized(window.getClass());
+ ((SwingPreferences) Application.getPreferences()).setWindowMaximized(window.getClass());
}
}
}
});
- if (((Prefs) Application.getPreferences()).isWindowMaximized(window.getClass())) {
+ if (((SwingPreferences) Application.getPreferences()).isWindowMaximized(window.getClass())) {
if (window instanceof JFrame) {
((JFrame) window).setExtendedState(JFrame.MAXIMIZED_BOTH);
}
} else {
- Dimension dim = ((Prefs) Application.getPreferences()).getWindowSize(window.getClass());
+ Dimension dim = ((SwingPreferences) Application.getPreferences()).getWindowSize(window.getClass());
if (dim != null) {
window.setSize(dim);
}
window.addComponentListener(new ComponentAdapter() {
@Override
public void componentMoved(ComponentEvent e) {
- ((Prefs) Application.getPreferences()).setWindowPosition(window.getClass(), window.getLocation());
+ ((SwingPreferences) Application.getPreferences()).setWindowPosition(window.getClass(), window.getLocation());
}
});
// Set window position according to preferences, and set prefs when moving
- Point position = ((Prefs) Application.getPreferences()).getWindowPosition(window.getClass());
+ Point position = ((SwingPreferences) Application.getPreferences()).getWindowPosition(window.getClass());
if (position != null) {
window.setLocationByPlatform(false);
window.setLocation(position);
}
-
+
/**
* Traverses recursively the component tree, and sets all applicable component
* models to null, so as to remove the listener connections. After calling this
}
-
+
/**
* A mouse listener that toggles the state of a boolean value in a table model
* when clicked on another column of the table.