Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.67 KB | None | 0 0
  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 Text jumlahBeli = new Text("");
  24.     public Cetak(Text namaBarang, Text jumlah, Text TotalHarga)
  25.     {
  26.         NamaBarang = namaBarang;
  27.         TotalHargaText = TotalHarga;
  28.         jumlahBeli = jumlah;
  29.     }
  30.    
  31.     public void showCetak()
  32.     {
  33.         Stage stage = new Stage();
  34.         Scene scene = new Scene(new Group(), 500, 250);
  35.         stage.setTitle("Nota");
  36.        
  37.         GridPane grid = new GridPane();
  38.         grid.setVgap(10);
  39.         grid.setHgap(15);
  40.         grid.setPadding(new Insets(10, 10, 10, 10));
  41.         grid.add(new Label("Detail Pembelian"), 0, 0);
  42.         grid.add(new Label("Nama Barang :"), 0, 1);
  43.         grid.add(NamaBarang, 1, 1);
  44.         grid.add(new Label("Jumlah   :"), 0,  2);
  45.         grid.add(jumlahBeli, 1, 2);
  46.         grid.add(new Label("Total Harga   :"), 0, 3);
  47.         grid.add(TotalHargaText, 1, 3);
  48.        
  49.         Group root = (Group)scene.getRoot();
  50.         root.getChildren().add(grid);
  51.         stage.setScene(scene);
  52.         stage.show();
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement