Skip to content

Instantly share code, notes, and snippets.

@mahimahi42
mahimahi42 / Master.java
Created November 18, 2014 13:21
Pokemon-esque battle screen for Master Programmer
import java.io.File;
import javafx.application.*;
import javafx.geometry.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.image.*;
import javafx.stage.*;
public class Master extends Application
@mahimahi42
mahimahi42 / ImagePopup.java
Created November 16, 2014 01:18
Example of JavaFX image popup with autoplaying audio
package edu.govschool;
import java.io.File;
import javafx.application.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.layout.*;
import javafx.scene.media.*;
import javafx.stage.*;
@mahimahi42
mahimahi42 / JavaFXImage.java
Created November 16, 2014 00:37
Example of JavaFX displaying image
/**
* New packages to import
*/
import javafx.scene.image.*;
// Add this code where you want your image to appear
File imageFile = new File("C:\\Path\\To\\Image\\File.jpg");
Image image = new Image(imageFile.toURI().toString());
@mahimahi42
mahimahi42 / JavaFXAudio.java
Last active August 29, 2015 14:09
Example of JavaFX playing audio file
/**
* Assume that the modal confirmation box is in the normal package
* These are extra packages you need to import
*/
import edu.govschool.modals.*;
import javafx.scene.media.*;
import java.io.File;
// Add this code to your code that's called when you want
// the audo file to play
@mahimahi42
mahimahi42 / ClickCounter.java
Created October 25, 2014 21:58
JavaFX Introductory Example
import javafx.application.*;
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.scene.control.*;
public class ClickCounter extends Application
{
private static Button btn;
private static Label lbl;
@mahimahi42
mahimahi42 / ProjectileWriteToFile.java
Last active August 29, 2015 14:07
ModSim: Unit 2 Driver Program
import java.util.Scanner;
import java.text.DecimalFormat;
import java.io.FileWriter;
import java.io.IOException;
public class ProjectileWriteToFile
{
public static void main(String[] args)
{
System.out.println("Modeling Projectile Motion");
@mahimahi42
mahimahi42 / LinkedList.java
Created October 15, 2014 13:30
Scientific Programming II: Unit 4 Test Review
public class LinkedList
{
private Node head;
private Node tail;
public LinkedList()
{
head = null;
tail = null;
}
@mahimahi42
mahimahi42 / LinkedListTest.java
Created October 9, 2014 13:56
ModSim: Unit 1 Generics LinkedListTest
import java.util.Scanner;
public class LinkedListTest
{
public static void Menu()
{
System.out.println("1 - Insert At Back");
System.out.println("2 - Quit");
System.out.println("3 - Insert At Front");
System.out.println("4 - Remove From Front");
@mahimahi42
mahimahi42 / LinkedList.java
Created October 9, 2014 13:54
ModSim: Unit 1 Generics LinkedList
// As before, the T signifies the type we're storing.
public class LinkedList<T>
{
private Node<T> head;
private Node<T> tail;
public LinkedList()
{
head = null;
tail = null;
@mahimahi42
mahimahi42 / Node.java
Created October 9, 2014 13:50
ModSim: Unit 1 Generics Node
// The <T> after the class name tells Java that this class
// uses generics. During program execution, the T will be replaced
// with the class being stored.
public class Node<T>
{
// Since our data is the thing we're storing, we'll
// set it's type to T.
private T data;
private Node next;