Wobbly left contents in SplitPane when moving divider in JavaFX 11 onwards
Jason Shattu
jshattu at gmail.com
Mon Apr 15 04:46:28 UTC 2019
Hi all,
this code highlights the problem running on JavaFX 11+,
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.SplitPane;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;
public class DemoBug extends Application
{
public static void main(String[] args)
{
launch(args);
}
public void start(Stage primaryStage) {
TextArea textArea = new TextArea("I am Wobbly\nwhen you move
the\n divider\nthis TextArea can be any component\nfor the problem to
happen");
SplitPane s = new SplitPane(textArea, new TextArea("def"));
primaryStage.setScene(new Scene(s,300,300));
primaryStage.show();
}
}
Thanks,
Jason
------ Original Message ------
From: "Kevin Rushforth" <kevin.rushforth at oracle.com>
To: openjfx-dev at openjdk.java.net
Sent: 13/04/2019 13:58:12
Subject: Re: child z ordering
>See Parent::viewOrder.
>
>-- Kevin
>
>On 4/12/2019 12:32 PM, James Dunsdon wrote:
>>Hi,
>>
>>I'm wondering if there is any consideration towards being able to modify child Z ordering. Currently it only seems based on add order. There are a few use cases where slight overlapping might be desired in which case z ordering should be independently controllable of layout order. toFront(), toBack() only seem to work with Groups. I've given a code example of a use case below. My current workaround is to use rotations to created the desired effect.
>>
>>
>>import javafx.application.Application;
>>import javafx.geometry.Pos;
>>import javafx.scene.Node;
>>import javafx.scene.Parent;
>>import javafx.scene.Scene;
>>import javafx.scene.layout.HBox;
>>import javafx.scene.layout.VBox;
>>import javafx.scene.paint.Color;
>>import javafx.scene.shape.Circle;
>>import javafx.scene.shape.Rectangle;
>>import javafx.stage.Stage;
>>
>>public class Main extends Application {
>>
>> @Override
>> public void start(Stage primaryStage) throws Exception{
>> Parent root = new VBox(createDefaultBehavior(), createPreferredBehavior());
>> primaryStage.setTitle("Hello World");
>> primaryStage.setScene(new Scene(root, 300, 275));
>> primaryStage.show();
>> }
>>
>> private Node createDefaultBehavior(){
>> HBox box = new HBox(createCircle(), createRectangle());
>> box.setAlignment(Pos.CENTER_LEFT);
>> box.setSpacing(-10);
>> return box;
>> }
>>
>> /*
>> in this case since we are using symmetric shapes the node rotations are unnecessary,
>> however they would be required for most content
>> */
>> private Node createPreferredBehavior(){
>> Node circle = createCircle();
>> circle.setRotate(-180);
>> Node rectangle = createRectangle();
>> rectangle.setRotate(-180);
>> HBox box = new HBox(rectangle, circle);
>> box.setAlignment(Pos.CENTER_RIGHT);
>> box.setRotate(180);
>> box.setSpacing(-10);
>> return box;
>> }
>>
>> private Node createCircle(){
>> Circle circle = new Circle(30, Color.RED);
>> circle.setStroke(Color.GOLDENROD);
>> circle.setStrokeWidth(4.0);
>> return circle;
>> }
>>
>> private Node createRectangle(){
>> Rectangle rectangle = new Rectangle(100, 40, Color.GREEN);
>> rectangle.setStroke(Color.GOLDENROD);
>> rectangle.setStrokeWidth(4.0);
>> return rectangle;
>> }
>>
>>
>> public static void main(String[] args) {
>> launch(args);
>> }
>>}
>>
>>
>>Thanks,
>>
>>James Dunsdon
>>
>>(nervous first time poster)
>>
>>
>>
>
More information about the openjfx-dev
mailing list