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 8664905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:21:10+00:00 2026-06-12T17:21:10+00:00

I have cut my problem down to simple lines of Scala + JavaFX 2’s

  • 0

I have cut my problem down to simple lines of Scala + JavaFX 2’s FXMLLoader:

val path = "/com/myapp/views/main.fxml"

val loader = new FXMLLoader()
loader.setLocation(getClass.getResource(path))

val root = loader.load(getClass.getResourceAsStream(path)).asInstanceOf[Parent]

I am trying to load a main.fxml file using FXMLLoader, but I end up with:

Class javafx.fxml.FXMLLoader$ValueElement can not access a member of
class com.myapp.controllers.MainWindow with modifiers “private”

The FXML code looks like:

<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.net.*?>
<?import java.util.*?>
<?import javafx.collections.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.Scene?>
<?import javafx.scene.control.*?>
<?import javafx.scene.effect.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.text.*?>

<BorderPane fx:controller="com.myapp.controllers.MainWindow" fx:id="mainWindow" prefHeight="703.0" prefWidth="803.0" xmlns:fx="http://javafx.com/fxml">
  <stylesheets>
    <URL value="@../styles/Styles.css" />
  </stylesheets>
  <top>
  ...

According to the error message, JavaFX’s FXMLLoader tries to access some property of my controller which is private. However, I have no private members in the controller:

class MainWindow extends Initializable {
  override def initialize(location: URL, resourceBundle: java.util.ResourceBundle) {
    print("init")
  }
}

What could be the problem?

  • 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-12T17:21:11+00:00Added an answer on June 12, 2026 at 5:21 pm

    The error points to a private constructor. Do you need to explicitly make a constructor public in Scala? You can use javap to see what is compiled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am coding a big website but I have cut down my problem into
I have some buttons in an UIView. My problem is, that they get cut
Alright so I just tried to cut down on lines of code by changing
My problem: I need to retrieve the main product image from a cut down
I have a weird problem , below are two simple get calls and returning
I have a page that will list news articles. To cut down on the
This is my VERY FIRST Makefile and so I have cut and paste junk
I have requirement to disable copy/paste/cut operations on a textbox. For this purpose I
i have this code i found to cut a string into words. i cant
I have various HTML strings to cut to 100 characters (of the stripped content,

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.