JavaFX Erstelle einen Wald

Fab4guy

Mitglied
Hallo zusammen,

ich habe eine Aufgabe bekommen, bei der ich aktuell nicht weiter komme.
Sie besteht darin mit JavaFx einen "Wald" zu erstellen.
Siehe Aufgabestellung.
aufgabe.JPG
So sieht aktuell mein Programm aus.
Sprich, wenn ich die Leertaste drücke wird ein "Baum"-Polygon erstellt und auf die Arbeitsfläche eingefügt.
loesung.JPG
Was mir nicht ganz klar ist, wie ich drei von den Polygonen so ineinander versetzt bekomme wie auf der Aufgabenstellung gezeigt und wie ich das Image dann noch darauf klatsche.
Ebenso Frage ich mich wie ich eine "Bodenfläche" von 200x200 Meter erstelle.

Wäre cool wenn mir jemand ein paar Tipps, Hinweisen geben könnte.

Viele Grüße
 

JCODA

Top Contributor
Ich kenn mich damit nicht wirklich aus, ich hab mal die SampleApp von der Website genommen, und dort eine Ebene mit Ausdehnung 200x200 eingefügt. Vielleicht hilft dir das. Du könntest auch mal deinen Bisherigen Code posten.

Java:
/*
* Copyright (c) 2013, 2014 Oracle and/or its affiliates.
* All rights reserved. Use is subject to license terms.
*
* This file is available and licensed under the following license:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*  - Redistributions of source code must retain the above copyright
*    notice, this list of conditions and the following disclaimer.
*  - Redistributions in binary form must reproduce the above copyright
*    notice, this list of conditions and the following disclaimer in
*    the documentation and/or other materials provided with the distribution.
*  - Neither the name of Oracle nor the names of its
*    contributors may be used to endorse or promote products derived
*    from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/



import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Box;
import javafx.scene.shape.Cylinder;
import javafx.scene.shape.Sphere;
import javafx.scene.transform.Rotate;
import javafx.event.EventHandler;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;

/**
*
* @author cmcastil
*/
public class PlaneSampleApp extends Application {

    final Group root = new Group();
    final Xform axisGroup = new Xform();
    final Xform sceneGroup = new Xform();
    final Xform world = new Xform();
    final PerspectiveCamera camera = new PerspectiveCamera(true);
    final Xform cameraXform = new Xform();
    final Xform cameraXform2 = new Xform();
    final Xform cameraXform3 = new Xform();
    private static final double CAMERA_INITIAL_DISTANCE = -450;
    private static final double CAMERA_INITIAL_X_ANGLE = 70.0;
    private static final double CAMERA_INITIAL_Y_ANGLE = 320.0;
    private static final double CAMERA_NEAR_CLIP = 0.1;
    private static final double CAMERA_FAR_CLIP = 10000.0;
    private static final double AXIS_LENGTH = 250.0;
    private static final double CONTROL_MULTIPLIER = 0.1;
    private static final double SHIFT_MULTIPLIER = 10.0;
    private static final double MOUSE_SPEED = 0.1;
    private static final double ROTATION_SPEED = 2.0;
    private static final double TRACK_SPEED = 0.3;
   
    double mousePosX;
    double mousePosY;
    double mouseOldX;
    double mouseOldY;
    double mouseDeltaX;
    double mouseDeltaY;
   
    //   private void buildScene() {
    //       root.getChildren().add(world);
    //   }
    private void buildCamera() {
        System.out.println("buildCamera()");
        root.getChildren().add(cameraXform);
        cameraXform.getChildren().add(cameraXform2);
        cameraXform2.getChildren().add(cameraXform3);
        cameraXform3.getChildren().add(camera);
        cameraXform3.setRotateZ(180.0);

        camera.setNearClip(CAMERA_NEAR_CLIP);
        camera.setFarClip(CAMERA_FAR_CLIP);
        camera.setTranslateZ(CAMERA_INITIAL_DISTANCE);
        cameraXform.ry.setAngle(CAMERA_INITIAL_Y_ANGLE);
        cameraXform.rx.setAngle(CAMERA_INITIAL_X_ANGLE);
    }

    private void buildAxes() {
        System.out.println("buildAxes()");
        final PhongMaterial redMaterial = new PhongMaterial();
        redMaterial.setDiffuseColor(Color.DARKRED);
        redMaterial.setSpecularColor(Color.RED);

        final PhongMaterial greenMaterial = new PhongMaterial();
        greenMaterial.setDiffuseColor(Color.DARKGREEN);
        greenMaterial.setSpecularColor(Color.GREEN);

        final PhongMaterial blueMaterial = new PhongMaterial();
        blueMaterial.setDiffuseColor(Color.DARKBLUE);
        blueMaterial.setSpecularColor(Color.BLUE);

        final Box xAxis = new Box(AXIS_LENGTH, 1, 1);
        final Box yAxis = new Box(1, AXIS_LENGTH, 1);
        final Box zAxis = new Box(1, 1, AXIS_LENGTH);

        xAxis.setMaterial(redMaterial);
        yAxis.setMaterial(greenMaterial);
        zAxis.setMaterial(blueMaterial);

        axisGroup.getChildren().addAll(xAxis, yAxis, zAxis);
        //axisGroup.setVisible(false);
        world.getChildren().addAll(axisGroup);
    }

