Skip to main content

JavaFX problem with class *.java

6 replies [Last post]
seric
Offline
Joined: 2008-01-07
Points: 0

Hello.
my problem: first class MyClass.fx

package com.ui;

import com.ui.*;
import javafx.ui.*;
import javafx.ui.canvas.*;
import javafx.ui.filter.*;
import java.lang.System;
import java.lang.Math;

class MyClass{
attribute a:Number;
attribute b:BaseModel; // Error
operation update();
}

attribute MyClass.b = new BaseModel(); //Error

operation MyClass.update(){
this.a = 10;
println("hello");
}

var test = new MyClass();
test.update();

Frame {
visible:true
title:"hello"
width:300
height:250
}

second class BaseModel.java

package com.ui;

public class BaseModel {

private int a;

BaseModel(){
this.a = 5;
System.out.println(this.a);
}

public int getA(){
return a;
}

}

print me
No such type BaseModel BaseProjectFX/bin/com/nevilon/ui MyClass.fx line 14

What me doing?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
seric
Offline
Joined: 2008-01-07
Points: 0

Thank you, really works. This is my inattentiveness. Tell me how to get rid of false errors in the Eclipse? If I have 3 files and First.fx, Second.fx and Third.java
attribute a: Second; / / without errors
attribute b: Third; / / Error: No such type Third First.fx

but in the case and executed.

Message was edited by: seric

pforhan
Offline
Joined: 2003-08-07
Points: 0

One workaround mentioned was that you can try to put .java and .fx files in seperate projects. This did not work for us, so we just live with it, and continue to push for open-sourcing the Eclipse plugin.

One note to improve the eclipse plugin: Take the three jars from the latest binary distribution (javafxrt.jar, swing-layout.jar, and Filters.jar) and overwrite the ones in your the jfx eclipse plugin's lib folder. On windows, this would be something like this:
C:\...\eclipse3.3\plugins\javafx.eclipse.f3editor_0.0.2\lib

Restart eclipse, and you get some of the latest language features.

Pat.

seric
Offline
Joined: 2008-01-07
Points: 0

Hello, I use Eclipse. and plugin for him
https: / / openjfx.dev.java.net / javafx-eclipse-plugin-install.html

Starting using main class "net.java.javafx.FXShell"
(= x) arguments "com.ui.MyClass"
(javaFX Application \ new Configuration)

In Intellij Idea problem so that alone accounted initially compile file *. java and then move
*. class in a folder with using *.fx. There FX plugin
JavaFX Support
IntelliJFX in http://plugins.intellij.net/search/?search=javaFx but there strongly inhibits the computer.

pforhan
Offline
Joined: 2003-08-07
Points: 0

JFX plugin for eclipse has known issues with regards to referencing .java files from .fx files Have you tried running the program yet? The programs usually work despite the apparent errors.

Pat.

pforhan
Offline
Joined: 2003-08-07
Points: 0

Can you provide more details?

JFX Script or compiler? It looks like you are using JFX Script...

How are you running/editing the files? JavaFXPad or Netbeans or Eclipse or just command-line?

Can you provide any other details?

Pat.

seric
Offline
Joined: 2008-01-07
Points: 0

No such type BaseModel BaseProjectFX/bin/com/ui MyClass.fx line 14