lineNumber = 1;
maxLineNumberAllowed = 1; // Empty document has 1 line.
GoToListener listener = new GoToListener();
// Set the main content pane for the "GoTo" dialog.
JPanel contentPane = new ResizableFrameContentPane(new BorderLayout());
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
setContentPane(contentPane);
// Make a panel containing the "Line Number" edit box.
JPanel enterLineNumberPane = new JPanel();
BoxLayout box = new BoxLayout(enterLineNumberPane, BoxLayout.LINE_AXIS);
enterLineNumberPane.setLayout(box);
lineNumberField = new JTextField(16);
lineNumberField.setText("" + lineNumber);
AbstractDocument doc = (AbstractDocument) lineNumberField.getDocument();
doc.addDocumentListener(listener);
doc.setDocumentFilter(new GoToDocumentFilter());
enterLineNumberPane.add(new JLabel(s_stringMgr.getString("syntax.SquirrelGoToDialog.LineNumber")));
enterLineNumberPane.add(lineNumberField);
// Make a panel containing the OK and Cancel buttons.
JPanel buttonPanel = new JPanel(new GridLayout(1, 2, 5, 5));
okButton = createRButton(s_stringMgr.getString("syntax.SquirrelGoToDialog.OKButtonLabel"), s_stringMgr.getString("syntax.SquirrelGoToDialog.OKButtonMnemonic"));
okButton.setActionCommand("OK");
okButton.addActionListener(listener);
cancelButton = createRButton(s_stringMgr.getString("syntax.SquirrelGoToDialog.Cancel"), s_stringMgr.getString("syntax.SquirrelGoToDialog.CancelMnemonic"));
cancelButton.setActionCommand("Cancel");
cancelButton.addActionListener(listener);
buttonPanel.add(okButton);
buttonPanel.add(cancelButton);
// Put everything into a neat little package.
contentPane.add(enterLineNumberPane, BorderLayout.NORTH);
JPanel temp = new JPanel();
temp.add(buttonPanel);
contentPane.add(temp, BorderLayout.SOUTH);
JRootPane rootPane = getRootPane();
rootPane.setDefaultButton(okButton);
setTitle(s_stringMgr.getString("syntax.SquirrelGoToDialog.GotoDialogTitle"));
setModal(true);
applyComponentOrientation(orientation);