    private void handleMouse(Scene scene, final Node root) {
        scene.setOnMousePressed(new EventHandler<MouseEvent>() {
            @Override public void handle(MouseEvent me) {
                mousePosX = me.getSceneX();
                mousePosY = me.getSceneY();
                mouseOldX = me.getSceneX();
                mouseOldY = me.getSceneY();
            }
        });
        scene.setOnMouseDragged(new EventHandler<MouseEvent>() {
            @Override public void handle(MouseEvent me) {
                mouseOldX = mousePosX;
                mouseOldY = mousePosY;
                mousePosX = me.getSceneX();
                mousePosY = me.getSceneY();
                mouseDeltaX = (mousePosX - mouseOldX);
                mouseDeltaY = (mousePosY - mouseOldY);
               
                double modifier = 1.0;
               
                if (me.isControlDown()) {
                    modifier = CONTROL_MULTIPLIER;
                }
                if (me.isShiftDown()) {
                    modifier = SHIFT_MULTIPLIER;
                }    
                if (me.isPrimaryButtonDown()) {
                    cameraXform.ry.setAngle(cameraXform.ry.getAngle() - mouseDeltaX*MOUSE_SPEED*modifier*ROTATION_SPEED); 
                    cameraXform.rx.setAngle(cameraXform.rx.getAngle() + mouseDeltaY*MOUSE_SPEED*modifier*ROTATION_SPEED); 
                }
                else if (me.isSecondaryButtonDown()) {
                    double z = camera.getTranslateZ();
                    double newZ = z + mouseDeltaX*MOUSE_SPEED*modifier;
                    camera.setTranslateZ(newZ);
                }
                else if (me.isMiddleButtonDown()) {
                    cameraXform2.t.setX(cameraXform2.t.getX() + mouseDeltaX*MOUSE_SPEED*modifier*TRACK_SPEED); 
                    cameraXform2.t.setY(cameraXform2.t.getY() + mouseDeltaY*MOUSE_SPEED*modifier*TRACK_SPEED); 
                }
            }
        });
    }
   
