title: Test for Loading message
body: <p>I created this simple test for loading Java Object. But unfortunately I cannot use it for large scale test with SQL queries. </p>
  
  <pre><code>import javafx.application.Application;
  import static javafx.application.Application.launch;
  import javafx.collections.ObservableList;
  import javafx.concurrent.Service;
  import javafx.concurrent.Task;
  import javafx.event.ActionEvent;
  import javafx.event.EventHandler;
  import javafx.geometry.Insets;
  import javafx.geometry.Pos;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.control.Label;
  import javafx.scene.control.ProgressIndicator;
  import javafx.scene.control.Tab;
  import javafx.scene.control.TabPane;
  import javafx.scene.layout.HBox;
  import javafx.scene.layout.Region;
  import javafx.scene.layout.StackPane;
  import javafx.stage.Stage;
  
  public class MainApp extends Application
  {
  
      GetDailySalesService service = new GetDailySalesService();
      TestData obj;
  
      @Override
      public void start(Stage stage) throws Exception
      {
  
          obj = new TestData();
  
          HBox hb = new HBox(100);
  
          Tab tabA = new Tab("test");
  
          Button button = new Button("Test");
  
          ///////////
          Region veil = new Region();
          veil.setStyle("-fx-background-color: rgba(0, 0, 0, 0.4)");
          veil.setPrefSize(240, 160);
          ProgressIndicator p = new ProgressIndicator();
          p.setMaxSize(140, 140);
  
          p.progressProperty().bind(service.progressProperty());
          veil.visibleProperty().bind(service.runningProperty());
          p.visibleProperty().bind(service.runningProperty());
          //tableView.itemsProperty().bind(service.valueProperty());
          //tableView.setMinSize(240, 140);
          StackPane stack = new StackPane();
          stack.getChildren().addAll(obj.someData(), veil, p);
  
          service.start();
  
          //////////////////
          button.setOnAction(new EventHandler&lt;ActionEvent&gt;()
          {
              @Override
              public void handle(ActionEvent e)
              {
                  tabA.setContent(stack);
              }
          });
  
          TabPane tb = new TabPane();
          tb.setPrefSize(300, 300);
  
          tb.getTabs().add(tabA);
  
          hb.getChildren().addAll(button, tb);
  
          hb.setPadding(new Insets(20, 20, 20, 20));
          hb.setAlignment(Pos.CENTER);
          Scene scene = new Scene(hb, 500, 300);
  
          stage.setTitle("JavaFX and Maven");
          stage.setScene(scene);
          stage.show();
      }
  
      public static void main(String[] args)
      {
          launch(args);
      }
  
      class TestData
      {
  
          public Label someData() throws InterruptedException
          {
  
              Label lb = new Label("It's working!!!!");
  
              Thread.sleep(6000);
  
              return lb;
          }
      }
  
      class GetDailySalesService extends Service&lt;ObservableList&lt;Object&gt;&gt;
      {
  
          @Override
          protected Task createTask()
          {
              return new GetDailySalesTask();
          }
      }
  
      class GetDailySalesTask extends Task&lt;ObservableList&lt;Object&gt;&gt;
      {
  
          @Override
          protected ObservableList&lt;Object&gt; call() throws Exception
          {
  
              return (ObservableList&lt;Object&gt;) obj.someData();
          }
      }
  }
  </code></pre>
  
  <p>Can you tell me that is the proper way to implement this test and improve the code.</p>