added some frontend func

This commit is contained in:
shaggy3007 2023-10-16 18:08:25 +02:00
parent 8886a7ee37
commit b95287d193
5 changed files with 97 additions and 0 deletions

View File

@ -5,6 +5,11 @@
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JavaFX">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="Elaborato_IS/src"/>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER">
<attributes>

View File

@ -0,0 +1,32 @@
package ClientApp;
import java.util.HashMap;
import java.util.Map;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Text;
public abstract class AbstractAppPane implements AppPane {
protected GridPane pannello = new GridPane();
protected Map<String,Text> Texts = new HashMap<>();
protected Scene scena = new Scene(pannello);
protected int heigth, width, insets;
@Override
abstract public void gridSetup();
@Override
public void textFill(Iterable<String> A) {
for (String s : A) {
Texts.put(s, new Text(s));
}
}
public Scene getScene() {
return scena;
}
}

View File

@ -0,0 +1,9 @@
package ClientApp;
import javafx.scene.Scene;
public interface AppPane {
public void gridSetup();
public void textFill(Iterable<String> A);
public Scene getScene();
}

View File

@ -0,0 +1,32 @@
package ClientApp;
import java.util.ArrayList;
import java.util.List;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
public class RegPane extends AbstractAppPane {
@Override
public void gridSetup() {
pannello.setMinHeight(width);
pannello.setMinWidth(heigth);
pannello.setPadding(new Insets(insets));
pannello.setVgap(5);
pannello.setHgap(5);
pannello.setAlignment(Pos.CENTER);
}
public RegPane (int insets, int width, int heigth, String ... S) {
this.width = width;
this.heigth = heigth;
this.insets = insets;
List<String> L = new ArrayList<>();
for (String s: S) {
L.add(s);
}
textFill(L);
}
}

View File

@ -0,0 +1,19 @@
package ClientApp;
import javafx.application.Application;
import javafx.stage.Stage;
public class TestMain extends Application{
public static void main(String args[]) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
AppPane Register = new RegPane(10, 500, 500, "ciao", "bello");
stage.setScene(Register.getScene());
stage.show();
}
}