diff options
Diffstat (limited to 'src/eu/equalparts/cardbase/gui')
-rw-r--r-- | src/eu/equalparts/cardbase/gui/CardImageView.java | 18 | ||||
-rw-r--r-- | src/eu/equalparts/cardbase/gui/CardbaseGUI.java | 36 | ||||
-rw-r--r-- | src/eu/equalparts/cardbase/gui/CardbaseViewer.java | 11 |
3 files changed, 65 insertions, 0 deletions
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 { + + + + + +} |