    private void handleKeyboard(Scene scene, final Node root) {
        scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
            @Override
            public void handle(KeyEvent event) {
                switch (event.getCode()) {
                    case Z:
                        cameraXform2.t.setX(0.0);
                        cameraXform2.t.setY(0.0);
                        camera.setTranslateZ(CAMERA_INITIAL_DISTANCE);
                        cameraXform.ry.setAngle(CAMERA_INITIAL_Y_ANGLE);
                        cameraXform.rx.setAngle(CAMERA_INITIAL_X_ANGLE);
                        break;
                    case X:
                        axisGroup.setVisible(!axisGroup.isVisible());
                        break;
                    case V:
                        sceneGroup.setVisible(!sceneGroup.isVisible());
                        break;
                }
            }
        });
    }
   
    private void buildScene() {
        Xform sceneXform = new Xform();

        Box plane = new Box(200,1,200);
        sceneXform.getChildren().add(plane);
       
        sceneGroup.getChildren().add(sceneXform);

        world.getChildren().addAll(sceneGroup);
    }

    @Override
    public void start(Stage primaryStage) {
       
       // setUserAgentStylesheet(STYLESHEET_MODENA);
        System.out.println("start()");

        root.getChildren().add(world);
        root.setDepthTest(DepthTest.ENABLE);

        // buildScene();
        buildCamera();
        buildAxes();
        buildScene();

        Scene scene = new Scene(root, 1024, 768, true);
        scene.setFill(Color.GREY);
        handleKeyboard(scene, world);
        handleMouse(scene, world);

        primaryStage.setTitle("Molecule Sample Application");
        primaryStage.setScene(scene);
        primaryStage.show();

        scene.setCamera(camera);
    }

    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }

}
Java:
/*
* Copyright (c) 2013, 2014 Oracle and/or its affiliates.
* All rights reserved. Use is subject to license terms.
*
* This file is available and licensed under the following license:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*  - Redistributions of source code must retain the above copyright
*    notice, this list of conditions and the following disclaimer.
*  - Redistributions in binary form must reproduce the above copyright
*    notice, this list of conditions and the following disclaimer in
*    the documentation and/or other materials provided with the distribution.
*  - Neither the name of Oracle nor the names of its
*    contributors may be used to endorse or promote products derived
*    from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/



import javafx.scene.Group;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Scale;
import javafx.scene.transform.Translate;

public class Xform extends Group {

    public enum RotateOrder {
        XYZ, XZY, YXZ, YZX, ZXY, ZYX
    }

    public Translate t  = new Translate();
    public Translate p  = new Translate();
    public Translate ip = new Translate();
    public Rotate rx = new Rotate();
    { rx.setAxis(Rotate.X_AXIS); }
    public Rotate ry = new Rotate();
    { ry.setAxis(Rotate.Y_AXIS); }
    public Rotate rz = new Rotate();
    { rz.setAxis(Rotate.Z_AXIS); }
    public Scale s = new Scale();

    public Xform() {
        super();
        getTransforms().addAll(t, rz, ry, rx, s);
    }

    public Xform(RotateOrder rotateOrder) {
        super();
        // choose the order of rotations based on the rotateOrder
        switch (rotateOrder) {
        case XYZ:
            getTransforms().addAll(t, p, rz, ry, rx, s, ip);
            break;
        case XZY:
            getTransforms().addAll(t, p, ry, rz, rx, s, ip);
            break;
        case YXZ:
            getTransforms().addAll(t, p, rz, rx, ry, s, ip);
            break;
        case YZX:
            getTransforms().addAll(t, p, rx, rz, ry, s, ip);  // For Camera
            break;
        case ZXY:
            getTransforms().addAll(t, p, ry, rx, rz, s, ip);
            break;
        case ZYX:
            getTransforms().addAll(t, p, rx, ry, rz, s, ip);
            break;
        }
    }

    public void setTranslate(double x, double y, double z) {
        t.setX(x);
        t.setY(y);
        t.setZ(z);
    }

    public void setTranslate(double x, double y) {
        t.setX(x);
        t.setY(y);
    }

    // Cannot override these methods as they are final:
    // public void setTranslateX(double x) { t.setX(x); }
    // public void setTranslateY(double y) { t.setY(y); }
    // public void setTranslateZ(double z) { t.setZ(z); }
    // Use these methods instead:
    public void setTx(double x) { t.setX(x); }
    public void setTy(double y) { t.setY(y); }
    public void setTz(double z) { t.setZ(z); }

    public void setRotate(double x, double y, double z) {
        rx.setAngle(x);
        ry.setAngle(y);
        rz.setAngle(z);
    }

    public void setRotateX(double x) { rx.setAngle(x); }
    public void setRotateY(double y) { ry.setAngle(y); }
    public void setRotateZ(double z) { rz.setAngle(z); }
    public void setRx(double x) { rx.setAngle(x); }
    public void setRy(double y) { ry.setAngle(y); }
    public void setRz(double z) { rz.setAngle(z); }

    public void setScale(double scaleFactor) {
        s.setX(scaleFactor);
        s.setY(scaleFactor);
        s.setZ(scaleFactor);
    }

    public void setScale(double x, double y, double z) {
        s.setX(x);
        s.setY(y);
        s.setZ(z);
    }

    // Cannot override these methods as they are final:
    // public void setScaleX(double x) { s.setX(x); }
    // public void setScaleY(double y) { s.setY(y); }
    // public void setScaleZ(double z) { s.setZ(z); }
    // Use these methods instead:
    public void setSx(double x) { s.setX(x); }
    public void setSy(double y) { s.setY(y); }
    public void setSz(double z) { s.setZ(z); }

    public void setPivot(double x, double y, double z) {
        p.setX(x);
        p.setY(y);
        p.setZ(z);
        ip.setX(-x);
        ip.setY(-y);
        ip.setZ(-z);
    }

    public void reset() {
        t.setX(0.0);
        t.setY(0.0);
        t.setZ(0.0);
        rx.setAngle(0.0);
        ry.setAngle(0.0);
        rz.setAngle(0.0);
        s.setX(1.0);
        s.setY(1.0);
        s.setZ(1.0);
        p.setX(0.0);
        p.setY(0.0);
        p.setZ(0.0);
        ip.setX(0.0);
        ip.setY(0.0);
        ip.setZ(0.0);
    }

    public void resetTSP() {
        t.setX(0.0);
        t.setY(0.0);
        t.setZ(0.0);
        s.setX(1.0);
        s.setY(1.0);
        s.setZ(1.0);
        p.setX(0.0);
        p.setY(0.0);
        p.setZ(0.0);
        ip.setX(0.0);
        ip.setY(0.0);
        ip.setZ(0.0);
    }

    @Override public String toString() {
        return "Xform[t = (" +
                           t.getX() + ", " +
                           t.getY() + ", " +
                           t.getZ() + ")  " +
                           "r = (" +
                           rx.getAngle() + ", " +
                           ry.getAngle() + ", " +
                           rz.getAngle() + ")  " +
                           "s = (" +
                           s.getX() + ", " +
                           s.getY() + ", " +
                           s.getZ() + ")  " +
                           "p = (" +
                           p.getX() + ", " +
                           p.getY() + ", " +
                           p.getZ() + ")  " +
                           "ip = (" +
                           ip.getX() + ", " +
                           ip.getY() + ", " +
                           ip.getZ() + ")]";
    }
}
 

Fab4guy

Mitglied
Das ist mein bisheriger Code.
Einmal die Klasse Main.java

Java:
package wood;

import java.util.Random;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.*;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;

public class Main extends Application {
   
    /**
     *
     * @param args
     */
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        Group root = new Group();
        Scene scene = new Scene(root, 1024, 768);
        Tree tree = new Tree();
   
       
//        PerspectiveCamera camera = new PerspectiveCamera(true);
//        camera.setTranslateZ(-1000);
//        camera.setNearClip(0.1);
//        camera.setFarClip(2000.0);
//        camera.setFieldOfView(35);
//        scene.setCamera(camera);   

        scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
           
            @Override
            public void handle(KeyEvent keyEvent) {
                if (keyEvent.getCode() == KeyCode.SPACE) {
                    root.getChildren().add(tree.createTree(getNewPosition()));
                }
            }
        });
//        scene.setRoot(root);
        primaryStage.setTitle("Wald");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    /**
     * @return array positions
     */
    private double[] getNewPosition() {
        double positions[] = {80.0, 80.0};
        Random rand = new Random();

        positions[0] = rand.nextInt(830) + 30;
        positions[1] = rand.nextInt(530) + 30;
       
        return positions;

    }

}


und einmal die Klasse Tree.java

Java:
package wood;

import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;

