diff options
Diffstat (limited to 'src/eu/equalparts')
-rw-r--r-- | src/eu/equalparts/cardbase/gui/CardView.java (renamed from src/eu/equalparts/cardbase/gui/CardImageView.java) | 15 | ||||
-rw-r--r-- | src/eu/equalparts/cardbase/gui/CardbaseGUI.java | 83 | ||||
-rw-r--r-- | src/eu/equalparts/cardbase/utils/MTGUniverse.java | 4 |
3 files changed, 78 insertions, 24 deletions
diff --git a/src/eu/equalparts/cardbase/gui/CardImageView.java b/src/eu/equalparts/cardbase/gui/CardView.java index 7c79c6a..61504ee 100644 --- a/src/eu/equalparts/cardbase/gui/CardImageView.java +++ b/src/eu/equalparts/cardbase/gui/CardView.java @@ -1,14 +1,25 @@ package eu.equalparts.cardbase.gui; import eu.equalparts.cardbase.data.Card; +import javafx.event.EventHandler; import javafx.scene.image.ImageView; +import javafx.scene.input.MouseEvent; -public class CardImageView extends ImageView { +public class CardView extends ImageView { private static final String BASE_IMG_URL = "http://magiccards.info/scans/en/"; - public CardImageView(Card card) { + public CardView(Card card) { super(makeUrl(card)); + + addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { + + @Override + public void handle(MouseEvent event) { + setVisible(false); + } + }); + } public static String makeUrl(Card card) { diff --git a/src/eu/equalparts/cardbase/gui/CardbaseGUI.java b/src/eu/equalparts/cardbase/gui/CardbaseGUI.java index 46d3c55..bbbb97c 100644 --- a/src/eu/equalparts/cardbase/gui/CardbaseGUI.java +++ b/src/eu/equalparts/cardbase/gui/CardbaseGUI.java @@ -1,14 +1,14 @@ 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; +import java.awt.Button; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; -public class CardbaseGUI extends Application { + +@SuppressWarnings("serial") +public class CardbaseGUI extends Panel { /** * Run the GUI. @@ -16,21 +16,64 @@ public class CardbaseGUI extends Application { * @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)); + Frame f = new Frame("Test"); - Pane parent = new Pane(); + CardbaseGUI c = new CardbaseGUI(); - parent.getChildren().add(test); + f.add(c); + f.pack(); - primaryStage.setScene(new Scene(parent)); + f.addWindowListener(new WindowListener() { + @Override + public void windowOpened(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowIconified(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeiconified(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeactivated(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowClosing(WindowEvent e) { + System.exit(0); + } + + @Override + public void windowClosed(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowActivated(WindowEvent e) { + // TODO Auto-generated method stub + + } + }); - primaryStage.setTitle("Cardbase"); - primaryStage.show(); + f.setVisible(true); + } + + + public void init() { + add(new Button("one")); + add(new Button("two")); } + + } diff --git a/src/eu/equalparts/cardbase/utils/MTGUniverse.java b/src/eu/equalparts/cardbase/utils/MTGUniverse.java index 51959aa..b52c3e6 100644 --- a/src/eu/equalparts/cardbase/utils/MTGUniverse.java +++ b/src/eu/equalparts/cardbase/utils/MTGUniverse.java @@ -21,9 +21,9 @@ import eu.equalparts.cardbase.data.FullCardSet; * MTG universe. This class has a series of utility functions that * query remote databases to acquire card information. * <br> - * Conversely, {@code CardbaseManager}'s methods are used solely to + * Conversely, {@code Cardbase}'s methods are used solely to * acquire information regarding the loaded cardbase, which will - * most likely contain only a subset of the MTG universe. + * most likely contain only a subset of the MTG universe of cards. * * @author Eduardo Pedroni */ |