Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8786595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:40:33+00:00 2026-06-13T21:40:33+00:00

I’m new to Java with PHP, HTML, CSS experience. When I try to change

  • 0

I’m new to Java with PHP, HTML, CSS experience. When I try to change the width and height my chart takes up in the window NetBeans gives me the error:

error: setWidth(double) has protected access in Region chart.setWidth(450);

I’ve searched through the javafx docs and found that width/height is bound to region, but I’m not sure what that is in my code, I tried a few things but haven’t found it…

I’m sure this is simple..

thanks in advance, Brad.

package test;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.chart.ScatterChart;
import javafx.scene.chart.XYChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.shape.Rectangle;

public class Test extends Application {



    private void init(Stage primaryStage) {
        Group root = new Group();
        primaryStage.setScene(new Scene(root,1000,1000));

        root.getStylesheets().add("test/Chart.css");

        Rectangle rect = new Rectangle(35,70); 
        rect.setLayoutX(30); 
        rect.setLayoutY(30);
        rect.getStyleClass().add("my-rect");

        NumberAxis xAxis = new NumberAxis("X Axis", -24d, 24.0d, 2.0d);
        NumberAxis yAxis = new NumberAxis("Y Axis", -24.0d, 24.0d, 1.0d);

        ObservableList<XYChart.Series> data = FXCollections.observableArrayList(
            new ScatterChart.Series("Series 1", FXCollections.<ScatterChart.Data>observableArrayList(
                new XYChart.Data(0.2, 3.5),
                new XYChart.Data(0.7, 4.6),
                new XYChart.Data(1.8, 1.7),
                new XYChart.Data(2.1, 2.8),
                new XYChart.Data(4.0, 2.2),
                new XYChart.Data(4.1, 2.6),
                new XYChart.Data(4.5, 2.0),
                new XYChart.Data(6.0, 3.0),
                new XYChart.Data(7.0, 2.0),
                new XYChart.Data(7.8, 4.0)
            )),
            new ScatterChart.Series("Series 2", FXCollections.<ScatterChart.Data>observableArrayList(
                new XYChart.Data(6.2,3.0),
                new XYChart.Data(6.0,4.0),
                new XYChart.Data(5.8,5.0)
            ))    
        );
        ScatterChart chart = new ScatterChart(xAxis, yAxis, data);
        chart.setWidth(450);
        chart.setHeight(450);

        chart.setLayoutX(250);
        chart.setLayoutY(250);



        root.getChildren().addAll(chart,rect);
    }

    @Override public void start(Stage primaryStage) throws Exception {
        init(primaryStage);
        primaryStage.show();
    }
    public static void main(String[] args) { launch(args); }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:40:35+00:00Added an answer on June 13, 2026 at 9:40 pm

    The javadoc of ScatterChart.getHeight() (which in turn is Region.getHeight()) says

    Gets the value of the property height.
    Property description:
    The height of this resizable node. This property is set by the region’s
    parent during layout and may not be set by the application. If an
    application needs to explicitly control the size of a region, it
    should override its preferred size range by setting the minHeight,
    prefHeight, and maxHeight properties.

    Namely you can adjust and constraint the size of any chart with:

    ScatterChart.setPrefHeight(double)
    ScatterChart.setMinHeight(double)
    ScatterChart.setMaxHeight(double)
    
    ScatterChart.setPrefWidth(double)
    ScatterChart.setMinWidth(double)
    ScatterChart.setMaxWidth(double)
    
    ScatterChart.setPrefSize(double, double)
    ScatterChart.setMinSize(double, double)
    ScatterChart.setMaxSize(double, double)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have thousands of HTML files to process using Groovy/Java and I need to
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.