Skip to content

Instantly share code, notes, and snippets.

@bluepapa32
bluepapa32 / MD5.java
Created January 7, 2010 07:09
MD5 with Java
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5 {
@bluepapa32
bluepapa32 / PanelUtil.fx
Created January 7, 2010 12:30
Node から JComponent 取得
import javafx.scene.Node;
import javafx.reflect.FXLocal;
// com.sun.javafx.tk.swing.SwingScene$SwingScenePanel
function getPanel(node: Node) {
var context = FXLocal.getContext();
// SGNode
var nodeClass = context.makeClassRef(node.getClass());
@bluepapa32
bluepapa32 / gist:273968
Created January 11, 2010 03:28
InputStream to BufferedReader
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String line = null;
while ((line = r.readLine()) != null) {
System.out.println(line);
}
@bluepapa32
bluepapa32 / gist:273989
Created January 11, 2010 04:00
Copy InputStream to OutputStream
public class CopyStream implements Runnable {
private InputStream in;
private OutputStream out;
public CopyStream(InputStream in, OutputStream out) {
this.in = new BufferedInputStream(in);
this.out = new BufferedOutputStream(out);
}
@bluepapa32
bluepapa32 / gist:278850
Created January 16, 2010 15:01
How to use MediaPlayer
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.scene.paint.Color;
import javafx.scene.Scene;
import javafx.stage.Stage;
function run(args: String[]) {
var media = Media {
source: args[0]
@bluepapa32
bluepapa32 / gist:278908
Created January 16, 2010 17:27
ParallelTransition Sample
import javafx.animation.*;
import javafx.animation.transition.*;
import javafx.scene.*;
import javafx.scene.image.*;
import javafx.scene.layout.*;
import javafx.scene.shape.*;
import javafx.stage.*;
public function run(args: String[]) {
@bluepapa32
bluepapa32 / gist:278915
Created January 16, 2010 17:46
How to use FadeTransition
import javafx.animation.*;
import javafx.animation.transition.*;
import javafx.scene.*;
import javafx.scene.image.*;
import javafx.scene.layout.*;
import javafx.scene.shape.*;
import javafx.stage.*;
public function run(args: String[]) {
@bluepapa32
bluepapa32 / gist:281591
Created January 20, 2010 04:05
How to use Panel Layout
import javafx.geometry.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.*;
var panel: Panel;
var paddingTop = 5.0;
@bluepapa32
bluepapa32 / gist:282713
Created January 21, 2010 10:30
How to use RadioButton
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.*;
import javafx.util.Sequences.*;
class Item {
public var text: String;
public var value: Object;
@bluepapa32
bluepapa32 / Calendar.fx
Created February 27, 2010 01:28
Calendar.fx
import java.util.Calendar;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.layout.Stack;
import javafx.scene.layout.Tile;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;
import javafx.stage.Stage;