Source code: com/arranger/jarl/shell/commands/DimensionCommand.java
1 package com.arranger.jarl.shell.commands;
2
3 import com.arranger.jarl.shell.models.JarlContextModel;
4
5 import java.awt.*;
6
7 /**
8 * DimensionCommand created on Apr 16, 2003
9 */
10 public class DimensionCommand extends BaseCommand {
11
12 public String getHelpText() {
13 return "changes default dimesnsions. Usage: dimension width height or dimension (to clear custom)";
14 }
15
16 public String getCommand() {
17 return "dimension";
18 }
19
20 public void invoke(String[] args) throws Exception {
21 JarlContextModel jarlContextModel = (JarlContextModel)m_jarlShell.getModel(JarlContextModel.class.getName());
22
23 if (args.length == 1) {
24 jarlContextModel.setDimension(null);
25 } else if (args.length == 3) {
26 int width = Integer.parseInt(args[1]);
27 int height = Integer.parseInt(args[2]);
28 jarlContextModel.setDimension(new Dimension(width, height));
29 } else {
30 m_jarlShell.out("illegal arguments. Need width and height");
31 return;
32 }
33
34 m_jarlShell.saveModels();
35 }
36 }