From 946a43b5537da8ccb49a27b2e7a9e019a30b09f9 Mon Sep 17 00:00:00 2001 From: Austin Wu Date: Thu, 4 Feb 2016 21:42:47 -0500 Subject: [PATCH 1/4] ran out of time for the exception --- .classpath | 6 ++++++ src/BrowserException.java | 4 ++++ src/BrowserModel.java | 2 ++ src/BrowserView.java | 19 ++++++++++++++++++- src/resources/English.properties | 1 + src/resources/default.css | 21 +++++++++++---------- 6 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 .classpath create mode 100644 src/BrowserException.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..fb50116 --- /dev/null +++ b/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/BrowserException.java b/src/BrowserException.java new file mode 100644 index 0000000..4fdd5e4 --- /dev/null +++ b/src/BrowserException.java @@ -0,0 +1,4 @@ + +public class BrowserException extends Exception{ + +} diff --git a/src/BrowserModel.java b/src/BrowserModel.java index 9263bb3..70f6b4c 100755 --- a/src/BrowserModel.java +++ b/src/BrowserModel.java @@ -151,4 +151,6 @@ private URL completeURL (String possible) { } } } + + } diff --git a/src/BrowserView.java b/src/BrowserView.java index f9d591d..060a74c 100644 --- a/src/BrowserView.java +++ b/src/BrowserView.java @@ -61,6 +61,7 @@ public class BrowserView { private Button myBackButton; private Button myNextButton; private Button myHomeButton; + private Button addFavorite; // favorites private ComboBox myFavorites; // get strings from resource file @@ -84,6 +85,7 @@ public BrowserView (BrowserModel model, String language) { enableButtons(); // create scene to hold UI myScene = new Scene(root, DEFAULT_SIZE.width, DEFAULT_SIZE.height); + myScene.getStylesheets().add("resources/default.css"); //myScene.getStylesheets().add(DEFAULT_RESOURCE_PACKAGE + STYLESHEET); } @@ -96,7 +98,7 @@ public void showPage (String url) { update(valid); } else { - showError("Could not load " + url); + showError(myResources.getString("CouldNotLoad") + url); } } @@ -230,6 +232,21 @@ private Node makePreferencesPanel () { myModel.setHome(); enableButtons(); })); + result.getChildren().add(makeButton("AddFavoriteCommand", event -> { + addFavorite(); + enableButtons(); + })); + myFavorites.setOnAction((event) -> { + String name = myFavorites.getSelectionModel().getSelectedItem(); + URL valid = myModel.getFavorite(name); + if (valid != null) { + update(valid); + } + else { + showError(myResources.getString("CouldNotLoad") + valid); + } + }); + result.getChildren().add(myFavorites); return result; } diff --git a/src/resources/English.properties b/src/resources/English.properties index 5cb3530..1088a5a 100755 --- a/src/resources/English.properties +++ b/src/resources/English.properties @@ -8,3 +8,4 @@ ErrorTitle=Browser Error FavoritePromptTitle=Add Favorite FavoriteFirstItem=All Favorites SetHomeCommand=Set Home +CouldNotLoad=Could not load diff --git a/src/resources/default.css b/src/resources/default.css index 0d8badb..16f90dd 100644 --- a/src/resources/default.css +++ b/src/resources/default.css @@ -1,40 +1,41 @@ + .root { -fx-font-size: 14pt; - -fx-font-family: "Courier New"; + -fx-font-family: "Comic Sans"; -fx-base: rgb(132, 145, 47); -fx-background: rgb(225, 228, 203); } .button { - -fx-text-fill: #006464; - -fx-background-color: #DFB951; + -fx-text-fill: #39EFB4; + -fx-background-color: #FF69B4; -fx-border-radius: 20; -fx-background-radius: 20; -fx-padding: 8; } .button:hover { - -fx-background-color: #3a3a3a; + -fx-background-color: #FF69B4; } .combo-box-base { - -fx-text-base-color: #006464; - -fx-background-color: #DFB951; + -fx-text-base-color: #39EFB4; + -fx-background-color: #FF69B4; -fx-border-radius: 20; -fx-background-radius: 20; } .combo-box-base:hover { - -fx-background-color: #3a3a3a; + -fx-background-color: #FF69B4; } .label { -fx-font-size: 11pt; - -fx-font-family: "Segoe UI Semibold"; - -fx-text-fill: #006464; + -fx-font-family: "Comic Sans"; + -fx-text-fill: #39EFB4; -fx-opacity: 0.6; } .text-field { -fx-font-size: 14pt; - -fx-font-family: "Segoe UI Semibold"; + -fx-font-family: "Comic Sans"; } From 1d1df86a6a712160064c74f32305672ea0f4a73a Mon Sep 17 00:00:00 2001 From: Austin Wu Date: Mon, 8 Feb 2016 11:37:26 -0500 Subject: [PATCH 2/4] testing lab status --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e38ab71..ccaf7db 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # lab_browser +# testing github slack messages Duke CompSci 308 Lab : A simple GUI example: a web browser From b00e3905a74d3260022ec863237affc9d9e7db82 Mon Sep 17 00:00:00 2001 From: Austin Wu Date: Mon, 8 Feb 2016 11:37:57 -0500 Subject: [PATCH 3/4] for real now testing slack notifs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ccaf7db..5a433d7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # lab_browser -# testing github slack messages +# for real now testing github slack messages Duke CompSci 308 Lab : A simple GUI example: a web browser From c6c183f05df63ad2f5f9afb9a94e0ad1cbd8a42b Mon Sep 17 00:00:00 2001 From: Austin Wu Date: Mon, 8 Feb 2016 11:40:19 -0500 Subject: [PATCH 4/4] test --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a433d7..5f518da 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # lab_browser -# for real now testing github slack messages +asdfd# for real now testing github slack messages Duke CompSci 308 Lab : A simple GUI example: a web browser