Skip to content

Commit

Permalink
Fixed FavIcon Bug and Added close buttons on tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
goxr3plus committed Mar 16, 2018
1 parent d84e9e2 commit 0af2d1b
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,22 @@ private void initialize() {
facIconImageView.visibleProperty().bind(indicator.visibleProperty().not());
facIconImageView.managedProperty().bind(facIconImageView.imageProperty().isNotNull().and(indicator.visibleProperty().not()));

//X Button
JFXButton closeButton = new JFXButton("X");
int maxSize = 25;
closeButton.setMinSize(maxSize, maxSize);
closeButton.setPrefSize(maxSize, maxSize);
closeButton.setMaxSize(maxSize, maxSize);
closeButton.setStyle("-fx-background-radius:0; -fx-font-size:8px");
closeButton.setOnAction(a -> this.webBrowserController.removeTab(tab));

// HBOX
HBox hBox = new HBox();
hBox.setOnMouseClicked(m -> {
if (m.getButton() == MouseButton.MIDDLE)
this.webBrowserController.removeTab(tab);
});
hBox.getChildren().addAll(facIconImageView, stack, marquee);
hBox.getChildren().addAll(facIconImageView, stack, marquee, closeButton);
tab.setGraphic(hBox);

//ContextMenu
Expand Down Expand Up @@ -566,6 +575,9 @@ public class FavIconProvider implements ChangeListener<State> {
public void changed(ObservableValue<? extends State> observable , State oldState , State newState) {
if (newState == Worker.State.SUCCEEDED) {
try {
if ("about:blank".equals(webEngine.getLocation()))
return;

//Determine the full url
String favIconFullURL = getHostName(webEngine.getLocation()) + "favicon.ico";
//System.out.println(favIconFullURL)
Expand Down

0 comments on commit 0af2d1b

Please sign in to comment.