public class Tree {
   

/**
* @param array position
* @return
*/
    public Polygon createTree(double position[]) {
       
       
       
        Polygon treePolygon = new Polygon(new double[] {
                0.0,         0.0,         // P1
                0.0,         100.0,     // P2
                50.0,     100.0,     // P3
                50.0,     180.0,     // P4
                80.0,     180.0,     // P5
                80.0,     100.0,     // P6
                130.0,     100.0,     // P7
                130.0,     0.0,         // P8
        });
       
        treePolygon.setStrokeWidth(2);
        treePolygon.setStroke(Color.BLACK);
        treePolygon.setFill(Color.WHITE);

       
        treePolygon.setTranslateX(position[0]);
        treePolygon.setTranslateY(position[1]);

       
        return treePolygon;
    }
   
}
 

JCODA

Top Contributor
Das klappt sogar besser als ich dachte.. Ich denke du solltest dich mit dem 3D-Zeugs mehr beschäftigen. Du verwendest ja nirgends eine dritte Koordinate... Naja was solls... ich habs mal soweit:

Java:
/*
* Copyright (c) 2013, 2014 Oracle and/or its affiliates.
* All rights reserved. Use is subject to license terms.
*
* This file is available and licensed under the following license:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*  - Redistributions of source code must retain the above copyright
*    notice, this list of conditions and the following disclaimer.
*  - Redistributions in binary form must reproduce the above copyright
*    notice, this list of conditions and the following disclaimer in
*    the documentation and/or other materials provided with the distribution.
*  - Neither the name of Oracle nor the names of its
*    contributors may be used to endorse or promote products derived
*    from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/



import java.util.Random;

import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Box;
import javafx.scene.shape.Cylinder;
import javafx.scene.shape.Sphere;
import javafx.scene.transform.Rotate;
import javafx.event.EventHandler;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;

/**
*
* @author cmcastil
*/
public class PlaneSampleApp extends Application {

    final Group root = new Group();
    final Xform axisGroup = new Xform();
    final Xform sceneGroup = new Xform();
    final Xform world = new Xform();
    final PerspectiveCamera camera = new PerspectiveCamera(true);
    final Xform cameraXform = new Xform();
    final Xform cameraXform2 = new Xform();
    final Xform cameraXform3 = new Xform();
    private static final double CAMERA_INITIAL_DISTANCE = -450;
    private static final double CAMERA_INITIAL_X_ANGLE = 70.0;
    private static final double CAMERA_INITIAL_Y_ANGLE = 320.0;
    private static final double CAMERA_NEAR_CLIP = 0.1;
    private static final double CAMERA_FAR_CLIP = 10000.0;
    private static final double AXIS_LENGTH = 250.0;
    private static final double CONTROL_MULTIPLIER = 0.1;
    private static final double SHIFT_MULTIPLIER = 10.0;
    private static final double MOUSE_SPEED = 0.1;
    private static final double ROTATION_SPEED = 2.0;
    private static final double TRACK_SPEED = 0.3;
   
    double mousePosX;
    double mousePosY;
    double mouseOldX;
    double mouseOldY;
    double mouseDeltaX;
    double mouseDeltaY;
   
    //   private void buildScene() {
    //       root.getChildren().add(world);
    //   }
    private void buildCamera() {
        System.out.println("buildCamera()");
        root.getChildren().add(cameraXform);
        cameraXform.getChildren().add(cameraXform2);
        cameraXform2.getChildren().add(cameraXform3);
        cameraXform3.getChildren().add(camera);
        cameraXform3.setRotateZ(180.0);

        camera.setNearClip(CAMERA_NEAR_CLIP);
        camera.setFarClip(CAMERA_FAR_CLIP);
        camera.setTranslateZ(CAMERA_INITIAL_DISTANCE);
        cameraXform.ry.setAngle(CAMERA_INITIAL_Y_ANGLE);
        cameraXform.rx.setAngle(CAMERA_INITIAL_X_ANGLE);
    }

    private void buildAxes() {
        System.out.println("buildAxes()");
        final PhongMaterial redMaterial = new PhongMaterial();
        redMaterial.setDiffuseColor(Color.DARKRED);
        redMaterial.setSpecularColor(Color.RED);

        final PhongMaterial greenMaterial = new PhongMaterial();
        greenMaterial.setDiffuseColor(Color.DARKGREEN);
        greenMaterial.setSpecularColor(Color.GREEN);

        final PhongMaterial blueMaterial = new PhongMaterial();
        blueMaterial.setDiffuseColor(Color.DARKBLUE);
        blueMaterial.setSpecularColor(Color.BLUE);

        final Box xAxis = new Box(AXIS_LENGTH, 1, 1);
        final Box yAxis = new Box(1, AXIS_LENGTH, 1);
        final Box zAxis = new Box(1, 1, AXIS_LENGTH);

        xAxis.setMaterial(redMaterial);
        yAxis.setMaterial(greenMaterial);
        zAxis.setMaterial(blueMaterial);

        axisGroup.getChildren().addAll(xAxis, yAxis, zAxis);
        //axisGroup.setVisible(false);
        world.getChildren().addAll(axisGroup);
    }

    private int[] getNewPosition() {
        int positions[] = new int[2];
        Random rand = new Random();

        positions[0] = rand.nextInt(200) -100;
        positions[1] = rand.nextInt(200) -100;
      
        return positions;

    }
   
