Created
August 29, 2018 12:52
-
-
Save shruxx/8b0a450ed8ef5b9d284b02ce232271fa to your computer and use it in GitHub Desktop.
Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="Encoding"> | |
<file url="file://$PROJECT_DIR$/dateien copy und delete mit gui-2.groovy" charset="windows-1252" /> | |
<file url="file://$PROJECT_DIR$/dateien copy und delete mit gui.groovy" charset="windows-1252" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="JAVA_MODULE" version="4"> | |
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |
<exclude-output /> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
<orderEntry type="library" name="groovy-2.5.2" level="application" /> | |
</component> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/.." /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/.idea/Groovy.iml" filepath="$PROJECT_DIR$/.idea/Groovy.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="VcsDirectoryMappings"> | |
<mapping directory="$PROJECT_DIR$/../GitRepo" vcs="Git" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ant = new AntBuilder() | |
def antdel = new AntBuilder() | |
ant.sequential{ | |
echo("wir sind mittendrin!") | |
def Posteingang="C:/Coding/Test/" | |
mkdir(dir: Posteingang) | |
copy(todir: Posteingang) { | |
fileset(dir:"C:/Coding/Quelle/") | |
} | |
} | |
antdel.delete(dir: "C:/Coding/Quelle/") | |
ant.echo("fertig!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example | |
{ | |
static void main(String[] args) | |
{ | |
//Beispiel f�r einen int Datentypen | |
int x=5; | |
//Beispiel f�r einen long Datentypen | |
long y=100L; | |
//Beispiel f�r einen float Datentypen | |
float a=10.56f; | |
//Beispiel f�r einen double Datentypen | |
double b=10.5e40; | |
//Beispiel f�r einen BigInteger Datentypen | |
BigInteger bi=30g; | |
//Beispiel f�r einen BigDecimal Datentypen | |
BigDecimal bd=3.5g; | |
println('Das sind die Ausgabebeispiele f�r einzelne Datentypen'); | |
println 'Beispiel f�r einen int Datentypen'; | |
println(x); | |
println 'Beispiel f�r einen long Datentypen'; | |
println(y); | |
println 'Beispiel f�r einen float Datentypen'; | |
println(a); | |
println 'Beispiel f�r einen double Datentypen'; | |
println(b); | |
println 'Beispiel f�r einen BigInteger Datentypen'; | |
println(bi); | |
println 'Beispiel f�r einen BigDecimal Datentypen'; | |
println(bd); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.swing.SwingBuilder | |
import javax.swing.JFrame | |
sb = new SwingBuilder() | |
def dialog(event){ | |
dialog = sb.dialog(title: 'Entry') | |
def panel = sb.panel{ | |
vbox { | |
hbox{ | |
label(text: 'Wenn du kopieren und löschen willst, drücke die 1. Ansonsten irgendwas anderes') | |
} | |
hbox{ | |
button(text: '1', actionPerformed:{new GroovyShell().evaluate(new File("C:/Coding/Groovy/copydel.groovy"))} ) | |
button(text: 'Irgendwas anderes', actionPerformed:{sb.dispose()}) | |
} | |
} | |
} | |
dialog.getContentPane().add(panel) | |
dialog.pack() | |
dialog.show() | |
} | |
new SwingBuilder().frame( title: "Jetzt wird kopiert!",defaultCloseOperation: JFrame.EXIT_ON_CLOSE, pack: true, show: true ){ | |
panel{ | |
button(actionPerformed: this.&dialog, "Kommen Sie herein bitte!") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.swing.SwingBuilder | |
import javax.swing.* | |
import java.awt.* | |
import groovy.lang.GroovyShell | |
def swing=new SwingBuilder() | |
def guiPanel={ | |
swing.panel(){ | |
label("Dateien kopieren und Ausgangsverzeichnis löschen") | |
} | |
} | |
swing.edt { | |
frame(title: 'Kopieren und löschen', | |
defaultCloseOperation: JFrame.EXIT_ON_CLOSE, | |
pack: true, | |
show: true) { | |
vbox { | |
hbox{ textlabel = label('Dateien verschieben und löschen!') | |
button( | |
text: 'Bestätigen', | |
actionPerformed: { | |
new GroovyShell().evaluate(new File("C:/Coding/Groovy/copydel.groovy"))} | |
) | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.file.* | |
//Klasse beschreiben | |
class Ordner | |
{ | |
//Methode ausw�hlen | |
public static void main(String[] args) | |
{ | |
//Variablen definieren | |
Path source= Paths.get("C:/Coding/Projekte/Post/"); | |
Path target= Paths.get("C:/Coding/Projekte/Versicherungsordner"); | |
//Files.copy(source,target.resolve(source.getFileName()),StandardCopyOption.REPLACE_EXISTING); | |
Files.walkFileTree(source, EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor("C:/Coding/Projekte/Versicherungsordner")); | |
println('Datei wurde erfolgreich wegsortiert') | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example | |
{ | |
static void main(String[] args) | |
{ | |
//x wird hier als Variable definiert | |
String x='Hallo'; | |
String y='Du'; | |
String z='Da'; | |
//Variable in lowercase definieren | |
int x1=5; | |
//Variable in uppercase definieren | |
int X=6; | |
//Variable mit underscore definieren | |
def _Name='Edelgard'; | |
//Text wird ausgegeben | |
println(x); | |
println(y); | |
println(z); | |
println(x1); | |
println(X); | |
println(_Name); | |
//Zusammentragen einzelner Variablen in eine println | |
println('Der Wert von X ist ' + X + ' Der Wert von x1 ist ' + x1 +' der Wert von _Name ist ' +_Name); | |
//Berechnen der Integer-Variablen | |
println('Der Wert aller Zahlen ist ') println(x1 + X); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.swing.SwingBuilder | |
import javax.swing.JFrame | |
import javax.swing.JFileChooser | |
def chooser = new JFileChooser() | |
def gui = new SwingBuilder() | |
gui.edt { | |
frame(title: 'Erweiterte GUI', defaultCloseOperation: JFrame.EXIT_ON_CLOSE, pack: true, show: true) | |
{ | |
vbox { | |
textlabel = label('Hier wird gearbeitet') | |
hbox { | |
button(text: 'So ist das hier', actionPerformed: { | |
new GroovyShell().evaluate(new File("C:/Coding/Groovy/copydel.groovy")) | |
}) | |
hbox { | |
button(text: 'mach die Hütte dicht', actionPerformed: { gui.dispose() }) | |
hbox { | |
button(text: 'welcher Ordner darf es denn sein?', actionPerformed: { | |
chooser.showOpenDialog(null) | |
if(chooser.showOpenDialog(null)== JFileChooser.APPROVE_OPTION) | |
chooser.getSelectedFile().getName() | |
new GroovyShell().evaluate(new File("${chooser.getSelectedFile().getName()}")) | |
} | |
) | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example | |
{ | |
static void main(String[] args) | |
{ | |
println('Hello World'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.swing.SwingBuilder | |
import javax.swing.JFrame | |
import groovy.swing.factory.SwingBorderFactory | |
sb = new SwingBuilder() | |
def dialog(event){ | |
dialog = sb.dialog(title: 'Entry') | |
def panel = sb.panel{ | |
vbox { | |
hbox{ | |
button('OK', actionPerformed: new GroovyShell().evaluate(new File("C:/Coding/Groovy/copydel.groovy"))) | |
button('Cancel') | |
} | |
} | |
} | |
dialog.getContentPane().add(panel) | |
dialog.pack() | |
dialog.show() | |
} | |
new SwingBuilder().frame( title: "TEST",defaultCloseOperation: JFrame.EXIT_ON_CLOSE, pack: true, show: true ){ | |
panel{ | |
button(actionPerformed: this.&dialog, "Click") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example | |
{ | |
static void main(String[] args) | |
{ | |
//Variablen definieren | |
def name='Eddi'; | |
def A=1000; | |
def B=2000; | |
String a="Hi ${name}"; | |
String b='Ich hoffe, es geht dir gut :-)'; | |
String c='Hier ein paar Zahlen f�r dich'; | |
def d="Gesamt ergibt das Ganze ${A + B}"; | |
println(a); | |
println(b); | |
println(c); | |
println(A); | |
println(B); | |
println(d); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.swing.SwingBuilder | |
import javax.swing.JFrame | |
import groovy.swing.factory.SwingBorderFactory | |
sb = new SwingBuilder() | |
new SwingBuilder().frame( title: "TEST",defaultCloseOperation: JFrame.EXIT_ON_CLOSE, pack: true, show: true ){ | |
panel{ | |
button(actionPerformed: this.&dialog, "Click") | |
} | |
} | |
def dialog(event){ | |
dialog = sb.dialog(title: 'Entry') | |
def panel = sb.panel{ | |
vbox { | |
hbox{ | |
label(text: 'Name ') | |
textField(columns: 20, id: 'name') | |
} | |
hbox{ | |
label(text: 'Password ') | |
passwordField(columns: 20, id: 'password') | |
} | |
hbox{ | |
button('OK') // add actionPerformed: | |
button('Cancel') | |
} | |
} | |
} | |
dialog.getContentPane().add(panel) | |
dialog.pack() | |
dialog.show() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment