From ff08a196fe98790d78ee7f5b26b9f367f9fa5a68 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Thu, 11 Jun 2015 18:12:24 +0200 Subject: Started work on the GUI, and added imageCode field to card, now need to update own collection --- src/eu/equalparts/cardbase/gui/CardImageView.java | 18 +++++++++++ src/eu/equalparts/cardbase/gui/CardbaseGUI.java | 36 ++++++++++++++++++++++ src/eu/equalparts/cardbase/gui/CardbaseViewer.java | 11 +++++++ 3 files changed, 65 insertions(+) create mode 100644 src/eu/equalparts/cardbase/gui/CardImageView.java create mode 100644 src/eu/equalparts/cardbase/gui/CardbaseGUI.java create mode 100644 src/eu/equalparts/cardbase/gui/CardbaseViewer.java (limited to 'src/eu/equalparts/cardbase/gui') diff --git a/src/eu/equalparts/cardbase/gui/CardImageView.java b/src/eu/equalparts/cardbase/gui/CardImageView.java new file mode 100644 index 0000000..7c79c6a --- /dev/null +++ b/src/eu/equalparts/cardbase/gui/CardImageView.java @@ -0,0 +1,18 @@ +package eu.equalparts.cardbase.gui; + +import eu.equalparts.cardbase.data.Card; +import javafx.scene.image.ImageView; + +public class CardImageView extends ImageView { + + private static final String BASE_IMG_URL = "http://magiccards.info/scans/en/"; + + public CardImageView(Card card) { + super(makeUrl(card)); + } + + public static String makeUrl(Card card) { + return BASE_IMG_URL + card.imageCode + "/" + card.number + ".jpg"; + } + +} diff --git a/src/eu/equalparts/cardbase/gui/CardbaseGUI.java b/src/eu/equalparts/cardbase/gui/CardbaseGUI.java new file mode 100644 index 0000000..46d3c55 --- /dev/null +++ b/src/eu/equalparts/cardbase/gui/CardbaseGUI.java @@ -0,0 +1,36 @@ +package eu.equalparts.cardbase.gui; + +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.image.ImageView; +import javafx.scene.layout.Pane; +import javafx.stage.Stage; +import eu.equalparts.cardbase.data.Card; +import eu.equalparts.cardbase.utils.MTGUniverse; + +public class CardbaseGUI extends Application { + + /** + * Run the GUI. + * + * @param args arguments passed down to {@code Application.launch()}. + */ + public static void main(String... args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + Card card = MTGUniverse.getCard("M15", "281"); + ImageView test = new ImageView(CardImageView.makeUrl(card)); + + Pane parent = new Pane(); + + parent.getChildren().add(test); + + primaryStage.setScene(new Scene(parent)); + + primaryStage.setTitle("Cardbase"); + primaryStage.show(); + } +} diff --git a/src/eu/equalparts/cardbase/gui/CardbaseViewer.java b/src/eu/equalparts/cardbase/gui/CardbaseViewer.java new file mode 100644 index 0000000..30b32fb --- /dev/null +++ b/src/eu/equalparts/cardbase/gui/CardbaseViewer.java @@ -0,0 +1,11 @@ +package eu.equalparts.cardbase.gui; + +import javafx.scene.Parent; + +public class CardbaseViewer extends Parent { + + + + + +} -- cgit v1.2.3