JavaFX WebView + building a web browser 🌐

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ม.ค. 2025

ความคิดเห็น • 52

  • @BroCodez
    @BroCodez  3 ปีที่แล้ว +28

    Be sure to add the following to VM arguments: --add-modules javafx.web
    package application;
    import java.net.URL;
    import java.util.ResourceBundle;
    import javafx.collections.ObservableList;
    import javafx.fxml.FXML;
    import javafx.fxml.Initializable;
    import javafx.scene.control.Button;
    import javafx.scene.control.TextField;
    import javafx.scene.web.WebEngine;
    import javafx.scene.web.WebHistory;
    import javafx.scene.web.WebView;
    public class Controller implements Initializable{
    @FXML
    private WebView webView;
    @FXML
    private TextField textField;

    private WebEngine engine;
    private WebHistory history;
    private String homePage;
    private double webZoom;

    @Override
    public void initialize(URL arg0, ResourceBundle arg1) {

    engine = webView.getEngine();
    homePage = "www.google.com";
    textField.setText(homePage);
    webZoom = 1;
    loadPage();
    }

    public void loadPage() {

    //engine.load("www.google.com");
    engine.load(""+textField.getText());
    }

    public void refreshPage() {

    engine.reload();
    }

    public void zoomIn() {

    webZoom+=0.25;
    webView.setZoom(webZoom);
    }

    public void zoomOut() {

    webZoom-=0.25;
    webView.setZoom(webZoom);
    }

    public void displayHistory() {

    history = engine.getHistory();
    ObservableList entries = history.getEntries();

    for(WebHistory.Entry entry : entries) {

    //System.out.println(entry);
    System.out.println(entry.getUrl()+" "+entry.getLastVisitedDate());
    }
    }

    public void back() {

    history = engine.getHistory();
    ObservableList entries = history.getEntries();
    history.go(-1);

    textField.setText(entries.get(history.getCurrentIndex()).getUrl());
    }

    public void forward() {

    history = engine.getHistory();
    ObservableList entries = history.getEntries();
    history.go(1);

    textField.setText(entries.get(history.getCurrentIndex()).getUrl());
    }

    public void executeJS() {

    engine.executeScript("window.location = \"www.youtube.com\";");
    }
    }












    package application;

    import java.io.IOException;
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.fxml.FXMLLoader;
    import javafx.stage.Stage;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.scene.image.Image;
    import javafx.scene.input.KeyEvent;
    public class Main extends Application {

    @Override
    public void start(Stage stage) throws IOException {

    FXMLLoader loader = new FXMLLoader(getClass().getResource("Scene.fxml"));
    Parent root = loader.load();
    Controller controller = loader.getController();
    Scene scene = new Scene(root);

    //stage.getIcons().add(new Image("icon.png"));
    //stage.setTitle("Bro web browser");
    stage.setScene(scene);
    stage.show();
    }
    public static void main(String[] args) {

    launch(args);
    }
    }

    • @NowThatsAnime
      @NowThatsAnime 8 หลายเดือนก่อน

      @BroCodez does it export in jar or exe?

  • @vklmao8677
    @vklmao8677 3 ปีที่แล้ว +12

    This Man is an Absolute LEGEND..!!
    One Day you will get for what you have worked hard for.

  • @stywenoider7436
    @stywenoider7436 3 ปีที่แล้ว +5

    Soo happy to see you thriving, i remeber u only had 10 k subs but the vids... fkin insane content, happy to see 40k wp sir, which means the good content keeps on comming up ... anyways gratz on hitting 40k and keep up the good work !

  • @anirudhunleashes8497
    @anirudhunleashes8497 3 ปีที่แล้ว +3

    Hello Sir,
    Thank You So Much for the tutorial,
    It really Helped Me A Lot,
    Your Videos Are very Useful for programming,
    KEEP GOING Sir,
    THANK YOU SIR !!!!!

  • @manipurihunabopa
    @manipurihunabopa ปีที่แล้ว

    Bro you are amazing. Excellent at all the programming languages. You can talk to a computer in various languages. You resigned your luck

  • @kaliboboisrael4092
    @kaliboboisrael4092 2 ปีที่แล้ว

    Hello Bro,
    I love watching and learning from your videos....thanks

  • @GANESHRAWATZ
    @GANESHRAWATZ หลายเดือนก่อน

    Wow ❤

  • @Mr-Kind-au
    @Mr-Kind-au ปีที่แล้ว +1

    Pretty good Bro. Bro code is the best.

    • @Mr-Kind-au
      @Mr-Kind-au ปีที่แล้ว

      What version are you using?

  • @gajeshtripathi5721
    @gajeshtripathi5721 ปีที่แล้ว +1

    Nice learning.. which IDE is being used as a Scene Builder?c, plz answer

  • @brucelamb6060
    @brucelamb6060 10 หลายเดือนก่อน

    Nice! This is breaking into the web scraping!
    Do you have a video that covers maintaining login session or/and cookie data?

  • @massblabla
    @massblabla 2 ปีที่แล้ว +1

    I commented from my browser!👍

  • @paulopaulopaulopaulopaulo0
    @paulopaulopaulopaulopaulo0 2 ปีที่แล้ว

    you helped me so much thanks

  • @tolgaocal3281
    @tolgaocal3281 3 ปีที่แล้ว +1

    You are da man, would you make some Android game creating tutorials if you doing it ?

    • @BroCodez
      @BroCodez  3 ปีที่แล้ว +4

      Haven't thought that far ahead yet

    • @tolgaocal3281
      @tolgaocal3281 3 ปีที่แล้ว +1

      @taste01 nope, not meant that, using Libgdx, or normal Android studio using java

  • @מכוןאם
    @מכוןאם 2 ปีที่แล้ว

    Thank you very much a really good guide. How do I upload a webpage without photos and videos? And how do I block ads from the page?

  • @ARMIAAK100
    @ARMIAAK100 3 ปีที่แล้ว +1

    Can you make a simple video editor 😊

  • @manipurihunabopa
    @manipurihunabopa ปีที่แล้ว

    What do you do for your career Bro?

  • @oscarbarrios6567
    @oscarbarrios6567 2 ปีที่แล้ว

    Great content!
    it is posiblle to send data from a webpage to the app? e.g click on a button and receive a json from the javascript webapp

  • @trillius
    @trillius 2 ปีที่แล้ว +1

    Thnx!

  • @angbui8027
    @angbui8027 10 หลายเดือนก่อน

    thank you so much

  • @ЙирюВонаирда
    @ЙирюВонаирда 3 ปีที่แล้ว

    Hello, Bro.
    Wanna ask you about this FX stuff and all. Currently is there any sense in using swing? Or FX is the better and bestiest and all?
    Didnt find a video about trees in swing-playlist and so want to ask this.

  • @adityarajsrivastava6580
    @adityarajsrivastava6580 3 ปีที่แล้ว +2

    wow this video I can't beleve how it made

  • @sethg7336
    @sethg7336 3 ปีที่แล้ว

    Thank you Bro

  • @mohdanc
    @mohdanc 3 ปีที่แล้ว

    Love you * infinity man

  • @alberthall7156
    @alberthall7156 3 ปีที่แล้ว

    At the end of the video it is stated that the code for this project will be available in the Comments section, but there is none. Has this been removed or is it available elsewhwere?

  • @yusef3132
    @yusef3132 ปีที่แล้ว

    How does one add widevine support? Does this browser support hosts file by default?

  • @paulopaulopaulopaulopaulo0
    @paulopaulopaulopaulopaulo0 2 ปีที่แล้ว

    hey, and when the site shows a pop-up, how do i show it in my javafx application?

  • @Sterreeler
    @Sterreeler 2 ปีที่แล้ว

    Hi Sir, is it possible to make the webEngine Page background color to transparent? I want only the texts to show in the loaded html page. Thanks

  • @lockstrote1
    @lockstrote1 2 ปีที่แล้ว

    I noticed when the computer is connected through VPN the webpage does not load. How to resolve it?

  • @ЦветелинМаринов-е3з
    @ЦветелинМаринов-е3з ปีที่แล้ว

    Bro please when i try to add module to a run configuration its shows that module java fx not found

  • @hypermeero4782
    @hypermeero4782 3 ปีที่แล้ว

    how do we change the icon of the webview

  • @werq27
    @werq27 ปีที่แล้ว

    thx Bro!

  • @vishwak1812
    @vishwak1812 3 ปีที่แล้ว

    Hi bro I have a doubt? WebView is working fine how to allow download a file. In my Application I need to download .csv file can u please make a video for that....

  • @amishkumaraman
    @amishkumaraman 3 ปีที่แล้ว

    How to reload current selected tab only by pressing f5 with diff url on each tab

  • @dragoniz_
    @dragoniz_ 3 ปีที่แล้ว +1

    poggers

  • @mahmoudhasan6590
    @mahmoudhasan6590 ปีที่แล้ว

    import java.scene.Web.WebView; isn't there...
    how can I fix it ?

  • @-0-__-0-
    @-0-__-0- 2 ปีที่แล้ว

    Hi, is there any way to run a javaFx app on the browser?

  • @rupeshlakhat3026
    @rupeshlakhat3026 3 ปีที่แล้ว

    sir please make video Auto-detects videos download and Downloading while in own browsing the web.
    please sir make this video

  • @jakeadams9973
    @jakeadams9973 3 ปีที่แล้ว +1

    source code doesnt work in my eclipse Caused by: java.lang.ClassNotFoundException: application.Controller
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:930)
    ... 17 more

  • @jaylordjl6337
    @jaylordjl6337 3 ปีที่แล้ว

    I hope bro that you’ll going to upload a video that connects DB in Java

  • @averageheightwizard4798
    @averageheightwizard4798 3 ปีที่แล้ว +6

    Hmmm... interesting... this dude coded google in 3 minutes

    • @BroCodez
      @BroCodez  3 ปีที่แล้ว +7

      plz hire me NASA

    • @DetCoAnimeFan
      @DetCoAnimeFan 3 ปีที่แล้ว +3

      ITs a browser, google is a search engine and running search engines requires billions of dollars invested and several supercomputers working.

    • @MO-R-70-23
      @MO-R-70-23 ปีที่แล้ว +3

      ​@@DetCoAnimeFanIt's a joke

  • @Delay097
    @Delay097 11 หลายเดือนก่อน

    i'll be here in a month... (March 2nd of 2024)

  • @ИльяТарасов-р6ф
    @ИльяТарасов-р6ф 3 ปีที่แล้ว

    Дрбавь Русские субтитры пожалуйста)🎲⚄⚀