Skip to content

Commit b434b2e

Browse files
committed
Fix bug , not reloading website after internet connection
1 parent 2ffb673 commit b434b2e

3 files changed

Lines changed: 29 additions & 42 deletions

File tree

resources/fxml/WebBrowserTabController.fxml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<?import javafx.scene.control.Button?>
77
<?import javafx.scene.control.ComboBox?>
88
<?import javafx.scene.control.Label?>
9+
<?import javafx.scene.control.ProgressIndicator?>
910
<?import javafx.scene.control.TextArea?>
1011
<?import javafx.scene.control.TextField?>
1112
<?import javafx.scene.control.Tooltip?>
@@ -75,11 +76,6 @@
7576
</cursor>
7677
</Button>
7778
<TextField fx:id="searchBar" promptText="Search..." style="-fx-background-radius: 45;" styleClass="jfx-text-area" HBox.hgrow="ALWAYS" />
78-
<ComboBox fx:id="searchEngineComboBox" promptText="Search Engine">
79-
<cursor>
80-
<Cursor fx:constant="HAND" />
81-
</cursor>
82-
</ComboBox>
8379
<Button fx:id="goButton" mnemonicParsing="false" style="-fx-background-radius: 0 45 45 0;" text="Go">
8480
<tooltip>
8581
<Tooltip text="Load the Web Site" />
@@ -88,6 +84,14 @@
8884
<Cursor fx:constant="HAND" />
8985
</cursor>
9086
</Button>
87+
<ComboBox fx:id="searchEngineComboBox" promptText="Search Engine">
88+
<cursor>
89+
<Cursor fx:constant="HAND" />
90+
</cursor>
91+
<HBox.margin>
92+
<Insets left="5.0" />
93+
</HBox.margin>
94+
</ComboBox>
9195
</children>
9296
</HBox>
9397
<!-- <SearchEngineComboBox fx:id="searchEngineComboBox" prefHeight="31.0" prefWidth="152.0" promptText="search engine">
@@ -115,11 +119,17 @@
115119
</image>
116120
</ImageView>
117121
<Label styleClass="sideBarSectionLabel" text="Server not found" textAlignment="CENTER" wrapText="true" />
118-
<TextArea editable="false" focusTraversable="false" maxHeight="-Infinity" maxWidth="-Infinity" mouseTransparent="true" prefHeight="156.0" prefWidth="587.0" text="&#10;1.Check the address for typing errors such as ww.example.com instead of www.example.com&#10;&#10;2.If you are unable to load any pages, check your computer’s network connection.&#10;&#10;3.If your computer or network is protected by a firewall or proxy, make sure that XR3Player is permitted to access the Web." wrapText="true" />
119-
<JFXButton fx:id="tryAgain" buttonType="RAISED" ripplerFill="#fa0c0c" text="Try Again">
122+
<TextArea editable="false" focusTraversable="false" maxHeight="-Infinity" maxWidth="-Infinity" mouseTransparent="true" text="&#10;1.Check the address for typing errors such as ww.example.com instead of www.example.com&#10;&#10;2.If you are unable to load any pages, check your computer’s network connection.&#10;&#10;3.If your computer or network is protected by a firewall or proxy, make sure that XR3Player is permitted to access the Web." wrapText="true">
123+
<VBox.margin>
124+
<Insets left="5.0" right="5.0" />
125+
</VBox.margin></TextArea>
126+
<JFXButton fx:id="tryAgain" buttonType="RAISED" contentDisplay="RIGHT" ripplerFill="#fa0c0c" text="Try Again">
120127
<cursor>
121128
<Cursor fx:constant="HAND" />
122129
</cursor>
130+
<graphic>
131+
<ProgressIndicator fx:id="tryAgainIndicator" styleClass="dropbox-progress-indicator" visible="false" />
132+
</graphic>
123133
</JFXButton>
124134
</children>
125135
</VBox>

src/main/java/assembly/assembly.xml

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/main/java/com/goxr3plus/javafxwebbrowser/browser/WebBrowserTabController.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import javafx.scene.control.ComboBox;
3434
import javafx.scene.control.Label;
3535
import javafx.scene.control.ProgressBar;
36+
import javafx.scene.control.ProgressIndicator;
3637
import javafx.scene.control.Tab;
3738
import javafx.scene.control.TextField;
3839
import javafx.scene.control.Tooltip;
@@ -96,6 +97,9 @@ public class WebBrowserTabController extends StackPane {
9697

9798
@FXML
9899
private JFXButton tryAgain;
100+
101+
@FXML
102+
private ProgressIndicator tryAgainIndicator;
99103

100104
// -------------------------------------------------------------
101105

@@ -429,13 +433,19 @@ public VBox getErrorPane() {
429433
*/
430434
void checkForInternetConnection() {
431435

436+
//tryAgainIndicator
437+
tryAgainIndicator.setVisible(true);
438+
432439
//Check for internet connection
433440
Thread thread = new Thread(() -> {
434441
boolean hasInternet = InfoTool.isReachableByPing("www.google.com");
435442
Platform.runLater(() -> {
436443
errorPane.setVisible(!hasInternet);
437-
if (hasInternet)
438-
reloadWebSite();
444+
tryAgainIndicator.setVisible(false);
445+
446+
//Reload the website if it has internet
447+
if(hasInternet)
448+
reloadWebSite();
439449
});
440450
}, "Internet Connection Tester Thread");
441451
thread.setDaemon(true);

0 commit comments

Comments
 (0)