Gridarta Editor
Repeat.java
Go to the documentation of this file.
1 /*
2  * InputHandler.java - Manages key bindings and executes actions
3  * Copyright (C) 1999 Slava Pestov
4  * Copyright (C) 2000-2023 The Gridarta Developers.
5  *
6  * You may use and modify this package for any purpose. Redistribution is
7  * permitted, in both source and binary form, provided that this notice
8  * remains intact in all source distributions of this package.
9  */
10 
11 package net.sf.gridarta.textedit.textarea.actions;
12 
13 import java.awt.event.ActionEvent;
14 import java.awt.event.ActionListener;
17 
18 public class Repeat implements ActionListener {
19 
20  @Override
21  public void actionPerformed(final ActionEvent e) {
22  final JEditTextArea textArea = InputHandler.getTextArea(e);
23  textArea.getInputHandler().setRepeatEnabled(true);
24  final String actionCommand = e.getActionCommand();
25  if (actionCommand != null) {
26  textArea.getInputHandler().setRepeatCount(Integer.parseInt(actionCommand));
27  }
28  }
29 
30 }
net.sf.gridarta.textedit.textarea.JEditTextArea
jEdit's text area component.
Definition: JEditTextArea.java:91
net.sf.gridarta.textedit.textarea
This package contains the other part of the script editor.
net.sf.gridarta
Base package of all Gridarta classes.
net.sf
net.sf.gridarta.textedit.textarea.InputHandler
An input handler converts the user's key strokes into concrete actions.
Definition: InputHandler.java:36
net.sf.gridarta.textedit
net.sf.gridarta.textedit.textarea.actions.Repeat
Definition: Repeat.java:18
net.sf.gridarta.textedit.textarea.JEditTextArea.getInputHandler
InputHandler getInputHandler()
Returns the input handler.
Definition: JEditTextArea.java:264
net.sf.gridarta.textedit.textarea.InputHandler.setRepeatCount
void setRepeatCount(final int repeatCount)
Sets the number of times the next action will be repeated.
Definition: InputHandler.java:91
net.sf.gridarta.textedit.textarea.actions.Repeat.actionPerformed
void actionPerformed(final ActionEvent e)
Definition: Repeat.java:21
net
net.sf.gridarta.textedit.textarea.InputHandler.getTextArea
static JEditTextArea getTextArea(final EventObject evt)
Returns the text area that fired the specified event.
Definition: InputHandler.java:144
net.sf.gridarta.textedit.textarea.InputHandler.setRepeatEnabled
void setRepeatEnabled(final boolean repeat)
Sets the enabled state of repetition.
Definition: InputHandler.java:74