Create a class for see a rectangle

Hi guys,
i have this problem, i create this easy class:
/* file Rectangle.fx */
package javafxapplication4;
import javafx.geometry.Rectangle2D;
import javafx.scene.CustomNode;
public class Rectangle extends CustomNode{
public var x:Number;
public var y:Number;
public var width:Number;
public var height:Number;
public function getArea():Number{
var risultato:Number;
risultato=width*height;
public function getBounds():Rectangle{
Rectangle{
x:x
y:y
width:width
height:height
public override function toString():String{
"Rectangle ({x},{y}) "
i use this class in this file Main.fx
package javafxapplication4;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.Node.*;
var stg :Stage=Stage {
title: "Application title"
scene: Scene {
width: 250
height: 80
var retg=Rectangle{ x:5,y:5,width:10,height:10};
var area=retg.getArea();
content: [
Text {
font: Font {
size: 16
x: 50
y: 50
content: "Area of {retg} is {area}";
retg.getBounds() // Insert this for see the rectangle
when i run this applicatino i don't see the rectangle, i see the text but not the rectangle,
can you help me?
thanks for all, best regads
Antonio

Create Custom Controls Programmatically
You can create custom controls by using either of the following approaches:
•     Extend the CustomNode or Control classes.
•     Apply CSS styles and provide a custom skin.
The following code fragment illustrates the first approach by creating a custom UI control with an image.
class MyControl extends CustomNode {
    var button: Node[];
    var image: Image;
    override function create() {
        HBox {
            spacing: 5
            nodeVPos: VPos.CENTER
            content: bind [button, ImageView {image: image}]
}For more information take a look at
http://download.oracle.com/javafx/1.3/howto/UI-Controls-Tutorial.html#custom

Similar Messages

  • Creating A Class For A ComboBox Component

    I have a comboBox component that I would like to create a
    class for. But I am not sure if I could. I see how you can use the
    Linkage window to assign an AS 2.0 Class to a movie clip, but I do
    not see that same option for a comboBox component.
    It has all of the basic combo box things that I would like to
    seperate out into it's own class if possible
    If anyone could give me a few tips, or better yet, point me
    to a few good tutorials, that would be great.
    Thanks
    Mathias

    I have a comboBox component that I would like to create a
    class for. But I am not sure if I could. I see how you can use the
    Linkage window to assign an AS 2.0 Class to a movie clip, but I do
    not see that same option for a comboBox component.
    It has all of the basic combo box things that I would like to
    seperate out into it's own class if possible
    If anyone could give me a few tips, or better yet, point me
    to a few good tutorials, that would be great.
    Thanks
    Mathias

  • How to create proxy class for a Siebel WS which has many Workflows in it?

    Hi,
    I am facing a strange problem. I have a Web Service for which there are many workflows associated with this. When I generate WSDL for this Web Service and later on generate proxy class in .NET, it creates mutilple classes for each workflow. From UI, I can invoke a perticular method for the class for which I am interested in. But when I am building the same in JDeveloper, using Web Service proxy, I get only one class and I am not interested in invoking method in this class but interested in some other class for which the proxy was not generated. Is there some way to generate multiple classes in JDeveloper proxy?
    Thanks,
    Sudha.

    I have figured this out. Actually Generate proxy creates package and it includes all the class in it. Now i am able to invoke web service method call.

  • How do I create Wrapper class for Message Box?

    I want to create Wrapper class for Message Box class in my project. I am using Telerik Testing FrameWork. In that message box was not recognized in unit testing thats y i want to create wrapper class, for creating the
    instance for that mesage box.

    A wrapper class is simply a class that for example wraps another object or a subset of its methods. You could just create a class that exposes the same methods as the MessageBox and uses the MessageBox internally.
    If you define an interface and program against this in your application, you could replace your wrapper object with another object that implements the same interface when you are doing the unit tests. Something like this:
    public interface IMessageBoxWrapper
    System.Windows.Forms.DialogResult Show(string text, string caption);
    public class MessageBoxWrapper
    public System.Windows.Forms.DialogResult Show(string text, string caption)
    return System.Windows.Forms.MessageBox.Show(text, caption);
    public class MockMessageBoxWrapper
    public System.Windows.Forms.DialogResult Show(string text, string caption)
    return System.Windows.Forms.DialogResult.OK;
    private readonly IMessageBoxWrapper _mbw;
    public Form1(IMessageBoxWrapper mbw)
    InitializeComponent();
    _mbw = mbw;
    private void SomeMethod()
    _mbw.Show("...", "...");
    Hope that helps.
    Please remember to close your threads by marking all helpful posts as answer and please start a new thread if you have a new question.

  • Problem creating inner class for JTable panel in a class for an application

    i want to create an inner class for a database application development.
    but there is occuring exceptions & errors.i want to retrieve data & enter data also from many tables in a database.i want an urgent help for this plz.

    http://forum.java.sun.com/thread.jsp?forum=57&thread=271752
    See this thread, please.

  • Create item class for Number values

    Hi,
    I want to create a item class for year like (current year+3).
    So i created the Item class in Dis.Admin But it wont reflect in Dis.plus parameter . So please tell me how to create a item class for Number values.
    Regards
    Manikandan

    Hi Rod
    I rarely use Desktop and neither do my customers, unless they are on versions of Discoverer prior to 10.1.2. Time and time again I have taught 10.1.2 Plus / Viewer to dyed in the wool Desktopees to finish the course for them to say that they are never going to use Desktop again.
    One of the many issues with Desktop is the caching and even though it can do some things that Plus cannot, the many features in Plus that don't exist in Desktop far outweight them.
    What do you think? Do you still see a use for Desktop?
    How about everyone else? I would love to hear from you.
    Best wishes
    Michael

  • How to create object class for a z table

    Hi All,
    I have a z table and I want to register the changes of fields should be logged to CDHDR and CDPOS table.
    Is this possible?
    If yes how can I creat an object class for a z table. I have already checked the change document option in z data element.
    Please help.
    Regards,
    Jeetu
    Moderator message: standard functionality, please search for available information/documentation before asking.
    locked by: Thomas Zloch on Oct 6, 2010 6:16 PM

    Tcode SCDO. You'll need to create a change document for you Z table and then use the FM created to record the changed data.

  • Create JPub class for table of records/record types and access them

    Hi,
    I have the following object types in the database:
    PERSON_REC with 3 fields and
    PERSON_TAB table of PERSON_REC
    I have created a Java class for PERSON_REC using JPub. The created class implements CustomDatum and CustomDatumFactory. How do I do it for table of records type i.e PERSON_TAB??
    I have a stored procedure that has PERSON_TAB as a OUT parameter. How do retrieve the value from callablestatement? Is there a sample code anywhere. Kindly direct me.
    I have seen sample code and documentation for PERSON_REC type from JPub but not for table of records; also there is no sample code for accessing them from JDBC. Please help me..
    Thanks and regards,
    Vadi.

    Vadi,
    Try searching this forum's archives for the words "STRUCT" and "ARRAY".
    Good Luck,
    Avi.

  • CREATE EDITION CLASS FOR PAGE FORMAT

    Hi,
    I have a sales form in SapScript, for which I created a page format "ZFCONT" in continuous form (305 mm. x 225mm.).
    Now the system needs to create a "editing class" to associate the new page format (ZFCONT).
    What are the steps to create the "editing class".
    There is another necessary step to enable it to print?
    Thank you very much for your help.
    Fabio Rodriguez
    by Argentina

    Well, this should be a system problem (refresh) because the day after, without any change in SPAD nor anyplace else, the smartforms is recognizing the page type I've created.
    Thanks anyway.
    Regards,
    Valter Oliveira.

  • How to create custom class for Swing compnents

    import java.awt.Color;
    import java.awt.Font;
    import javax.swing.JLabel;
    import javax.swing.*;
    public class SampleJFrame extends JFrame {
        public static void main(String[] args) {
            SampleJFrame frame      =      new SampleJFrame();
            JPanel panel = new JPanel();
            panel.setLayout(null);
            getLabel label;
            Color     color, color1;
            color                    =      new Color(   120 ,      120  ,     160            );
              color1                    =      new Color( 135  ,     38 ,      87);          
            label                     =       new getLabel( "Hiiiiii", 150, 700, 800, 50, color1, "Serif", Font.BOLD, 28 );
                panel.add(label);      
                frame.add(panel);      
            frame.setSize(700, 770);
             frame.setVisible(true);
            frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    import java.awt.Color;
    import java.awt.Font;
    import javax.swing.JLabel;
    public class getLabel extends JLabel {
          *     This method create and return the JLabel with necessary parameter
          *     @param     labelName
          *     @param      x coordinate
          *      @param      y coordinate
          *      @param      width
          *      @param     height
          *      @param     foreground color
          *      @param     fontName
          *      @param     fontStyle
          *  @param     fontSize
          *      @return     JLabel
         public getLabel( String labelName, int x, int y, int width, int height, Color foreGround,
                                   String fontName, int fontStyle, int fontSize ){          
                   JLabel      label     = new      JLabel(labelName);
                   label.setBounds( x, y, width, height);
                   label.setForeground(foreGround);
                   label.setFont(new Font(fontName, fontStyle, fontSize));               
              }                                   // End of getLabel block     
    }I want to use customs JLabel class where I can add necessay element to JLabel comonent
    But in above case the getLabel class compiles but when I am add label using getLabel class
    to my JFrame class it doesnt shows anything.
    I dont get what is the error please help
    Edited by: harshal_2010 on Apr 29, 2010 6:43 AM
    Edited by: harshal_2010 on Apr 29, 2010 7:01 AM

    I don't understand, Why you try to create new Label in getLabel constructor?
    You get label class already extended from JLabel and don't necessary to create new JLabel.
    public getLabel( String labelName, int x, int y, int width, int height, Color foreGround,
                                   String fontName, int fontStyle, int fontSize ){          
                   super(labelName);
                   this.setBounds( x, y, width, height);
                   this.setForeground(foreGround);
                   this.setFont(new Font(fontName, fontStyle, fontSize));               
              }I think, you need to create ControlsFactory and use it for creating custom controls. It's best solution for you.

  • Error in creating a class.

    Hi Experts,
    While creating a class for the created interface..
    I am getting following error.
    "IT_MARA" is not an internal table - the "OCCURS n" specification is missing.
    Please correct the error.
    method Y_IF_INTERFACE~SELECT_METHOD .
    SELECT * FROM MARA INTO TABLE IT_MARA
             WHERE MATNR BETWEEN P_MATNR_LOW AND P_MATNR_HIGH.
    endmethod.
    Regards
    nani

    The code is like this
    tables: mara.
    *provide mara table
    DATA: zMARA TYPE MARA.
    *provide data objects
    DATA: OBJ TYPE REF TO Y_CL_INTERFACE,
          IT_MARA TYPE standard table of MARA with header line,
          WA_MARA TYPE MARA.
    *provide selection screen
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
    *provide object
    START-OF-SELECTION.
      CREATE OBJECT OBJ.
    *call the method.
      CALL METHOD OBJ->Y_IF_INTERFACE~SELECT_METHOD
        EXPORTING
          P_MATNR_LOW  = S_MATNR-LOW
          P_MATNR_HIGH = S_MATNR-HIGH
        IMPORTING
          IT_MARA      = IT_MARA
          WA_MARA      = WA_MARA.
    *display the data
      LOOP AT IT_MARA INTO WA_MARA.
        WRITE:/ WA_MARA-MATNR,
                WA_MARA-ERSDA,
                WA_MARA-ERNAM,
                WA_MARA-MATKL,
                WA_MARA-MEINS.
      ENDLOOP.
    Regards
    Nani

  • Spring Service class for Flex

    Hi Guys,
    I have to display data from db on to Flex page. For which I have been asked to create Service class for Flex screen. But i donot know what is service class, what should be its functionality. I am totally new to this.
    Can anyone tell me what is Service class & how to create it.?
    What should be the content of Service Class ?
    How is it linked to db (preferably by iBatis).?
    Are there any config files ?
    How to use it to populate the data through Service class ant send it to Flex screen to display data.?
    Kindly help me in brief and also provide if anyone has any links to be refered with example.
    Thanks,
    Anand.

    The purpose of NativeWindow in your app is to make it visible and maximise it. The converted web app is in the browser window so that it is visible so you don't have to worry about that part. As for maximising, you should not change the size of the browser window (you can make it full screen but then if you do you'd lose the keyboard interactions.) So the short answer is just remove that chunk of code

  • Class for moving images (ImageView)

    Hi! I'm trying to create a class for move an image (using ImageView class). For first, I create a simple testing class:
    package javafxapplication2;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.animation.KeyFrame;
    import javafx.animation.Timeline;
    import javafx.scene.input.MouseEvent;
    var image: ImageView;
    var timeline = Timeline {
        def im = image;
        keyFrames: [
            KeyFrame {
                time: 0s,
                values: [
                    im.x => 20.0,
                    im.y => 20.0
            KeyFrame {
                time: 1s,
                values: [
                    im.x => 150.0,
                    im.y => 150.0
    Stage {
        title: "Test"
        scene: Scene {
            width: 550, height: 350
            content: [
                image = ImageView {
                    x: 20.0, y: 20.0
                    image: Image {
                        url: "http://www.google.it/logos/2010/joseffrank-hp.gif";
                    onMousePressed: function(e: MouseEvent) {
                        timeline.play();
    }But it does not works! And I can't use the "bind" variables, because in an extern class like this:
    package javafxapplication2;
    import javafx.animation.Timeline;
    import javafx.animation.KeyFrame;
    var element: Element;
    var fromBoxX : Number;
    var fromBoxY: Number;
    var toBoxX: Number;
    var toBoxY: Number;
    var timeline = Timeline {
        def e = element;
        keyFrames: [
            KeyFrame {
                time: 0s,
                values: [
                    e.x => fromBoxX,
                    e.y => fromBoxY
            KeyFrame {
                time: 1s,
                values: [
                    e.x => toBoxX,
                    e.y => toBoxY
    public function move (el: Element, fBox: Box, tBox: Box): Void {
        element = el;
        fromBoxX = el.matrix.getMatrixIndexes(fBox.location).getY() * el.board.squareSize;
        fromBoxY = el.matrix.getMatrixIndexes(fBox.location).getX() * el.board.squareSize;
        toBoxX = el.matrix.getMatrixIndexes(tBox.location).getY() * el.board.squareSize;
        toBoxY = el.matrix.getMatrixIndexes(tBox.location).getX() * el.board.squareSize;
        timeline.playFromStart();
    public class Elements {}I can't use it!
    Is here anybody that can help me? (Sorry for my bad english)

    It is because the image variable is null when the timiline is createed.
    Try this:
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.animation.KeyFrame;
    import javafx.animation.Timeline;
    import javafx.scene.input.MouseEvent;
    var image: ImageView;
    Stage {
        title: "Test"
        scene: Scene {
            width: 550, height: 350
            content: [
                image = ImageView {
                    x: 20.0, y: 20.0
                    image: Image {
                        url: "http://www.google.it/logos/2010/joseffrank-hp.gif";
                    onMousePressed: function(e: MouseEvent) {
                        timeline.play();
    var timeline = Timeline {
        def im = image;
        keyFrames: [
            KeyFrame {
                time: 0s,
                values: [
                    im.x => 20.0,
                    im.y => 20.0
            KeyFrame {
                time: 1s,
                values: [
                    im.x => 150.0,
                    im.y => 150.0
    }

  • Error while extending a controller:not a valid base class for this operatn

    Hi,
    I tried to extend a controller. but the Jdev shows an error "oracle.apps.ar.Creditmgt.application.webui.OCMAddFinDataCO is not a valid base class for this operation. Can you please let me know why is Jdev not allowing me to create a new class.
    Thanks,
    Prakash

    Yes I did. the class file exists in the Myclasses of Jdev in Jdevbin.Prakash myclasses folder is in \$JDEV_USER_HOME\jdevhome\jdev\myclasses.
    Not in jdevbin.
    Check this link
    Re: Problem in creating Extended Class for Standard Controller
    Thanks
    AJ

  • Passing argument to, when using one class for multiple assets

    I had a class that I was passing a simple argument to like so:
    var quiz_1_2:CaseStudyQuiz = new CaseStudyQuiz(2);
    addChild(quiz_1_2);
    I now would like to use this class for multiple MCs in my library. I thought I could let Flash create a class for each of them and specifying the CaseStudyQuiz class as the Base class. When I do that, I get the following error:
    1136: Incorrect number of arguments.  Expected 0.
    Obviously this is because the class created by flash does not except an argument. Does that mean, I would have to create a seperate class for each of the movies that use that class? And if so, what would I have to do in that class for it to except the parameter and pass it on to my base class?
    Thank you very much for any help with this!!!

    use the super() function and pass your parameter.  but you still might get a runtime error but i don't think that will cause a problem.

Maybe you are looking for