Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import javafx.application.Application;
  2. import javafx.application.Platform;
  3. import javafx.event.ActionEvent;
  4. import javafx.event.EventHandler;
  5. import javafx.geometry.Insets;
  6. import javafx.geometry.Pos;
  7. import javafx.scene.Scene;
  8. import javafx.scene.control.*;
  9. import javafx.scene.layout.*;
  10. import javafx.scene.text.Font;
  11. import javafx.scene.text.Text;
  12. import javafx.stage.Stage;
  13. import javafx.scene.layout.StackPane;
  14. import javafx.collections.*;
  15. import javafx.scene.paint.*;
  16. import javafx.scene.text.*;
  17. import javafx.scene.Group;
  18. import java.util.Random;
  19.  
  20. public class Cetak
  21. {
  22. private Text NamaBarang = new Text(""), TotalHargaText = new Text("");
  23. private String jumlahBeli;
  24. public Cetak(Text namaBarang, String jumlah, Text TotalHarga)
  25. {
  26. NamaBarang = namaBarang;
  27. TotalHargaText = TotalHarga;
  28. jumlahBeli = jumlah;
  29. }
  30. public void showCetak()
  31. {
  32. Stage stage = new Stage();
  33. Scene scene = new Scene(new Group(), 500, 250);
  34. stage.setTitle("Nota");
  35.  
  36. GridPane grid = new GridPane();
  37. grid.setVgap(10);
  38. grid.setHgap(15);
  39. grid.setPadding(new Insets(10, 10, 10, 10));
  40. grid.add(new Label("Pembelian"),0,0);
  41. grid.add(NamaBarang,0,1);
  42. grid.add(new Label(jumlahBeli),1,1);
  43. grid.add(new Label("Harga"),0,2);
  44.  
  45. grid.add(TotalHargaText,1,2);
  46.  
  47. Group root = (Group)scene.getRoot();
  48. root.getChildren().add(grid);
  49. stage.setScene(scene);
  50. stage.show();
  51. }
  52. }