mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-21 22:52:22 +00:00
FindGUI command
Added terminal command to force GUI back onto primary monitor
This commit is contained in:
parent
42bbf86f5a
commit
c3c31c3312
@ -42,6 +42,7 @@ public abstract class CommandManager extends PamControlledUnit {
|
||||
commandsList.add(new SetXMLSettings());
|
||||
commandsList.add(new BatchStatusCommand());
|
||||
commandsList.add(new BatchCommand(this));
|
||||
commandsList.add(new FindGUICommand());
|
||||
|
||||
}
|
||||
|
||||
|
27
src/PamController/command/FindGUICommand.java
Normal file
27
src/PamController/command/FindGUICommand.java
Normal file
@ -0,0 +1,27 @@
|
||||
package PamController.command;
|
||||
|
||||
import PamController.PamController;
|
||||
import PamView.GuiFrameManager;
|
||||
|
||||
public class FindGUICommand extends ExtCommand {
|
||||
|
||||
public FindGUICommand() {
|
||||
super("findgui", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String execute(String command) {
|
||||
GuiFrameManager frameManager = PamController.getInstance().getGuiFrameManager();
|
||||
if (frameManager == null) {
|
||||
return "No GUI to move";
|
||||
}
|
||||
frameManager.findGUI();
|
||||
return "GUI Moved";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return "Move GUI components to the main monitor";
|
||||
}
|
||||
|
||||
}
|
@ -633,5 +633,26 @@ public class GuiFrameManager implements PamSettings, PAMControllerGUI {
|
||||
return frameIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that can move GUI frames back onto the main window.
|
||||
* Can be used to recover a GUI if it's on a monitor that is not present.
|
||||
*/
|
||||
public void findGUI() {
|
||||
if (pamViewList == null) {
|
||||
return;
|
||||
}
|
||||
int loc = 10;
|
||||
for (PamViewInterface view : pamViewList) {
|
||||
JFrame frame = view.getGuiFrame();
|
||||
if (frame == null) {
|
||||
continue;
|
||||
}
|
||||
frame.setLocation(loc, loc);
|
||||
frame.setState(JFrame.NORMAL);
|
||||
frame.setVisible(true);
|
||||
loc += 20;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user