diff options
author | Eduardo Pedroni <e.pedroni91@gmail.com> | 2015-06-11 18:12:24 +0200 |
---|---|---|
committer | Eduardo Pedroni <e.pedroni91@gmail.com> | 2015-06-11 18:12:24 +0200 |
commit | ff08a196fe98790d78ee7f5b26b9f367f9fa5a68 (patch) | |
tree | a2f6261fda4d69b685d83a5deb76f2d3b2069e0a /src/eu/equalparts/cardbase/gui | |
parent | 27be2dd797fc7087c5e362c22c1f30fc377ea0e9 (diff) |
Started work on the GUI, and added imageCode field to card, now need to update own collection
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 { + + + + + +} |