Skip to content

Instantly share code, notes, and snippets.

@zwazel
Last active September 3, 2021 12:24
Show Gist options
  • Save zwazel/f6830cf5bcc35e1ec7931130ea8f9590 to your computer and use it in GitHub Desktop.
Save zwazel/f6830cf5bcc35e1ec7931130ea8f9590 to your computer and use it in GitHub Desktop.
File Templates for IntelliJ
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "") package ${PACKAGE_NAME};#end
#parse("File Header.java")
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
public class ${NAME} extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
GridPane layout = new GridPane(); // Replace the Gridpane with whatever you want
Scene scene = new Scene(layout, 300, 250);
primaryStage.setScene(scene);
primaryStage.show();
}
}
window.onload = function () {
simulate();
}
function simulate(canvasId = "canvas") {
let canvas = document.getElementById(canvasId),
context = canvas.getContext("2d"),
width = canvas.width = window.innerWidth,
height = canvas.height = window.innerHeight;
update();
function update() {
context.clearRect(0, 0, width, height);
requestAnimationFrame(update);
}
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public class ${NAME} {
public ${NAME}() {
}
public static void main(String[] args) {
new ${NAME}();
}
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
import java.awt.*;
public class ${NAME} extends Canvas {
public ${NAME}() {
}
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
import javax.swing.*;
public class ${NAME} extends JDialog {
public ${NAME}(JFrame parent, String titel, boolean modal) {
super(parent, titel, modal);
initComponents();
}
private void initComponents() {
setSize(500, 500);
setVisible(true);
}
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
import javax.swing.*;
public class ${NAME} extends JFrame {
public ${NAME}() {
initComponents();
}
private void initComponents() {
setSize(300,300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("${NAME}");
setVisible(true);
}
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
import javax.swing.*;
public class ${NAME} extends JWindow {
public ${NAME}() {
initComponents();
}
private void initComponents() {
setSize(300,300);
setVisible(true);
}
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ${NAME} extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) {
doGet(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) {
}
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public class ${NAME} {
public ${NAME}() {
}
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
#set($classNameCamelCase = $NAME.substring(0,1).toLowerCase() + $NAME.substring(1))
public class ${NAME} implements Runnable {
private Thread ${classNameCamelCase};
private final String threadName;
public ${NAME}(String threadName) {
this.threadName = threadName;
}
@Override
public void run() {
System.out.println("THREAD RUNNING " + threadName);
// Methods will be executed HERE
System.out.println("THREAD ENDED " + threadName);
}
public void start() {
System.out.println("THREAD STARTED " + threadName);
if (${classNameCamelCase} == null) {
${classNameCamelCase} = new Thread(this, threadName);
${classNameCamelCase}.start();
}
}
}
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
#set($classNameCamelCase = $NAME.substring(0,1).toLowerCase() + $NAME.substring(1))
public class ${NAME} extends Thread {
private Thread ${classNameCamelCase};
private final String threadName;
public ${NAME}(String threadName) {
this.threadName = threadName;
}
@Override
public void run() {
System.out.println("THREAD RUNNING " + threadName);
// Methods will be executed HERE
System.out.println("THREAD ENDED " + threadName);
}
public void start() {
System.out.println("THREAD STARTED " + threadName);
if (${classNameCamelCase} == null) {
${classNameCamelCase} = new Thread(this, threadName);
${classNameCamelCase}.start();
}
}
}
@Muetzilla
Copy link

@zwazel
Copy link
Author

zwazel commented Feb 15, 2021

bidde @Muetzilla

@Phillip-05
Copy link

THANKS @zwazel

@Loic190
Copy link

Loic190 commented Feb 15, 2021

Thänks @zwazel

@zwazel
Copy link
Author

zwazel commented Feb 15, 2021

jaja keis ding @Phillip-05 und @Loic190

@HtownJ1
Copy link

HtownJ1 commented Feb 24, 2021

THàNKAJS @zwazel

@HtownJ1
Copy link

HtownJ1 commented Feb 24, 2021

YOU SO GUD @zwazel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment