mirror of https://github.com/sojamo/controlp5
added Multiline Texfield Control
This commit is contained in:
parent
7e5c5c0267
commit
c35645abd9
|
@ -9,4 +9,5 @@
|
|||
.buildpath
|
||||
.classpath
|
||||
.project
|
||||
./out/
|
||||
./out/
|
||||
./target/
|
|
@ -0,0 +1,10 @@
|
|||
<component name="libraryTable">
|
||||
<library name="antlr.antlr4.runtime" type="repository">
|
||||
<properties maven-id="org.antlr:antlr4-runtime:4.12.0" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/antlr/antlr4-runtime/4.12.0/antlr4-runtime-4.12.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
35
pom.xml
35
pom.xml
|
@ -12,6 +12,11 @@
|
|||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<antlr4.version>4.12.0</antlr4.version> <!-- Use the latest ANTLR version as of your current date -->
|
||||
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
|
@ -19,6 +24,7 @@
|
|||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
@ -28,8 +34,37 @@
|
|||
<version>4.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- ANTLR4 runtime -->
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
<version>${antlr4.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- ANTLR4 Maven plugin -->
|
||||
<plugin>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-maven-plugin</artifactId>
|
||||
<version>${antlr4.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>antlr4</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
Binary file not shown.
|
@ -0,0 +1,26 @@
|
|||
package controlP5;
|
||||
|
||||
import processing.event.KeyEvent;
|
||||
|
||||
public class MultilineTextfield extends Textfield {
|
||||
|
||||
public MultilineTextfield(ControlP5 theControlP5, String theName) {
|
||||
super(theControlP5, theName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyEvent(KeyEvent theKeyEvent) {
|
||||
if (isUserInteraction && isTexfieldActive && isActive && theKeyEvent.getAction() == KeyEvent.PRESS) {
|
||||
if (ignorelist.contains(cp5.getKeyCode())) {
|
||||
return;
|
||||
}
|
||||
if (cp5.getKeyCode() == ENTER) {
|
||||
// Append a new line character to the text buffer
|
||||
_myTextBuffer.insert(_myTextBufferIndex, '\n');
|
||||
setIndex(_myTextBufferIndex + 1);
|
||||
} else {
|
||||
super.keyEvent(theKeyEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -384,7 +384,7 @@ public class Textfield extends Controller< Textfield > {
|
|||
return s;
|
||||
}
|
||||
|
||||
private Textfield setIndex( int theIndex ) {
|
||||
protected Textfield setIndex( int theIndex ) {
|
||||
_myTextBufferIndex = theIndex;
|
||||
return this;
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue