JavaFX and heavyweight awt components

Can somebody point me to documentation on what's the deal with javaFX and heavyweight components?
I have been wrapping an awt.Canvas into a SwingComponent. This basically seems to work. It does not obey layout rules, but I think I can work around that. However, soon as the mouse goes over the node, the canvas starts to move around (while the SwingComponent stays in place). I have - to my best knowledge - not set up mouse interaction in any way.
Using
visible:false
on the node, housing the SwingComponent with the Canvas is the only thing I found to make the canvas stay in place (it does not hide it..). But that looks like a hack, likely to fail sooner or later. So, I'd like to learn more about what's the contracts here. I don't care for much more than desktop profile in the moment.
thanks
nils

I got this problem too
For the moment, i just put a rectangle on top of the awt component , and set the blockMouse "True".
But when i try to translate the component location, i couldnot find a proper solution, the component just dont move at all.

Similar Messages

  • Why the AWT components are called heavy-weight and SWING as light-weight?

    Why the AWT components are called heavy-weight and SWING as light-weight?.
    Building our own components means overhead on JVM. hence in what sence the SWING components are called light weight.?
    I know that the Swing componets are the components which are not going to depend upon peer classes and render, OS independent LOOK n FEEL.
    Thanks,
    Sanath Kumar

    All extensions of Component are considered lightweight since, as you point out, they don't have their own dedicated native peer.
    Essentially a lightweight component only has a canvas on which to draw itself and some means of receiving events from the system. In fact, there is no need to have one of these "canvas" and "event" objects for each component - the parent component can manage these abilities on behalf of its children. Eventually you end up with only top-level components needing to be heavyweight in order to communicate with the windowing system.
    A lightweight component therefore has the minimal dependency on the underlying windowing system giving you maximum cross-platform flexibility.
    It is usually true that lightweight => slower and heavyweight => faster since it is reasonable to assume that native peers will be optimal for the windowing system. However, that's not the point of the lightweight/heavyweight distinction.
    Hope this helps.

  • Using javafx and awt together in MAC

    I have read blogs about not using SWT and AWT libraries together in MAC systems. So, are their any constraints for JAVAFX and AWT as well ?
    Please refer to this link.
    I am having a similar case of writing an image to disk and I am using javafx, the line doesn't seem to work on my mac.
    Message was edited by: abhinay_agarwal

    The link you posted on SWT/AWT integration is irrelevant to JavaFX/AWT integration.
    To learn abount JavaFX/Swing integration, see the Oracle tutorial trail:
    JavaFX for Swing Developers: About This Tutorial | JavaFX 2 Tutorials and Documentation
    As Swing is based on AWT, the tutorial trail is equally applicable whether you are integrating JavaFX with only AWT or with the full Swing toolkit.
    In my opinion, there is little reason to integrate JavaFX with just the AWT toolkit as there is little of value that AWT would provide that JavaFX does not already provide.
    JavaFX integrates fine with ImageIO to write files to disk, Oracle provide a tutorial for that (see the "Creating a Snapshot" section):
    Using the Image Ops API | JavaFX 2 Tutorials and Documentation
    //Take snapshot of the scene
    WritableImage writableImage = scene.snapshot(null);
    // Write snapshot to file system as a .png image
    File outFile = new File("imageops-snapshot.png");
    try {
      ImageIO.write(
        SwingFXUtils.fromFXImage(writableImage, null),
        "png",
        outFile
    } catch (IOException ex) {
      System.out.println(ex.getMessage());

  • Characters show up as boxes when using AWT components.

    Having installed on a Windows XP english OS the asian languages packs (with fonts included, from Microsoft) and knowing that with MS Gothic, Gulim and Simsun you can display japanese, korean and chinese characters it seems that on JRE 1.5 and up this is not possible (boxes appear instead) on any applet.
    How to reproduce:
    Label l2 = new Label("Japanese chars: \u8457\u4f5c\u6a29");
    Workaround:
    Step 1. Rename ..\jre\lib\fontconfig.properties.src to ……\fontconfig.properties
    Step 2. Modify the following line:
    sequence.allfonts=alphabetic/default,dingbats,symbol
    to
    sequence.allfonts=alphabetic/default,dingbats,symbol,japanese,chinese-ms936,chinese-ms950,korean
    How is this possible? On JRE 1.4 this was working. Also another fix is to use Swing components instead but this is not realistic for a big project.
    Any help will be greatly apprecied.

    The problem is related to the JRE v. 1.5.0_11 or greater. In JRE 1.4.2_13 for each language there was a configuration file that Java was using to determine which fonts to use for different categories of objects.
    The problem is encountered only for AWT components.
    Starting with JRE 1.5 (http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html) there is only one configuration file (fontconfig.properties.src) for all the languages. Since the character subsets supported by given fonts often overlap, in the file separate search sequence properties are used to define in which order to try the fonts when rendering a character. In the default version of the file this properties do not specify also the asian languages.
    We have to do the following things:
    *1.* You must first install into Windows the support for asian languages: Control Panel - > Regional and Language Options
    � On the Advanced tab add the conversion tables for all Asian languages (this action may not be required).
    � On the Languages tab check �Install files for East Asian Languages (this action is required)
    Restart the computer.
    *2.* Assure you have the needed asian fonts : batang(fopr korean), simsun, gulim, mingliu, msgothic(for japanese) installed.
    *3.* Rename ...\jre\lib\fontconfig.properties.src to ��\jre\lib\fontconfig.properties. By doing this the fontconfig.properties file will be used by the JRE as the default configuration file.
    *4.* Modify the following line:
    sequence.allfonts=alphabetic/default,dingbats,symbol
    to
    sequence.allfonts=alphabetic/default,dingbats,symbol,japanese,chinese-ms936,chinese-ms950,korean
    *5.* Assure that in the file the logical to physic font binding, binds to existing fonts.
    Obs: If step 1 is skipped the titles of the windows will still have boxes.
    Hope it helps.
    Donoiu Cristian

  • Multilanguage support for awt components..

    hi all,
    when i tried to use .setFont() method for awt componets like labels and buttons it is displayed as rectangles insted of showing the appropriate characters. actually i tried to set the font to "simsun" (unicode font for chinese). but it works fine for swing components.
    how can we achieve that for awt without changing the font.properties file? or how can we insist to use the font.properties file supplied by us insted of default font.property file for that language?
    can we run the application by putting our font.properties file which is meant to be used for only our application, in the current working folder insted of putting in javahome\jre\lib path?
    thanks in advance..
    regards
    sojan

    Hi Sojan,
    first up, forget the notion of even tinkering with the font.properties file if you can. It's an old, outdated method of setting up the fonts that Sun doesn't even support any more. Use setFont() where you can, and die trying in the process! ;-)
    One thing I would check is which font each AWT component currently thinks it has. It's easy enough to set the font system wide with Swing components, but I'm not sure if that capability extends to AWT components (I've certainly had trouble with it in various places in the past). While you've set up the Chinese font correctly, your AWT components might still be stuck with the Java default (Helvetica, or whatever it is, which is incapable of displaying Chinese), and hence displaying the rectangles because they don't know how to handle the foreign characters. You might need to set SimSun as the font for each of your AWT components individually at a worst-case scenario.
    Hope that helps,
    Martin Hughes

  • Some country native characters in AWT components

    Hi All,
    I have problem with visualization some native characters on AWT components. For instance, when I put on the Frame some Labels components, then I can't see correct some special polish native characters, I can only see some boxes. It seems the same with some other AWT components with a text entry.
    This problem is only in GUI, because some other issues like Strings and Stream processing works good.
    (I tested it both on WinXP and Linux SuSE 9.1 with the same result)
    Thanks in advance for some help
    Krzysztof

    Have you tried doing this in Swing? Works for me:
    import java.awt.*;
    import javax.swing.*;
    public class FontExample {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    buildGUI();
        static void buildGUI() {
            Font font=new Font("Dialog",Font.PLAIN,12);
            String text="re\u0123istr\u0113tiem";
            JTextArea textarea=new JTextArea();
            textarea.setFont(font);
            textarea.setText(text);
            JComboBox combo=new JComboBox(new String[]{text});
            combo.setFont(font);
            JFrame f = new JFrame("FontExample");
            Container cp = f.getContentPane();
            cp.add(combo, BorderLayout.NORTH);
            cp.add(textarea, BorderLayout.CENTER);
            f.pack();
            f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • AWT components

    Hi,
    I want to have some GUI buttons in my applet. They appear in my applet but don't obey the size and location.
         public void init()
              username = new TextField();
              username.setSize(100, 23);
              username.setLocation(240, 200);
              add(username);
              password = new TextField();
              password.setSize(100, 23);
              password.setLocation(240, 250);
              password.setEchoChar('*');
              add(password);
              login = new Button("Login!");
              login.setSize(100, 50);
              login.setLocation(200, 300);
              login.addActionListener(this);
              add(login);
         }

    Javaisthefuture wrote:
    Thanks! I just forgot the setLayout(null);But still my question remains unanswered: why are you using AWT and not Swing? Is it because the sample code you downloaded uses AWT? Do you understand the difference? Do you know the difference between heavy-weight and light-weight components?

  • Future of JavaFx and commitment from Sun

    Hi All,
    I wanted to get some insight into the level of investment an organization could make into adopting JavaFX as the preferred UI technology for their products/applications. Is Sun committed to promoting JavaFX and making it production quality and implementing with time all the missing UI components? What is th efuture of JavaFx after the Sun-Oracle merger?
    thanks
    Sanjeev

    Hi Sanjeev
    in my opinion:
    JavaFX is a promising technology but it is currently too green to consider use in a serious application. To my knowledge, only one company has so far released a serious product written in JavaFX (Indaba), but I've never used it and they themselves describe it as "alpha". I believe Indaba went with JavaFx because they were reliant on Java APIs (they were originally going to use Flash)
    The JavaFX team seem to be working hard on improving the technology, particularly around performance, however it is still quite buggy, and this will hamper efforts to produce a serious application. Also, as you mention, there are gaps in the components available for use in applications. There is also work going on for tooling.
    There are very little public facts available on the future of JavaFX (aside from sporadic marketing pushes). Oracle made a public commitment to JavaFX at JavaOne, but I don't know whether you can bet a corporate strategy on that alone. We know that future releases are coming, albeit at a slow pace.
    It would be great if Sun/Oracle could come up with something more detailed, as I think that (alongside a stable platform) would do a lot to increase the confidence of developers.
    My guess is that it will end up as a stable technology, though I've no idea how long this will take. To that end, I would closely monitor the progress of the technology but maybe not adopt it as the preferred technology just yet.

  • Changing AWT components to Swing components

    I'm having a little trouble changing some AWT components to Swing components. I received an error message when I tried to run my program. I looked up the component in the java docs. But, I did not see the option the error was talking about. The error and the area of code is listed below. Thank you for any help you can provide.
    Error message:
    Exception in thread "main" java.lang.Error: Do not use P5AWT.setLayout() use P5A
    WT.getContentPane().setLayout() instead
    at javax.swing.JFrame.createRootPaneException(JFrame.java:446)
    at javax.swing.JFrame.setLayout(JFrame.java:512)
    at P5AWT.<init>(P5AWT.java:56)
    at P5AWT.main(P5AWT.java:133)
    Press any key to continue . . .
    Code:
    JPanel p3 = new JPanel();
    p3.setLayout(new FlowLayout(FlowLayout.CENTER));
    ta = new JTextArea(20, 60);
    p3.add(ta);
    setLayout(new FlowLayout(FlowLayout.CENTER));
    add(p3);

    you need to change the line...
    setLayout(new FlowLayout(FlowLayout.CENTER)); to
    getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER));

  • Concurrently update awt components

    Hello all,
    What I understand is that it's impossible to update awt components concurrently in a thread save way. For example; If you want to implement a game in which when you push on a button a counter starts to run (in a JTextField for example). While that counter is running you want that button to be disabled for a fixed time, let's say 1 second, and want to count down on that button's text. At the same time other components should be updated by other code in the game logic ( things like mana regenration counters etc.).
    Is this possible in a thread save way with standard libraries?

    Thank you for replying.
    Yes that is what I understood. My problem is though, for example in the case of the mana regeneration, that I want it to regenerate at a fixed rate. So x amount in y seconds. I know this comes close to real time programming and is not really possible, but that's not the point here. What I'd like is that the current mana is available to the game logic and displayed at the same time in the gui, while it's being updated. While this mana regeneration is running, the user can press another button (a spell) and the mana takes another hit, while still being updated by the regeneration thread. Other game logic may affect the mana aswell (like abilities of monsters).
    The problem here is that I need none user events to update awt components and that it should be displayed in the gui real time (ish).

  • AWT Components without Border

    I've made subclasses of all awt components and overwritten pain() metod so that the component don't have border. But this technik don't work with TextField and TextArea ( Button, Choice, List is working fine). Does any body kwno what should I do to have components with NO border or with 2D border?

    Its a pain() isn't it! Guess the only way is to do a workaround. Maybe this could be a way?
    class MyTextField extends Panel
       public TextField m_TextField;
       MyTextField()
          m_TextField = new TextField();
          add(m_TextField);
       public void doLayout()
          m_TextField.setBounds(-2, -2, getSize().width+4, getSize().height+4);
    Ragnvald Barth
    Software engineerhttp://blake.prohosting.com/ragnvald/

  • JavaFX and Smart GWT

    Hi,
    I have a requirement to use Smart GWT component in JavaFX.
    I have a basis question..
    1. Can we integrate Smart GWT components in JavaFX?
    2. If we integrate Smart GWT in JavaFX then how the perfomance would be..will be fast or slow? I mean loading the GWT components in JavaFX Application.
    3. Is there any RAD Plugins for JavaFX and Smart GWT? there is one plugin called efxeclipse for JavaFX.. but it didn't work..  ( I tried in RAD).
    Fredrick

    > 1. Can we integrate Smart GWT components in JavaFX?
    Yes, display your GWT component in a WebView.
    > 2. If we integrate Smart GWT in JavaFX then how the perfomance would be..will be fast or slow? I mean loading the GWT components in JavaFX Application.
    Use the 32 bit JVM which includes a JIT compiler for JavaScript in WebView.
    Performance is going to be similar to displaying a GWT component in any web browser.
    > 3. Is there any RAD Plugins for JavaFX and Smart GWT?
    JavaFX has a RAD tool (SceneBuilder), but that is focused on JavaFX component use, not GWT component use so it will not assist you.
    If there is any GWT RAD tool (I don't know of any), you can use that - you don't need anything JavaFX specific because if you are developing GWT, you are not developing JavaFX, the most you would be doing is wrapping the GWT component in a JavaFX WebView with some (hopefully minimal) communication between the GWT component and the JavaFX application.
    > efxeclipse for JavaFX.. but it didn't work
    e(fx)clipse works very well for JavaFX development, it just has absolutely nothing to do with GWT, so it is not a tool for GWT development.

  • IDOC for Creation of Production order and also adding components

    Hi ,
    I have a requirement like I get the data from a 3rd party system and using that i have to create production orders and also should be able to add more materials in COMPONENTS part of that Production order. I was looking for a BAPI which can handle this process.
    And also can any one help me by letting me know is there any Message type available for handling this process of Production order creation and Adding extyra components to it.
    I have a  message type LOIPRO (for Production Order) and associated function modle CLOI_MASTERIDOC_CREATE_LOIPRO for creation of master IDoc, but not sure can i handle the Components part in this.
    Please do send replies ASAP, its very urgent.
    Or else atleast suggest me the other ways of doing this .
    Also send me any BDC program if anyone has already developed for this.
    Thanks
    Kumar
    Edited by: Phani Kumar Peddagopu on Mar 19, 2008 6:56 PM

    Resolved .

  • Does any update help to install and run myFaces components?

    Hi.
    I have JSC trial. And didn't make update.
    I can't install myFaces component library. Why?
    Does any update help to install and run myFaces components, and other component library?
    Thanks.

    Hi,
    The following thread could be of help for you:
    http://swforum.sun.com/jive/thread.jspa?forumID=123&threadID=48666
    Cheers :-)
    Creator Team

  • On my MacBook with Lion Safari does start, does not react immediately after trying to open it. Installing a new Safari does not help. Removing parts of Safari in the Library did not help. Where can I find and remove all components (LastSession ...)?

    How can I reset Safari with all components? On my MacBook with Lion, Safari does not start, does not react immediately after trying to open it. Installing a new Safari does not help. Removing parts of Safari in the Library does not help. Where can I find and remove all components as LastSession and TopSites?

    The only way to reinstall Safari on a Mac running v10.7 Lion is to restore OS X using OS X Recovery
    Instead of restoring OS X in order to reinstall Safari, try troubleshooting extensions.
    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test.
    If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.
    If it's not an extensions issue, try troubleshooting third party plug-ins.
    Back to Safari > Preferences. This time select the Security tab. Deselect:  Allow plug-ins. Quit and relaunch Safari to test.
    If that made a difference, instructions for troubleshooting plugins here.
    If it's not an extension or plug-in issue, delete the cache.
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.

Maybe you are looking for

  • What is rewardzone and why do I get it with every exit of Firefox, requiring an additional two steps to close?

    When I ose Firefox, another screen pops up as the screen I''m working on closes. It is from something called "rewardzone" and I have to close it (one step) and then answer that I want to allow it to close (step two). Just started in the last couple o

  • Rebuild our XI application server from Single stack to dual stack

    Hello, We currently have an XI landscape with two application servers, the CI is of course a dual stack system, however the two app servers are single stacked, however we would like to make the two app servers into DUAL STACKs, my first guess was to

  • Zip file with execlp

    I'm trying to find the best way to zip a file from a Cocoa app. I have found a lot of information using NSData, but do not actually want to ready in the text file first. I'm trying to use execlp, but am also trying to understand forking at the same t

  • My satellite R15-S822

    Hi, I'm Carla.  I have three problems and don't know if they are related.  My sound has been gone for a long time.  I have reinstalled the drivers and it doesn't help.  Also the computer doesn't work by battery any more only when I use the electrical

  • Replication Error in Quotation from CRM to ECC

    Hi All, This is regarding the Replication error which we are getting in the Quotation/Orders in the CRM server, when the Quotation/Orders is getting replicated to ECC server. Let me explain the process, We have the Internet Sales Application (ISA Ver