    private void handleMouse(Scene scene, final Node root) {
        scene.setOnMousePressed(new EventHandler<MouseEvent>() {
            @Override public void handle(MouseEvent me) {
                mousePosX = me.getSceneX();
                mousePosY = me.getSceneY();
                mouseOldX = me.getSceneX();
                mouseOldY = me.getSceneY();
            }
        });
        scene.setOnMouseDragged(new EventHandler<MouseEvent>() {
            @Override public void handle(MouseEvent me) {
                mouseOldX = mousePosX;
                mouseOldY = mousePosY;
                mousePosX = me.getSceneX();
                mousePosY = me.getSceneY();
                mouseDeltaX = (mousePosX - mouseOldX);
                mouseDeltaY = (mousePosY - mouseOldY);
               
                double modifier = 1.0;
               
                if (me.isControlDown()) {
                    modifier = CONTROL_MULTIPLIER;
                }
                if (me.isShiftDown()) {
                    modifier = SHIFT_MULTIPLIER;
                }    
                if (me.isPrimaryButtonDown()) {
                    cameraXform.ry.setAngle(cameraXform.ry.getAngle() - mouseDeltaX*MOUSE_SPEED*modifier*ROTATION_SPEED); 
                    cameraXform.rx.setAngle(cameraXform.rx.getAngle() + mouseDeltaY*MOUSE_SPEED*modifier*ROTATION_SPEED); 
                }
                else if (me.isSecondaryButtonDown()) {
                    double z = camera.getTranslateZ();
                    double newZ = z + mouseDeltaX*MOUSE_SPEED*modifier;
                    camera.setTranslateZ(newZ);
                }
                else if (me.isMiddleButtonDown()) {
                    cameraXform2.t.setX(cameraXform2.t.getX() + mouseDeltaX*MOUSE_SPEED*modifier*TRACK_SPEED); 
                    cameraXform2.t.setY(cameraXform2.t.getY() + mouseDeltaY*MOUSE_SPEED*modifier*TRACK_SPEED); 
                }
            }
        });
    }
   
    private void handleKeyboard(Scene scene, final Node root) {
        scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
            @Override
            public void handle(KeyEvent event) {
                switch (event.getCode()) {
                    case Z:
                        cameraXform2.t.setX(0.0);
                        cameraXform2.t.setY(0.0);
                        camera.setTranslateZ(CAMERA_INITIAL_DISTANCE);
                        cameraXform.ry.setAngle(CAMERA_INITIAL_Y_ANGLE);
                        cameraXform.rx.setAngle(CAMERA_INITIAL_X_ANGLE);
                        break;
                    case X:
                        axisGroup.setVisible(!axisGroup.isVisible());
                        break;
                    case V:
                        sceneGroup.setVisible(!sceneGroup.isVisible());
                        break;
                    case SPACE:
                            System.out.println("Hi");
                            sceneGroup.getChildren().add(new Tree(getNewPosition()));
                       break;
                }
            }
        });
    }
   
    private void buildScene() {
        Xform sceneXform = new Xform();

        Box plane = new Box(200,1,200);
        sceneXform.getChildren().add(plane);
        sceneXform.getChildren().add(new Tree(getNewPosition()));
        sceneGroup.getChildren().add(sceneXform);

        world.getChildren().addAll(sceneGroup);
    }

    @Override
    public void start(Stage primaryStage) {
       
       // setUserAgentStylesheet(STYLESHEET_MODENA);
        System.out.println("start()");

        root.getChildren().add(world);
        root.setDepthTest(DepthTest.ENABLE);

        // buildScene();
        buildCamera();
        buildAxes();
        buildScene();

        Scene scene = new Scene(root, 1024, 768, true);
       
        scene.setOnKeyPressed(new EventHandler<KeyEvent>() {           
            @Override
            public void handle(KeyEvent keyEvent) {
                System.out.println("Hi");
               
            }
        });
       
        scene.setFill(Color.GREY);
        handleKeyboard(scene, world);
        handleMouse(scene, world);
        scene.setCamera(camera);
        primaryStage.setTitle("Tree Sample Application");
        primaryStage.setScene(scene);
        primaryStage.show();

      
    }

    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }

}
Java:
/*
* Copyright (c) 2013, 2014 Oracle and/or its affiliates.
* All rights reserved. Use is subject to license terms.
*
* This file is available and licensed under the following license:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*  - Redistributions of source code must retain the above copyright
*    notice, this list of conditions and the following disclaimer.
*  - Redistributions in binary form must reproduce the above copyright
*    notice, this list of conditions and the following disclaimer in
*    the documentation and/or other materials provided with the distribution.
*  - Neither the name of Oracle nor the names of its
*    contributors may be used to endorse or promote products derived
*    from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/



import javafx.scene.Group;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Scale;
import javafx.scene.transform.Translate;

public class Xform extends Group {

    public enum RotateOrder {
        XYZ, XZY, YXZ, YZX, ZXY, ZYX
    }

    public Translate t  = new Translate();
    public Translate p  = new Translate();
    public Translate ip = new Translate();
    public Rotate rx = new Rotate();
    { rx.setAxis(Rotate.X_AXIS); }
    public Rotate ry = new Rotate();
    { ry.setAxis(Rotate.Y_AXIS); }
    public Rotate rz = new Rotate();
    { rz.setAxis(Rotate.Z_AXIS); }
    public Scale s = new Scale();

    public Xform() {
        super();
        getTransforms().addAll(t, rz, ry, rx, s);
    }

    public Xform(RotateOrder rotateOrder) {
        super();
        // choose the order of rotations based on the rotateOrder
        switch (rotateOrder) {
        case XYZ:
            getTransforms().addAll(t, p, rz, ry, rx, s, ip);
            break;
        case XZY:
            getTransforms().addAll(t, p, ry, rz, rx, s, ip);
            break;
        case YXZ:
            getTransforms().addAll(t, p, rz, rx, ry, s, ip);
            break;
        case YZX:
            getTransforms().addAll(t, p, rx, rz, ry, s, ip);  // For Camera
            break;
        case ZXY:
            getTransforms().addAll(t, p, ry, rx, rz, s, ip);
            break;
        case ZYX:
            getTransforms().addAll(t, p, rx, ry, rz, s, ip);
            break;
        }
    }

    public void setTranslate(double x, double y, double z) {
        t.setX(x);
        t.setY(y);
        t.setZ(z);
    }

    public void setTranslate(double x, double y) {
        t.setX(x);
        t.setY(y);
    }

    // Cannot override these methods as they are final:
    // public void setTranslateX(double x) { t.setX(x); }
    // public void setTranslateY(double y) { t.setY(y); }
    // public void setTranslateZ(double z) { t.setZ(z); }
    // Use these methods instead:
    public void setTx(double x) { t.setX(x); }
    public void setTy(double y) { t.setY(y); }
    public void setTz(double z) { t.setZ(z); }

    public void setRotate(double x, double y, double z) {
        rx.setAngle(x);
        ry.setAngle(y);
        rz.setAngle(z);
    }

    public void setRotateX(double x) { rx.setAngle(x); }
    public void setRotateY(double y) { ry.setAngle(y); }
    public void setRotateZ(double z) { rz.setAngle(z); }
    public void setRx(double x) { rx.setAngle(x); }
    public void setRy(double y) { ry.setAngle(y); }
    public void setRz(double z) { rz.setAngle(z); }

    public void setScale(double scaleFactor) {
        s.setX(scaleFactor);
        s.setY(scaleFactor);
        s.setZ(scaleFactor);
    }

    public void setScale(double x, double y, double z) {
        s.setX(x);
        s.setY(y);
        s.setZ(z);
    }

    // Cannot override these methods as they are final:
    // public void setScaleX(double x) { s.setX(x); }
    // public void setScaleY(double y) { s.setY(y); }
    // public void setScaleZ(double z) { s.setZ(z); }
    // Use these methods instead:
    public void setSx(double x) { s.setX(x); }
    public void setSy(double y) { s.setY(y); }
    public void setSz(double z) { s.setZ(z); }

    public void setPivot(double x, double y, double z) {
        p.setX(x);
        p.setY(y);
        p.setZ(z);
        ip.setX(-x);
        ip.setY(-y);
        ip.setZ(-z);
    }

    public void reset() {
        t.setX(0.0);
        t.setY(0.0);
        t.setZ(0.0);
        rx.setAngle(0.0);
        ry.setAngle(0.0);
        rz.setAngle(0.0);
        s.setX(1.0);
        s.setY(1.0);
        s.setZ(1.0);
        p.setX(0.0);
        p.setY(0.0);
        p.setZ(0.0);
        ip.setX(0.0);
        ip.setY(0.0);
        ip.setZ(0.0);
    }

    public void resetTSP() {
        t.setX(0.0);
        t.setY(0.0);
        t.setZ(0.0);
        s.setX(1.0);
        s.setY(1.0);
        s.setZ(1.0);
        p.setX(0.0);
        p.setY(0.0);
        p.setZ(0.0);
        ip.setX(0.0);
        ip.setY(0.0);
        ip.setZ(0.0);
    }

    @Override public String toString() {
        return "Xform[t = (" +
                           t.getX() + ", " +
                           t.getY() + ", " +
                           t.getZ() + ")  " +
                           "r = (" +
                           rx.getAngle() + ", " +
                           ry.getAngle() + ", " +
                           rz.getAngle() + ")  " +
                           "s = (" +
                           s.getX() + ", " +
                           s.getY() + ", " +
                           s.getZ() + ")  " +
                           "p = (" +
                           p.getX() + ", " +
                           p.getY() + ", " +
                           p.getZ() + ")  " +
                           "ip = (" +
                           ip.getX() + ", " +
                           ip.getY() + ", " +
                           ip.getZ() + ")]";
    }
}
Java:
import javafx.geometry.Point3D;
import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;

public class Tree extends Group {

    private static double[] polydata = new double[] { 0.0, 0.0, // P1
            0.0/10, 100.0/10, // P2
            50.0/10, 100.0/10, // P3
            50.0/10, 180.0/10, // P4
            80.0/10, 180.0/10, // P5
            80.0/10, 100.0/10, // P6
            130.0/10, 100.0/10, // P7
            130.0/10, 0.0, // P8
    };

    public Tree(int pos[]){
       
        for(int i = 0 ; i < 3 ; i++){
            Polygon p = new Polygon(polydata);
            //p.setRotationAxis(new Point3D(0,0,1));
            //p.setRotate(180);
            p.setTranslateX(pos[0]);
            p.setTranslateZ(pos[1]);
            p.setFill(Color.GREEN);
            p.setStrokeWidth(.5);
            p.setStroke(Color.BLACK);
            p.setRotationAxis(new Point3D(0,1,0));
            p.setRotate(i*120);
            this.getChildren().add(p);
        }
        this.setRotationAxis(new Point3D(0,0,1));
        this.setRotate(180);
    }

}
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
jojoge Wie erstelle ich runde Buttons mit Farbe? AWT, Swing, JavaFX & SWT 1
B Wie erstelle ich eine JavaFX Anwendung von diesem Code? AWT, Swing, JavaFX & SWT 3
B Event Handling MouseListener Behält seine Variablen, auch wenn ich ein neus Objekt erstelle AWT, Swing, JavaFX & SWT 2
M Wie erstelle ich ein Grafikpfad in jdk1.5 AWT, Swing, JavaFX & SWT 15
MiMa Reaktion auf einen SplitScreenTrenner? AWT, Swing, JavaFX & SWT 2
MartinNeuerlich Kann mir jemand, der einen Mac mit einem m1 oder m2-Chip hat, eine POM geben mit der Javafx-Fullscreen beim Mac mit m-Chip funktioniert? AWT, Swing, JavaFX & SWT 1
W Gibt es einen "automatischen Listener" in Swing oder JTable oder der ATM-Klasse? AWT, Swing, JavaFX & SWT 14
U Gibt es eine Möglichkeit statt concatenate einen anderen Befehl zu nutzen? AWT, Swing, JavaFX & SWT 9
K Warum genau hat man einen Listener, dann ein Event und was ist ein Adapter AWT, Swing, JavaFX & SWT 2
I Probleme beim Drucken auf einen PDF-Drucker AWT, Swing, JavaFX & SWT 8
Jose05 JavaFX: eigene FXML-Datei für einen Button AWT, Swing, JavaFX & SWT 3
P Swing ActionListener überschreibt einen Wert aus der Hauptklasse nicht AWT, Swing, JavaFX & SWT 5
Z Mit einem Button einen anderen Button Triggern AWT, Swing, JavaFX & SWT 3
J Gibt es einen Grund für 16x16 anstatt z.B. 15x15 Tiles ? AWT, Swing, JavaFX & SWT 10
O Soll ich einen JEditorPane verwenden ? AWT, Swing, JavaFX & SWT 5
L JavaFX JavaFX stürtzt durch einen Server#connect Exception AWT, Swing, JavaFX & SWT 3
Drachenbauer Hauptfenster erhält schmale Streifen rechts unt unten, wenn ich einen JDialog hinzufüge. AWT, Swing, JavaFX & SWT 19
J Schriftart über einen Button ändern AWT, Swing, JavaFX & SWT 1
J Genutzte Methoden in einen Frame einbauen AWT, Swing, JavaFX & SWT 21
P Wie lese ich einen jRadioButton aus? AWT, Swing, JavaFX & SWT 21
MaxG. Swing JMenu einen Listener Hinzufügen AWT, Swing, JavaFX & SWT 25
Sanni94 JavaFX Kann man eine Grafik in einen Text einbinden? AWT, Swing, JavaFX & SWT 2
H JavaFX aus der .fxml Datei einen Konstruktor bedienen AWT, Swing, JavaFX & SWT 3
H JavaFX via .fxml einen abgeleiteten Button erstellen... AWT, Swing, JavaFX & SWT 4
S Swing GANZE Row auf einen Schlag einfärben AWT, Swing, JavaFX & SWT 2
B JavaFX Wie programmiere ich hier einen "Weiter" Button? AWT, Swing, JavaFX & SWT 11
P Einer JList mit eigenem ListModel einen Eintrag hinzfügen AWT, Swing, JavaFX & SWT 5
L Wie realisiere ich einen Controller AWT, Swing, JavaFX & SWT 1
A Slider soll einen Wert übergeben AWT, Swing, JavaFX & SWT 1
Thallius Swing Aufgabe für einen der gerne Tüftelt. AWT, Swing, JavaFX & SWT 4
M JavaFX Wie füge ich zu einer WebEngine einen Flash Player hinzu AWT, Swing, JavaFX & SWT 3
G AWT Wie bekomme ich einen zeitgesteuerten robot hin? AWT, Swing, JavaFX & SWT 6
D Event Handling Aus einer anderen Klasse heraus einen Text des JLabels ändern. AWT, Swing, JavaFX & SWT 12
C Im ActionListener Buttons disablen, einen Thread starten, dann Buttons enablen AWT, Swing, JavaFX & SWT 2
H Swing Probleme beim erstellen eines neuen Objektes durch einen Button AWT, Swing, JavaFX & SWT 10
B SWT Problem: Wie kann man für jede TableColumn einen eigenen KeyListener registrieren. AWT, Swing, JavaFX & SWT 1
S Bei BoxLayout haben hinzugefügten Jpanels einen Versatz/Space AWT, Swing, JavaFX & SWT 0
D Graphics2D einen Bereich füllen AWT, Swing, JavaFX & SWT 1
T Einen Variablen Wert in einem TextField AWT, Swing, JavaFX & SWT 4
M Swing Mit Java in der GUI einen Belegungsplan einfügen AWT, Swing, JavaFX & SWT 23
P Swing Panel-austausch über einen MenuListener AWT, Swing, JavaFX & SWT 2
H Swing Hintergrundbild in einen JFrame einfügen AWT, Swing, JavaFX & SWT 7
K 2D-Grafik Kontrastanpassung über einen JSlider AWT, Swing, JavaFX & SWT 2
E Warum macht die einfache Animation einen kleinen Fehler? AWT, Swing, JavaFX & SWT 14
A Swing JTextField durch einen JButton leeren AWT, Swing, JavaFX & SWT 15
J Swing JTable-Event für einen Select?? AWT, Swing, JavaFX & SWT 3
P Swing RadioButtons - nur einen auswählen AWT, Swing, JavaFX & SWT 3
VfL_Freak Swing KeyListener, um einen Dialog per ESC zu schließen AWT, Swing, JavaFX & SWT 6
J JFrame in einen JFrame anzeigen AWT, Swing, JavaFX & SWT 2
L Mehre Panels einen Frame zuweisen AWT, Swing, JavaFX & SWT 11
Furtano AWT mehrere Bilder in einen Frame zeichnen + Layout Manager AWT, Swing, JavaFX & SWT 10
Madlip SWT Tree mit einen Klick alles ausklappen AWT, Swing, JavaFX & SWT 3
D JTree nach Klick auf einen Hyperlink aktualisieren AWT, Swing, JavaFX & SWT 3
M JProgressBar für einen Thread AWT, Swing, JavaFX & SWT 14
T Einen Kreis anzeigen AWT, Swing, JavaFX & SWT 14
M SWT /Jface Wann einen ColumnLabelProvider benutzen? AWT, Swing, JavaFX & SWT 2
-horn- WorldWindJava+JOGL soll einen animierten Graphen anzeigen, wie? AWT, Swing, JavaFX & SWT 4
X Einem JFrame einen Dialog als Parent setzen. Möglich? AWT, Swing, JavaFX & SWT 4
A 2D-Grafik Alles auf einen Panel Zeichnen AWT, Swing, JavaFX & SWT 5
P 2D-Grafik Neue Farbe für einen Teilbereich einer Linie? AWT, Swing, JavaFX & SWT 8
M 3D-Grafik verschiedene Texturen auf einen Würfel mappen AWT, Swing, JavaFX & SWT 15
VfL_Freak Swing kann ich einen laufenden Timer mitten in der Ausführung abbrechen? AWT, Swing, JavaFX & SWT 6
P Swing JTabbedPane mit JButton einen anderen Tab anzeigen AWT, Swing, JavaFX & SWT 9
G Mit Java einen Button wie z.B. im Opera 10.63 erzeugen AWT, Swing, JavaFX & SWT 3
F Swing Beenden eines ActionListener über einen Button AWT, Swing, JavaFX & SWT 8
M Jframe wie bekommt man bei den zeile einen header erzeugen AWT, Swing, JavaFX & SWT 2
I Swing Wie bekomme ich den Fokus für einen JPanel AWT, Swing, JavaFX & SWT 5
K Vom Gui aus auf einen Thread warten AWT, Swing, JavaFX & SWT 4
K LookAndFeel LookAndFeel nur für einen Frame? AWT, Swing, JavaFX & SWT 6
J Swing Kalender soll auf Buttondruck einen Monat weiterblättern AWT, Swing, JavaFX & SWT 7
C Ermitteln ob JComponent einen Listener besitzt AWT, Swing, JavaFX & SWT 2
B LookAndFeel für einen Komponenten AWT, Swing, JavaFX & SWT 2
T Ordner öffnen nach Klick auf einen Button AWT, Swing, JavaFX & SWT 3
C AWT Oval nur für einen bestimmten Schritt zeichnen AWT, Swing, JavaFX & SWT 5
S Threads in einen Frame zeichnen lassen (Paint()?!) AWT, Swing, JavaFX & SWT 5
T Swing Wie kann ich einen String in ein TreePath umwandeln? AWT, Swing, JavaFX & SWT 5
B Restart-Funktion für einen Updatemechanismus?????? AWT, Swing, JavaFX & SWT 4
U Swing Eingabe von JTextField in einen String übergeben. AWT, Swing, JavaFX & SWT 3
E Swing Zugriff auf Attribute eines JFrames über einen JDialog AWT, Swing, JavaFX & SWT 2
S Swing JTree in ScrollPane einen ToolTip geben AWT, Swing, JavaFX & SWT 2
C Einen JDialog aus einem JDialog aufrufen AWT, Swing, JavaFX & SWT 3
MQue gelbes Warndreieck um einen JFrame AWT, Swing, JavaFX & SWT 6
S Objektverhalten in einen Thread legen AWT, Swing, JavaFX & SWT 4
F Einen einfachen JTree anhand eines Arrays aufbauen AWT, Swing, JavaFX & SWT 9
J Einen JSlider ähnlich wie in OO3 AWT, Swing, JavaFX & SWT 5
G Wie lasse ich einen Graphen zeichnen(mit einer ArrayList)? AWT, Swing, JavaFX & SWT 5
T 2JLabels in einen JTable Header AWT, Swing, JavaFX & SWT 2
R Ich suche einen sehr simplen. AWT, Swing, JavaFX & SWT 2
G Date in einen String umwandeln AWT, Swing, JavaFX & SWT 4
T JFileChooser: beim Save Dialog einen Dateinamen vorgeben? AWT, Swing, JavaFX & SWT 6
P Einen Komponent zweimal zu einem Panel hinzufügen? AWT, Swing, JavaFX & SWT 18
S Will einen Punkt zeichnen aber krieg das net hin. AWT, Swing, JavaFX & SWT 2
E Duch jFileChooser oä. einen Ordner Pfad angeben AWT, Swing, JavaFX & SWT 3
N Kennt jemand einen WYSIWYG Editor für AWT? AWT, Swing, JavaFX & SWT 4
I Wie mache ich einen modalen JPanel? AWT, Swing, JavaFX & SWT 2
I Listener für einen JSlider AWT, Swing, JavaFX & SWT 1
G An die Quelle einen events kommen AWT, Swing, JavaFX & SWT 2
J JTable nachträglich in einen JScrollPane einfügen AWT, Swing, JavaFX & SWT 6
S PopupMenü --> auf einen JButton zugreifen AWT, Swing, JavaFX & SWT 6
E JComboBox: einen Eintrag "unselectable" setzen AWT, Swing, JavaFX & SWT 7

Ähnliche Java Themen

Neue Themen


Oben