Skip to main content

Error when trying to assign a string to the title attribute.

2 replies [Last post]
Joined: 2008-02-15

I am in the process of taking old javafx code and moving it to the compiled version. In one section of my code I have a tab class that is called from the main form. When moving things around, trying to make it compliant with the compiled JavaFx code, I get the following error when trying to compile my project (in NetBeans 6.1):

"error: Cannot override TabExample.title default initializer in title subclass."

In the interpreted version, the following was outside my tab class and it worked fine:

TabExample.attribute title="Other";

In the compiled version I moved it into the class (because I was getting an error) so it looks like this:

class TabExample extends Tab{
attribute title="Other";


Any thoughts what the error means and how I can get around it?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-05-10

Hi, JavaFX overrides a little bit differently than Java. Use the “override” keyword to override the attribute.

import javafx.ui.*;
public class TabExample extends Tab{
override attribute title = "Other";

Joined: 2008-02-15

That did the trick. Thank you so much.