Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to make Loading Scene before application window in javaFx?

ekocbiyikOct 20 2016 — edited Oct 21 2016

I am triying to create a loading window before real application window openning. There is a progressBar in the loading scene and it is undeterminate.

Problem is that; progressbar does not work until the real window open when i execute the program.

by the way i tried preloader class, but also not works too.

here is my code;

public class MainApp2 extends Application {

   private Stage loadingStage = new Stage();

  public static void main(String[] args) {

   launch(args);
   }

   public void start(final Stage mainStage) throws Exception {

  loadingScreen();
   appScreen();
   }

   private void loadingScreen() {

   new Task<Void>() {

   @Override
   protected Void call() throws Exception {

  ProgressBar bar = new ProgressBar(ProgressIndicator.INDETERMINATE_PROGRESS);
   bar.setPrefWidth(300);
   bar.setPrefHeight(200);
   loadingStage.initStyle(StageStyle.TRANSPARENT);
   loadingStage.initStyle(StageStyle.UNDECORATED);
   loadingStage.setScene(new Scene(bar));
   loadingStage.show();
  return null;
   }

  }.run();
   }

   private void appScreen() {

   new Task<Void>() {

   @Override
   protected Void call() throws Exception {

  Stage mainStage = new Stage();
   //get real window
   Scene root = new Scene(new MyAppWindow().getAppWindow());
   mainStage.setScene(root);
   mainStage.centerOnScreen();
   mainStage.show();
// loadingStage.close();
   return null;
   }

  }.run();
   }

   public class MyAppWindow {

   public BorderPane getAppWindow(){

  System.out.println("may be initialize take a long time...");
  for (int i = 0; i < 90000000; i++) {

  System.out.print("");
   }

   return new BorderPane(new Label("Here is real application Window!"));
   }

  }

}

public class MainApp2 extends Application {

   private static double SCREEN_WIDTH = 800;
  private static double SCREEN_HEIGHT = 600;

  private Stage loadingStage = new Stage();

  public static void main(String[] args) {

   launch(args);
   }

   public void start(final Stage mainStage) throws Exception {

  loadingScreen();
   appScreen(mainStage);
   }

  JFrame loading;
  private void loadingScreen() {

   loading = new JFrame();
   URL url = this.getClass().getResource("/images/loading.gif");
   Icon icon = new ImageIcon(url);
   JLabel label = new JLabel(icon);
   loading.setUndecorated(true);
   loading.getContentPane().add(label);
   loading.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   loading.pack();
   loading.setLocationRelativeTo(null);
   loading.setVisible(true);
   }

   private void appScreen(final Stage mainStage) {

  Platform.runLater(new Runnable() {

   public void run() {

   //get real window
   Scene root = new Scene(new AppWindow().getAppWindow());
   mainStage.setScene(root);

   mainStage.setTitle("MTA");
   mainStage.setWidth(SCREEN_WIDTH);
   mainStage.setHeight(SCREEN_HEIGHT);
   mainStage.setMinWidth(SCREEN_WIDTH);
   mainStage.setMinHeight(SCREEN_HEIGHT);
   mainStage.centerOnScreen();
   mainStage.show();

   //....
   loading.setVisible(false);
   }

  });
   }

}

Message was edited by: ekocbiyik

This post has been answered by ekocbiyik on Oct 20 2016
Jump to Answer

Comments

ReportsToolsComponent is not a Server, it contains backing files for Reports Builder, font files.
Repeat your steps with below command.
createReportsServerInstance(instanceName='frm_rep_servr_hostname',machine='AdminServerMachine')
Thanks, Suresh

Tony007

./wlst.sh

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> connect("weblogic","ofrwls12","hostname:7001")
Connecting to t3://hostname:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "Fr_domain".

Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead.

wls:/Fr_domain/serverConfig/> createReportsServerInstance(instanceName='frm_rep_servr_hostname02',machine='AdminServerMachine')
Location changed to edit custom tree. This is a writable tree with No root.
For more help, use help('editCustom')

Starting an edit session ...
Started edit session, be sure to save and activate your changes once you are done.
Saving all your changes ...
Saved all your changes successfully.
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released once the activation is completed.
Activation completed
Reports Server instance "frm_rep_servr_hostname02" was successfully created.

/rwdiag.sh -FindAll

Reading the rwnetwork.conf from :/usr1/Oracle/Middleware/Oracle_Home/user_projects/domains/Fr_domain/config/fmwconfig/components/ReportsToolsComponent/frm_rep_servr_hostname01/rwnetwork.conf
Broadcast mechanism used to locate servers
------------------------------------------
Channel address = 228.5.6.7
Channel port = 14021

/usr1/Oracle/Middleware/Oracle_Home/user_projects/domains/Fr_domain/bin/startComponent.sh frm_rep_servr_hostname02
Rerun /rwdiag.sh -FindAll

Tony007

i did that still empty

rwdiag.sh can never return empty. The script should exit with REP-50503 or REP-50504
The script reads rwnetwork from frm_rep_servr_hostname01, so COMPONENT_NAME is correctly configured.
Double check if rwdiag.sh is running from /usr1/Oracle/Middleware/Oracle_Home/user_projects/domains/Fr_domain/reports/bin
Do you see the linux process for frm_rep_servr_hostname02?
What do you get when you run below.
http://<hostname>:<wls_reports_port>/reports/rwservlet/showjobs?server=frm_rep_servr_hostname02

Tony007

am geting

http://<hostname>:<wls_reports_port>/reports/rwservlet/showjobs?server=frm_rep_servr_hostname02

Did this answer the question? Yes No
REP-51002: Bind to Reports Server frm_rep_servr_hostname02 failed.

1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 18 2016
Added on Oct 20 2016
3 comments
1,074 views