Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# lab_browser
asdfd# for real now testing github slack messages
Duke CompSci 308 Lab : A simple GUI example: a web browser
4 changes: 4 additions & 0 deletions src/BrowserException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

public class BrowserException extends Exception{

}
2 changes: 2 additions & 0 deletions src/BrowserModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,6 @@ private URL completeURL (String possible) {
}
}
}


}
19 changes: 18 additions & 1 deletion src/BrowserView.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class BrowserView {
private Button myBackButton;
private Button myNextButton;
private Button myHomeButton;
private Button addFavorite;
// favorites
private ComboBox<String> myFavorites;
// get strings from resource file
Expand All @@ -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);
}

Expand All @@ -96,7 +98,7 @@ public void showPage (String url) {
update(valid);
}
else {
showError("Could not load " + url);
showError(myResources.getString("CouldNotLoad") + url);
}
}

Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions src/resources/English.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ErrorTitle=Browser Error
FavoritePromptTitle=Add Favorite
FavoriteFirstItem=All Favorites
SetHomeCommand=Set Home
CouldNotLoad=Could not load
21 changes: 11 additions & 10 deletions src/resources/default.css
Original file line number Diff line number Diff line change
@@ -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";
}