try { int nwidth = Integer.parseInt(width.getText()); int nheight = Integer.parseInt(height.getText());  int x = -Integer.parseInt(offsetX.getText()); int y = -Integer.parseInt(offsetY.getText()); currentMap.resize(nwidth, nheight, x, y); } catch (NumberFormatException nfe) { JOptionPane.showMessageDialog(this, "One of your dimensions is not a number", "Argh!", JOptionPane.ERROR_MESSAGE, null); }
int nwidth = ((Number)width.getValue()).intValue(); int nheight = ((Number)height.getValue()).intValue();  int dx = ((Number)offsetX.getValue()).intValue(); int dy = ((Number)offsetY.getValue()).intValue(); currentMap.resize(nwidth, nheight, dx, dy);
    public void actionPerformed(ActionEvent e) {        Object src = e.getSource();        if (src == bOk) {            try {                int nwidth = Integer.parseInt(width.getText());                int nheight = Integer.parseInt(height.getText());                // Math works out in MapLayer#resize                int x = -Integer.parseInt(offsetX.getText());                int y = -Integer.parseInt(offsetY.getText());                currentMap.resize(nwidth, nheight, x, y);            } catch (NumberFormatException nfe) {                JOptionPane.showMessageDialog(this,                        "One of your dimensions is not a number", "Argh!",                        JOptionPane.ERROR_MESSAGE, null);            }            dispose();        } else if (src == bCancel) {            dispose();        } else {            System.out.println(e.getActionCommand());        }    }