SetImage BitmapField error

Hi all

I tried to make an animation of the sprite by BitmapField by setImage() function,

my image successfully recovered all the time.

but it pop up the exception when bitmapfield setImage()

java.lang.IllegalStateEx[0.0] ception: : Screen: View.SplashScreen@97e30a58 Engine:

 net.rim.device.a[0.0] pi.ui.UiEngineImpl$UiEngineOldInterfaceAdapter@dee282e2[0.0]

My Code:

VerticalFieldManager  topManager = new VerticalFieldManager (VerticalFieldManager.FIELD_HCENTER);

        int width = Display.getWidth();
        int height = Display.getHeight();
        int logo3s_w = 200;
        int logo3s_h = 130;
        int pocket_w = 220;
        //int pocket_h = 38;

        final BitmapField splashField = new BitmapField();
        splashField.setMargin((height - logo3s_h) >> 2, (width - logo3s_w) >> 2 + 100, 0 , 0) ;  //setMargin(int top,int right,int bottom,int left)
        topManager.add(splashField);

        final BitmapField splashSecondField = new BitmapField();
        splashSecondField.setMargin(100, (width - pocket_w) >> 2 + 110, 0, 0);
        topManager.add(splashSecondField);

        add(topManager);

new Thread(){
            public void run(){
                System.out.println("--------------------------------Enter splashThread----------------------------------");
                int frameCount = 0;
                SplashImage _splashImage = new SplashImage();
                try{
                    while(frameCount<14){
                        if(_splashImage!=null){
                            System.out.println("-------------------FrameCount: " + frameCount +"-----------------------");

                            splashField.setImage(_splashImage.fetchImage("/splash_3s_" + topImageSeq[frameCount] + ".png",true));
                            System.out.println("********************11111111111111");
                            splashSecondField.setImage(_splashImage.fetchImage("/splash_pn_" + bottomImageSeq[frameCount] + ".png", true));
                            System.out.println("*********************22222222222222222");

                            try {
                                Thread.sleep(sleepTimes[frameCount]);
                            } catch (InterruptedException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }
                            frameCount ++;

                        }

                    }
                }catch(Exception e){
                    System.out.println("-----------------------------Splash error---------------------------------: " + e);
                }

                System.out.println("--------------switch screen------------------------");

                try {
                    screenUtil.switchScreen(new RTSPScreen(true));
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }.start();

To debug on my BOLD 9700 OS 6.0.0.668 device

It run correctly once and fail, exchange between them.

I don't know how to fix it. Please help me.

Thank you all.

do not use Thread.sleep on the tread of the user interface. your first solution was good, with the exception of the missing invokelater.
You must combine thread and invokelater, do not use one or the other.

Another option would be to use the timer/timertask, as long as it is non-blocking.

Maybe this article is useful:
http://supportforums.BlackBerry.com/T5/Java-development/display-an-animated-GIF/Ta-p/445014

Tags: BlackBerry Developers

Similar Questions

  • How QMetaObject::invokeMethod solved: no method bb::cascades:QmlListView error?

    Hi all

    When I try to call QMetaObject::invokeMethod at that time where I get error below.

    "QMetaObject::invokeMethod: no such bb::cascades:QmlListView:detailNews (QVariant) method.

    Down here I have attached a code please check and let me know how I can fix this issue?

    ApplicationUI.cpp

    NewsList.cpp

    #include "applicationui.hpp"
    
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    
    using namespace bb::cascades;
    using namespace bb::data;
    
    QString getValueByKey(QVariant qVariant, QString qStrKey);
    QString getValueByKey(QVariant qVariant, QString qStrPath, QString qStrKey);
    QVariantList getListByPath(QVariant qVariant, QString qStrPath);
    
    ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
            QObject(app), root(0)
    {
        // prepare the localization
        m_pTranslator = new QTranslator(this);
        m_pLocaleHandler = new LocaleHandler(this);
    
        bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this,
                SLOT(onSystemLanguageChanged()));
        // This is only available in Debug builds
        Q_ASSERT(res);
        // Since the variable is not used in the app, this is added to avoid a
        // compiler warning
        Q_UNUSED(res);
    
        // initial load
        onSystemLanguageChanged();
    
        // Create scene document from main.qml asset, the parent is set
        // to ensure the document gets destroyed properly at shut down.
        /* QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
         // Create root object for the UI
         AbstractPane *root = qml->createRootObject();
    
         // Set created root object as the application scene
         Application::instance()->setScene(root);*/
        QmlDocument *qmlLoadingDialog = QmlDocument::create("asset:///LoadingDialog.qml").parent(this);
        dialogLoading = qmlLoadingDialog->createRootObject();
        languageLocalList = languageList();
        home_Page();
    }
    
    void ApplicationUI::onSystemLanguageChanged()
    {
        QCoreApplication::instance()->removeTranslator(m_pTranslator);
        // Initiate, load and install the application translation files.
        QString locale_string = QLocale().name();
        QString file_name = QString("Godfessions_%1").arg(locale_string);
        if (m_pTranslator->load(file_name, "app/native/qm")) {
            QCoreApplication::instance()->installTranslator(m_pTranslator);
        }
    }
    
    void ApplicationUI::home_Page()
    {
        QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
        //QmlDocument *settingqml = QmlDocument::create("asset:///Setting_Page.qml").parent(this);
        qml->setContextProperty("app", this);
        root = qml->createRootObject();
        m_newListView = root->findChild("newsListView");
        root->setParent(this);
        Application::instance()->setScene(root);
    
        showLoadingDialog();
        getCategories("12143");
        newsListWebServices("12143");
        closeLoadingDialog();
    }
    
    void ApplicationUI::detailNews(QString news_Id)
    {
        qDebug() << "Detail News Get" << news_Id;
    }
    
    /** * Prepared by :- Umang Shah * **/#include "NewListItem.hpp"
    
    #include #include #include #include #include #include #include #include 
    
    using namespace bb::cascades;
    
    NewListItem::NewListItem(ListView * listView) : CustomControl(0){ this->listView = listView; QmlDocument *qml = QmlDocument::create("asset:///CustomRowNewsList.qml").parent(this); root = qml->createRootObject(); m_newsName = root->findChild

    It also seems that you have an incorrect class here.  You are detailNews method is in your ApplicationUI class, but you are trying to call on the ListView, not your ApplicationUI object.

    I recommend having a read through our documentation of signals and Slots , which should help you to achieve what you're trying to do.

  • Resize Images coded before adding it to a BitmapField

    I will have questions my image re-sizing. I click on an image using the camera and store it in the images folder. When I retrieve the image I see the picture on the screen but I want it to be smaller, since it occupies the entire screen and more and I have to scroll down. I added the code to scaleImage (see linebelow code red) but no luck. I'm doing something wrong? -Thank you.

    EncodedImage image = EncodedImage.createEncodedImage (dataArray, 0, dataArray.length)

    image.scaleImage32 (1, 1);

    BitmapField bitmapField = new BitmapField();

    bitmapField.setImage (image);

    Add (bitmapField);

    fixed32.tOFP's it. Thank you

  • Error 104 when call pushscreen

    Hi all

    I am a beginner with RIM API, and I am developing a small application with Eclipse.

    In fact, I have a 'class hand screen', which shows my home screen, no problem for it.

    I have a button when I click on, it displays a menu with many items, I would like that this element (called 'send') show me a new screen, simply. Yes, it's simple I know but I ' v still a real problem with one exception and I don't understand why...

    Here, the function in my 'main' class who attempts to call one method from another class

    public boolean onSend(){
    
    testecran te = new testecran();
    te.affiche();
    return true
    

    and there, my class 'testecran '.

    public class testecran extends UiApplication {
    
            public void affiche() {
    
                testecran theApp = new testecran();
                theApp.enterEventDispatcher();
    
                };
    
                public  testecran(){
    
                    pushScreen(new UserInterscreen());
                }
    
        }
    
        final class UserInterscreen extends MainScreen{
    
            HorizontalFieldManager _fieldManagerTop;
            VerticalFieldManager _fieldManagerMiddle;
            HorizontalFieldManager _fieldManagerBottom;
            BitmapField _bitmap;
            Bitmap _logoImage;
            BasicEditField _input;
            int displayed = 0;
    
            public UserInterscreen() {
            super();
            LabelField title = new LabelField("Welcome",
            LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
            setTitle(title);
    
            }}
    

    I tried to call an alert of dialogue and it is work... then there is a problem with my "pushscreen" function, I think...

    When I try to run in the Simulator, when I click on my question, in my menu, i ' v this error exactly:

    App error 104

    Eception: RuntimeException

    After many changes, I don't know why it does not work...

    Like SImon, I'm confused by the code you are using.

    I'm working on writing some tutorials designed to initiate people in the development of Java on the BlackBerry.  Attached are the first two (in fact, there is an introduction one but you don't need that).  Remember that they have not officially reviewed by anyone yet so treat with caution.  But I hope that you find them useful and they explain some of the concepts that you seem to be missing.

    At least, I think they will help.

    Please read, review and comment on tutorials and if they answer your questions.

    See you soon

    Edit:

    Attachments deleted.  I hope I can publish soon.

  • Error on Threads

    Hi I have the following code which works perfectly well on the Simulator.

    package com.ashmillers.fgg.PremiershipDivision;
    
    import javax.microedition.location.Coordinates;
    
    import net.rim.blackberry.api.browser.Browser;
    import net.rim.blackberry.api.browser.BrowserSession;
    import net.rim.blackberry.api.invoke.Invoke;
    import net.rim.blackberry.api.invoke.PhoneArguments;
    import net.rim.device.api.lbs.MapField;
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.DrawStyle;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Manager;
    import net.rim.device.api.ui.Ui;
    import net.rim.device.api.ui.XYPoint;
    import net.rim.device.api.ui.XYRect;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.container.GridFieldManager;
    import net.rim.device.api.ui.container.HorizontalFieldManager;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    public class Arsenal extends MainScreen {
        public Arsenal()
        {
            setBanner(new LabelField ("Premiership Team - Arsenal", DrawStyle.HCENTER|Manager.USE_ALL_WIDTH) {
                public void paint(Graphics graphics)
                {
                    graphics.setBackgroundColor(Color.FORESTGREEN);
                    graphics.clear();
                    graphics.setColor(Color.WHITE);
                    Font myFont = Font.getDefault().derive(Font.BOLD, 8, Ui.UNITS_pt);
                    setFont(myFont);
                    super.paint(graphics);
                }
            });
    
            setStatus(new LabelField ("Copyright Ashley Parker ©", DrawStyle.HCENTER|Manager.USE_ALL_WIDTH) {
                public void paint(Graphics graphics)
                {
                    graphics.setBackgroundColor(Color.FORESTGREEN);
                    graphics.clear();
                    graphics.setColor(Color.WHITE);
                    Font myFont = Font.getDefault().derive(Font.BOLD, 8, Ui.UNITS_pt);
                    setFont(myFont);
                    super.paint(graphics);
                }
            });
    
            final Manager gridFieldManager = new GridFieldManager(33, 1, Field.FIELD_HCENTER);
    
            VerticalFieldManager backgroundManager = new VerticalFieldManager(Manager.FIELD_HCENTER|USE_ALL_WIDTH|Manager.VERTICAL_SCROLL)
            {
                Bitmap logoBitmap = Bitmap.getBitmapResource("redandwhite.png");
                Bitmap logoBitmap1 = Bitmap.getBitmapResource("yellowandmaroon.png");
    
                int imgWidth = logoBitmap.getWidth();
                int imgHeight = logoBitmap.getHeight();
                int imgXPos = 5;
                int imgYPos = 17;
                int imgTop = 0, imgLeft = 0;
    
                public void paint(Graphics graphics)
                {
                    graphics.setBackgroundColor(Color.PALEGREEN);
                    graphics.clear();
    
                    int size = 20;
    
                    if(Display.getWidth() == 360 | Display.getWidth() == 320) {
                        size = 10;
                    }
    
                    graphics.setColor(Color.FORESTGREEN);
    
                    int totalHeight = getVirtualHeight();
                    graphics.fillRect(0,0, size, totalHeight); //left
                    graphics.fillRect(Display.getWidth() - size, 0, size, totalHeight); //right
    
                    if(Display.getWidth() == 480)
                    {
                        imgXPos = 32;
                        imgYPos = 11;
                        graphics.drawBitmap(imgXPos, imgYPos, imgWidth, imgHeight, logoBitmap, imgLeft, imgTop);
                        imgXPos = 377;
                        graphics.drawBitmap(imgXPos, imgYPos, imgWidth, imgHeight, logoBitmap1, imgLeft, imgTop);
                    }
    
                    if(Display.getWidth() == 360)
                    {
                        imgXPos = 29;
                        imgYPos = 18;
                        graphics.drawBitmap(imgXPos, imgYPos, imgWidth, imgHeight, logoBitmap, imgLeft, imgTop);
                        imgXPos = 296;
                        graphics.drawBitmap(imgXPos, imgYPos, imgWidth, imgHeight, logoBitmap1, imgLeft, imgTop);
                    }
    
                    if(Display.getWidth() == 320)
                    {
                        imgXPos = 24;
                        imgYPos = 17;
                        graphics.drawBitmap(imgXPos, imgYPos, imgWidth, imgHeight, logoBitmap, imgLeft, imgTop);
                        imgXPos = 262;
                        graphics.drawBitmap(imgXPos, imgYPos, imgWidth, imgHeight, logoBitmap1, imgLeft, imgTop);
                    }
                    graphics.setColor(Color.BLACK);
                    super.paint(graphics);
                }
            };
    
            LabelField myLabelField = new LabelField();
    
            backgroundManager.add(myLabelField =  new LabelField("ARSENAL FC", Field.FIELD_HCENTER|Field.FOCUSABLE)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
    
                protected void paint(Graphics g) {
                    int prevColor = g.getColor();
                    g.setColor(Color.FORESTGREEN);
                    super.paint(g);
                    g.setColor(prevColor);
                }
    
            });
    
            Font myFont = Font.getDefault().derive(Font.EXTRA_BOLD | Font.ITALIC, 11, Ui.UNITS_pt);
            myLabelField.setFont(myFont);
            myLabelField.setMargin(20,0,0,0);
    
            Font myFont1 = Font.getDefault().derive(Font.BOLD, 7, Ui.UNITS_pt);
            Font myFont2 = Font.getDefault().derive(Font.PLAIN, 7, Ui.UNITS_pt);
            Font myFont3 = Font.getDefault().derive(Font.BOLD, 9, Ui.UNITS_pt);
            Font myFont4 = Font.getDefault().derive(Font.ITALIC|Font.BOLD, 11, Ui.UNITS_pt);
    
            HorizontalFieldManager hfm = new HorizontalFieldManager(Field.FIELD_HCENTER);
    
            LabelField lf = new LabelField("The Emirates Stadium", LabelField.FIELD_HCENTER|LabelField.FOCUSABLE)
            {
                protected void paint(Graphics g) {
                    int prevColor = g.getColor();
                    g.setColor(Color.FORESTGREEN);
                    super.paint(g);
                    g.setColor(prevColor);
                }
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setMargin(20,0,0,0);
            lf.setFont(myFont3);
    
            backgroundManager.add(lf);
    
            Bitmap bitmapImage = Bitmap.getBitmapResource("emirates.png");
            BitmapField bmf = new BitmapField(bitmapImage, FIELD_HCENTER|FOCUSABLE);
            bmf.setMargin(0,0,20,0);
            gridFieldManager.add(bmf);
    
            LabelField lf1 = new LabelField("CAPACITY: ", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf1.setFont(myFont1);
            gridFieldManager.add(lf1);
    
            lf = new LabelField("60,432", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
    
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            lf = new LabelField("ADDRESS: ", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont1);
            gridFieldManager.add(lf);
    
            lf = new LabelField("75 Drayton Park, London, N5 1BU", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            lf = new LabelField("TELEPHONE: ", LabelField.FOCUSABLE|Field.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont1);
            gridFieldManager.add(lf);
    
            lf = new LabelField("020 7619 5003", LabelField.FOCUSABLE|Field.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    g.setColor(Color.WHITE);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, on, rect.x, rect.y, rect.width, rect.height);
                    super.paint(g);
                }
                public boolean navigationClick (int status , int time){
                    String number = this.getText();
                    int response = Dialog.ask(Dialog.D_YES_NO,"Are you sure you want to dial the number? \nCall charges will be applicable.",Dialog.YES);
                    if(response == Dialog.YES)
                    {
                        PhoneArguments phoneArgs = new PhoneArguments(PhoneArguments.ARG_CALL, number);
                        Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, phoneArgs);
                    }
                    return true;
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            lf = new LabelField("TICKET LINE: ", LabelField.FOCUSABLE|Field.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont1);
            gridFieldManager.add(lf);
    
            lf = new LabelField("020 7619 5000", LabelField.FOCUSABLE|Field.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, true, rect.x, rect.y, rect.width, rect.height);
                }
                public boolean navigationClick (int status , int time){
                    String number = this.getText();
                    int response = Dialog.ask(Dialog.D_YES_NO,"Are you sure you want to dial the number? \nCall charges will be applicable.",Dialog.YES);
                    if(response == Dialog.YES)
                    {
                        PhoneArguments phoneArgs = new PhoneArguments(PhoneArguments.ARG_CALL, number);
                        Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, phoneArgs);
                    }
                    return true;
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            if(Display.getWidth() == 480) {
                bitmapImage = Bitmap.getBitmapResource("border_480.png");
            }
            else if(Display.getWidth() == 360) {
                bitmapImage = Bitmap.getBitmapResource("border_360.png");
            }
            else if(Display.getWidth() == 320) {
                bitmapImage = Bitmap.getBitmapResource("border_320.png");
            }
    
            bmf = new BitmapField(bitmapImage, FIELD_HCENTER|FOCUSABLE);
            bmf.setMargin(15,0,15,0);
            gridFieldManager.add(bmf);
    
            final LabelField lf2 = new LabelField("www.arsenal.com", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                public void paint(Graphics graphics)
                {
                    graphics.setColor(Color.BLUE);
                    super.paint(graphics);
                }
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    g.setColor(Color.WHITE);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, on, rect.x, rect.y, rect.width, rect.height);
                    super.paint(g);
                }
                public boolean navigationClick (int status , int time){
    
                    int response = Dialog.ask(Dialog.D_YES_NO,"Are you sure you want to access the internet? \nData charges may be applicable if they are not included on your tariff.",Dialog.YES);
                    if(response == Dialog.YES)
                    {
                        BrowserSession bSession = Browser.getDefaultSession();
                        bSession.displayPage("http://www.arsenal.com");
                    }
                    return true;
                }
            };
    
            lf2.setFont(myFont4);
    
            gridFieldManager.setMargin(0,0,20,0);
            gridFieldManager.add(lf2);
    
            if(Display.getWidth() == 480) {
                bitmapImage = Bitmap.getBitmapResource("border_480.png");
            }
            else if(Display.getWidth() == 360) {
                bitmapImage = Bitmap.getBitmapResource("border_360.png");
            }
            else if(Display.getWidth() == 320) {
                bitmapImage = Bitmap.getBitmapResource("border_320.png");
            }
    
            bmf = new BitmapField(bitmapImage, FIELD_HCENTER|FOCUSABLE);
            bmf.setMargin(15,0,15,0);
            gridFieldManager.add(bmf);
    
            lf = new LabelField("STADIUM OPENED: ", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont1);
            gridFieldManager.add(lf);
    
            lf = new LabelField("2006", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            lf = new LabelField("AWAY STAND: ", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont1);
            gridFieldManager.add(lf);
    
            lf = new LabelField("South East Corner", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            lf = new LabelField("USUAL ALLOCATION: ", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont1);
            gridFieldManager.add(lf);
    
            lf = new LabelField("3000 Seats", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            if(Display.getWidth() == 480) {
                bitmapImage = Bitmap.getBitmapResource("border_480.png");
            }
            else if(Display.getWidth() == 360) {
                bitmapImage = Bitmap.getBitmapResource("border_360.png");
            }
            else if(Display.getWidth() == 320) {
                bitmapImage = Bitmap.getBitmapResource("border_320.png");
            }
    
            bmf = new BitmapField(bitmapImage, FIELD_HCENTER|FOCUSABLE);
            bmf.setMargin(15,0,15,0);
            gridFieldManager.add(bmf);
    
            lf = new LabelField("NEARBY PUBS (Walking): ", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont1);
            gridFieldManager.add(lf);
    
            lf = new LabelField("Twelve Pins (10 mins)", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            lf = new LabelField("Blackstock Pub (10 mins)", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            if(Display.getWidth() == 480) {
                bitmapImage = Bitmap.getBitmapResource("border_480.png");
            }
            else if(Display.getWidth() == 360) {
                bitmapImage = Bitmap.getBitmapResource("border_360.png");
            }
            else if(Display.getWidth() == 320) {
                bitmapImage = Bitmap.getBitmapResource("border_320.png");
            }
    
            bmf = new BitmapField(bitmapImage, FIELD_HCENTER|FOCUSABLE);
            bmf.setMargin(15,0,15,0);
            gridFieldManager.add(bmf);
    
            lf = new LabelField("TRAIN/TUBE STATIONS", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont1);
            gridFieldManager.add(lf);
    
            lf = new LabelField("Arsenal Tube Station", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            lf = new LabelField("Finsbury Park Tube Station", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            if(Display.getWidth() == 480) {
                bitmapImage = Bitmap.getBitmapResource("border_480.png");
            }
            else if(Display.getWidth() == 360) {
                bitmapImage = Bitmap.getBitmapResource("border_360.png");
            }
            else if(Display.getWidth() == 320) {
                bitmapImage = Bitmap.getBitmapResource("border_320.png");
            }
    
            bmf = new BitmapField(bitmapImage, FIELD_HCENTER|FOCUSABLE);
            bmf.setMargin(15,0,15,0);
            gridFieldManager.add(bmf);
    
            lf = new LabelField("CAR PARKING", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont1);
            gridFieldManager.add(lf);
    
            lf = new LabelField("No nearby parking. Easier", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            lf = new LabelField("to park at a tube station.", LabelField.FOCUSABLE|LabelField.FIELD_HCENTER)
            {
                protected void drawFocus(Graphics g, boolean on){
                    XYRect rect = new XYRect();
                    getFocusRect(rect);
                    drawHighlightRegion(g, HIGHLIGHT_FOCUS, false, rect.x, rect.y, rect.width, rect.height);
                }
            };
            lf.setFont(myFont2);
            gridFieldManager.add(lf);
    
            hfm.add(gridFieldManager);
            backgroundManager.add(hfm);
    
            add(backgroundManager);
        }
    }
    

    However, when I add the following code to the screen I get an error message about too many threads

    //      MapField myMap;
    //
    //      int myPrevZoom = 3;
    //
    //      Coordinates c = new Coordinates(51.554928, -0.108361, 0);
    //      myMap = new MapField(Field.FOCUSABLE){
    //          protected void paint(Graphics graphics) {
    //              Bitmap myIcon = Bitmap.getBitmapResource("stadium_icon.png");;
    //              XYRect myDest = null;
    //              super.paint(graphics);
    //              if (null != myIcon) {
    //                  if (null == myDest) {
    //                      XYPoint fieldOut = new XYPoint();
    //                      convertWorldToField(getCoordinates(), fieldOut);
    //                      int imgWidth = myIcon.getWidth();
    //                      int imgHeight = myIcon.getHeight();
    //                      myDest = new XYRect(fieldOut.x - imgWidth / 2,
    //                              fieldOut.y - imgHeight, imgWidth, imgHeight);
    //                  }
    //                  graphics.drawBitmap(myDest, myIcon, 0, 0);
    //              }
    //          }
    //      };
    //
    //      myMap.setPreferredSize(290,250);
    //      myMap.moveTo(c);
    //      myMap.setMargin(30,0,20,20);
    //      myMap.setZoom(myPrevZoom);
    //
    //      backgroundManager.add(myMap);
    

    What is the case and how to solve this?

    Thank you

    And which line in your code, you are in when this happens?

    Also all the code you pasted is commented on isn't she.  If you added the comment lines?

    I take that you actually remove all of this but it's confusing isn't.

    But please do not copy and paste your code here.  We are not paid to wade through your code.  Rather try to prove too small a section of code as possible, that shows the problem.  This means not just modify the code you.  If you cannot debug your code and need help, then I think that too is that you benefit to help us. You can do this by reproducing the problem is an autonomous small section of the code.  Then it is easier for us to review and also possible for us to test.  Ok?

    Finally, I think you make too much treatment in the paint.  Paint is often called and if you do as little as possible in there.  He shouldn't layout fields, get values, get the bitmaps and others.

    Here's a simple example:

    Replace this:

    myMap = new MapField (Field.FOCUSABLE) {}
    protected void paint (Graphics graphics) {}
    Bitmap myIcon = Bitmap.getBitmapResource ("stadium_icon.png");

    with this

    myMap = new MapField (Field.FOCUSABLE) {}

    Bitmap myIcon = Bitmap.getBitmapResource ("stadium_icon.png");
    protected void paint (Graphics graphics) {}

    and now you recharge a bitmap for each painting, do you this only once!

    For even if you need paint the location later, when he changes you must reset the field with Bitmaps that you want (for example), and then invalidate the field so that it gets repainted.  So you do that once when the situation changes, not whenever you call paint.

    I suspect that a change like this will solve your problem.

  • BitmapField does not display an image bitmap. In fact, it does not display anything at all...

    My problem is simple and fast. I am probably just a stupid mistake, but the BitmapField component does nothing and does not display the bitmap image. I first tried to display a Bitmap using its setBitmap (bitmap Bitmap) method, which did not work. Then I tried to use it's method setBitmap to the Builder, who did nothing at all no more. Then I tried to use setImage using an image encoded if nothing happened again. Yes, both the encoded image and methods of Bitmap.fromBitmap that make new Bitmap objects and EncodedImage POINTENT to real images in my project folder. So what I am doing wrong, I forget to call a method in needed or what? I use Eclipse with the plugin and I use the Blackberry 9550 Simulator.

    First of all, your use setSpace is incorrect. What you are doing here are to define a space around the bitmap image - in this case, the space is bigger than most of the screens, which will ensure that your bitmap image is not actually on the screen. See the description of the API in the javadocs.

    Second, you SHOULD check the return of getBitmapResource(). If it returns NULL, then the resource was not available. What you're doing here can hide a problem.

  • Bugs in EncodedImage and BitmapField

    Hi guys,.

    I was badly put to scale down a large image (1600 x 1200) taken

    w / BB to fit on the Pearl camera. I use api EncodedImage for scale

    and send it to BitmapField. But this cause a system reboot. When I

    use BitmapField with the image without scaling, I will get an out of memory

    exception and my app will not work again.  BitmapField will work only w /.

    small images.

    I had a problem with that, and it seems that, on some devices, an error arithmatic will cause the device to reboot. This is probably due to an argument of the wrong size on the Bitmap you generate. Values getWidth() and getHeight() will return a value of Fixed32 with some height and the width of the image resizing product (even if it is false). I solved the problem by encapsulating all the numbers in a Fixed32 object and using the Fixed32.div () method.

    E.g.

    Bitmap b = EncodedImage.getEncodedResource("myImage.png").scale32 (Fixed32.div (Fixed32.toFP (1600), Fixed32.toFP (w_scale)),)

    Fixed32.div (Fixed32.toFP (1200), Fixed32.toFP (h_scale)));

  • Error on image from the server and display streaming

    Hi all

    Im trying to read an Image that origin of the server and displays on a screen

    Here's the code I'm using to broadcast the image.

    It is streaming on my Simulator as well as on some devices.

    But on some devices, it's not streaming and throw an exception.

    public UrlToEncodedImage(String url)
    {
    HttpConnection connection = null;
    InputStream inputStream = null;
    byte[] dataArray = null;
    
    try
    {
    connection = (HttpConnection) Connector.open(url+getConnectionString(), Connector.READ, true);
    inputStream = connection.openInputStream();
    byte[] responseData = new byte[10000];
    int length = 0;
    StringBuffer rawResponse = new StringBuffer();
    while (-1 != (length = inputStream.read(responseData)))
    {
    rawResponse.append(new String(responseData, 0, length));
    }
    int responseCode = connection.getResponseCode();
    if (responseCode != HttpConnection.HTTP_OK)
    {
    throw new IOException("HTTP response code: "+ responseCode);
    } 
    
    final String result = rawResponse.toString();
    dataArray = result.getBytes();
    }
    catch (final Exception ex)
    { }
    
    finally
    {
    try
    {
    inputStream.close();
    inputStream = null;
    connection.close();
    connection = null;
    }
    catch(Exception e){}
    } 
    
    bitmap = EncodedImage.createEncodedImage(dataArray, 0,dataArray.length);
    // this will scale your image acc. to your height and width of bitmapfield
    
    int multH;
    int multW;
    int currHeight = bitmap.getHeight();
    int currWidth = bitmap.getWidth();
    if(currHeight>350&&currWidth>350){
        bitmap=scaleToFactor(bitmap,currWidth,currHeight,Display.getWidth()-20,250);
    }
    
    }
    public EncodedImage getEncodedImage()
    {
    return bitmap;
    }
    public  EncodedImage scaleToFactor(EncodedImage encoded, int curWidth, int curHeight, int newWidth,
            int newHeight)
    {
         int numerator_width = Fixed32.toFP(curWidth);
         int denominator_width = Fixed32.toFP(newWidth);
         int scale_width = Fixed32.div(numerator_width, denominator_width);
    
         int numerator_height = Fixed32.toFP(curHeight);
         int denominator_height = Fixed32.toFP(newHeight);
         int scale_height = Fixed32.div(numerator_height, denominator_height);
    
         return encoded.scaleImage32(scale_width, scale_height);
    }
    private static String getConnectionString()
    {
        String connectionString = null;
        if(DeviceInfo.isSimulator())
        {
                if(UrlToEncodedImage.USE_MDS_IN_SIMULATOR)
                {
                       connectionString = ";deviceside=false";
                }
                else
                {
                       connectionString = ";deviceside=true";
                }
        }
        else if(WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)
        {
           connectionString = ";interface=wifi";
        }
    
        else if((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT)
        {
            String carrierUid = getCarrierBIBSUid();
            if(carrierUid == null)
            {
             connectionString = ";deviceside=true";
            }
            else
            {
               connectionString = ";deviceside=false;connectionUID="+carrierUid + ";ConnectionType=";
            }
        }                
    
       else if((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS)
        {
          connectionString = ";deviceside=false";
        }
    
       else if(CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_NONE)
        {}
        else
        { connectionString = ";deviceside=true";} 
    
        return connectionString;
    }
    private static String getCarrierBIBSUid()
    {
        ServiceRecord[] records = ServiceBook.getSB().getRecords();
        int currentRecord;
    
        for(currentRecord = 0; currentRecord < records.length; currentRecord++)         {             if(records[currentRecord].getCid().toLowerCase().equals("ippp"))             {                 if(records[currentRecord].getName().toLowerCase().indexOf("bibs") >= 0)
                {
                    return records[currentRecord].getUid();
                }
            }
        }
    
        return null;
    }
    

    The underlined part of the code is where the uid is sent as public _.

    Please, look in the code and let me know where the error is, or is there a better way to disseminate the image.

    In the hope that you hear.

    Thank you & best regards

    Krishnan

    Hello

    I found the error.

    It's in the URL sent by the server.

    The URL consisted of http://google.com

    But the format required to retrieve the image on several device would be http://www.google.com.

    Thanks for anyone who tried to help him.

    Krishnan.

  • crash in bb::cascades:ImageView:setImage

    no idea about this...

    crush the info:

    End of process 190877883 (mapview) code SIGSEGV = 1 fltno = 11 ip=797774ec(/base/usr/lib/libbbcascades.so.1@_ZN2bb8cascades9ImageView16resetImageSourceEv+0x137) mapaddr = 001774ec. REF = 00000010 = 1 bdslot

    QML:

    ImageView
    {
    ID: myImageView
    objectName: "imageObj.
    visible: false
    scalingMethod: ScalingMethod.AspectFit
    preferredHeight: 768
    preferredWidth: 768
    }

    Button {}

    ...

    onClicked:
    {

    mapViewTest.startGenMapImage ();
    }

    }

    Code:

    Sub MapViewDemo::startGenMapImage()
    {

    ......

    BB:latform::geo:GeoList gList = mapView-> mapData()-> defaultProvider()-> toGeoList();
    BB::Cascades:maps:MapImageGenerator * pMapImgGen = new MapImageGenerator (viewpro, gList);

    Connect (pMapImgGen, SIGNAL (finished(bb::cascades::maps::MapImageGenerator*)),
    This, SLOT (imageIsReady(bb::cascades::maps::MapImageGenerator*)));)

    pMapImgGen_-> start();

    }

    void MapViewDemo::imageIsReady (bb::cascades:maps:MapImageGenerator * pMapImgGen)
    {
    If (! pMapImgGen-> error())
    {
    BB::Cascades:image img (pMapImgGen-> imageData());
    imgView_-> setImage (img);   crushed
    imgView_-> setVisible (true);
    }
    on the other
    {
    qDebug() < "app::generate="" image="" error:"=""> < pmapimggen-=""> error();
    }
    delete pMapImgGen;

    }

    Check "img" and check if the imgView_ is a pointer valid.

  • Not able to focus BitmapField

    Hi gurus

    I searched for this error but have not been able to find a solution.

    I have a HorizontalFieldManager where I add BitmapFields. These BitmapFields have FOCUSABLE, no problem with that style.

    What I'm trying to do, it is only when the user focuses on a different field, outside the HorizontalFieldManager and then returns to the HorizontalFieldManager, enforcement "remembers" field was centered in the HorizontalFieldManager, much as the menus of Twitter and Facebook on their BB applications.

    To do this, I'm saving SelectedIndex when the Manager is blurry:

       protected void onUnfocus(){
            BitmapField focusedField = (BitmapField) getFieldWithFocus();
            if (focusedField != null) selectedIndex = focusedField.getIndex();      
    
            super.onUnfocus();
        }
    

    It works very well, I'm able to get the selectedIndex property. So what I try to do next is to focus this field when the manager gets concentrate:

     protected void onFocus(int direction) {     
    
            BitmapField fieldToFocus = (BitmapField) getField(selectedIndex);
            if (fieldToFocus != null) fieldToFocus.setFocus();              
    
            super.onFocus(direction);
        }
    

    I see that fieldToFocus is recovered succcesfully, is not null and the selectedIndex property is valid, but when I run the method

    fieldToFocus.setFocus()
    

    It is for me a StackOverflow Exception.

    I tried many other ways and have not been able to understand how to fix it. I also tried to comment the last line on the onFocus event: super.onFocus (branch);

    But it does not work.

    Help, please!

    a Board exception stackoverflow on a loop without end. maybe onFocus is called again when you run setFocus? Avoid it along with a check on the target area.

    I would also call great.

  • Weird error with two classes that surrounds picking paths (oraclebook)

    Hi guys! I come here once more to ask for help, please!

    As you may know, im currently studying this book of the oracle, but my two classes that take the paths give me some errors.
    Can anyone have a look for me? I has not changed the codes at all!
    package CapituloII;
    
    /**
     *
     * 
     */
    
    import java.io.File;
    import java.util.ArrayList;
    import java.util.List;
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.input.DragEvent;
    import javafx.scene.input.Dragboard;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.input.TransferMode;
    import javafx.scene.layout.HBox;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Arc;
    import javafx.scene.shape.ArcBuilder;
    import javafx.scene.shape.ArcType;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.shape.RectangleBuilder;
    import javafx.stage.Stage;
    
    /**
     * Creating Images
     * @author cdea
     */
    public class Pagina70 extends Application {
        private List<String> imageFiles = new ArrayList<>();
        private int currentIndex = -1;
        public enum ButtonMove {NEXT, PREV};
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            Application.launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) {
            primaryStage.setTitle("Chapter 2-1 Creating a Image");
            Group root = new Group();
            Scene scene = new Scene(root, 551, 400, Color.BLACK);
            
            
            // image view
            final ImageView currentImageView = new ImageView();
            
            // maintain aspect ratio
            currentImageView.setPreserveRatio(true);
            
            // resize based on the scene
            currentImageView.fitWidthProperty().bind(scene.widthProperty());
            
            final HBox pictureRegion = new HBox();
            pictureRegion.getChildren().add(currentImageView);
            root.getChildren().add(pictureRegion);
            
            // Dragging over surface
            scene.setOnDragOver(new EventHandler<DragEvent>() {
                @Override
                public void handle(DragEvent event) {
                    Dragboard db = event.getDragboard();
                    if (db.hasFiles()) {
                        event.acceptTransferModes(TransferMode.COPY);
                    } else {
                        event.consume();
                    }
                }
            });
            
            // Dropping over surface
            scene.setOnDragDropped(new EventHandler<DragEvent>() {
    
                @Override
                public void handle(DragEvent event) {
                    Dragboard db = event.getDragboard();
                    boolean success = false;
                    if (db.hasFiles()) {
                        success = true;
                        String filePath = null;
                        for (File file:db.getFiles()) {
                            filePath = file.getAbsolutePath();
                            currentIndex +=1;
                            imageFiles.add(currentIndex, filePath);
                        }
                        
                        // set new image as the image to show.
                        Image imageimage = new Image(filePath);
                        currentImageView.setImage(imageimage);
                            
                    }
                    event.setDropCompleted(success);
                    event.consume();
                }
            });
    
            
            // create slide controls
            Group buttonGroup = new Group();
            
            // rounded rect
            Rectangle buttonArea = RectangleBuilder.create()
                    .arcWidth(15)
                    .arcHeight(20)
                    .fill(new Color(0, 0, 0, .55))
                    .x(0)
                    .y(0)
                    .width(60)
                    .height(30)
                    .stroke(Color.rgb(255, 255, 255, .70))
                    .build();
            
            buttonGroup.getChildren().add(buttonArea);
            // left control
            Arc leftButton = ArcBuilder.create()
                    .type(ArcType.ROUND)
                    .centerX(12)
                    .centerY(16)
                    .radiusX(15)
                    .radiusY(15)
                    .startAngle(-30)
                    .length(60)
                    .fill(new Color(1,1,1, .90))
                    .build();
            
            leftButton.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
                public void handle(MouseEvent me) {                
                    int indx = gotoImageIndex(ButtonMove.PREV);
                    if (indx > -1) {
                        String namePict = imageFiles.get(indx);
                        final Image image = new Image(new File(namePict).getAbsolutePath());
                        currentImageView.setImage(image);
                    }
                }
            });
            buttonGroup.getChildren().add(leftButton);
            
            // right control
            Arc rightButton = ArcBuilder.create()
                    .type(ArcType.ROUND)
                    .centerX(12)
                    .centerY(16)
                    .radiusX(15)
                    .radiusY(15)
                    .startAngle(180-30)
                    .length(60)
                    .fill(new Color(1,1,1, .90))
                    .translateX(40)
                    .build();
            buttonGroup.getChildren().add(rightButton);
            
            rightButton.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
                public void handle(MouseEvent me) {                
                    int indx = gotoImageIndex(ButtonMove.NEXT);
                    if (indx > -1) {
                        String namePict = imageFiles.get(indx);
                        final Image image = new Image(new File(namePict).getAbsolutePath());
                        currentImageView.setImage(image);
                    }
                }
            });
            
            // move button group when scene is resized
            buttonGroup.translateXProperty().bind(scene.widthProperty().subtract(buttonArea.getWidth() + 6));
            buttonGroup.translateYProperty().bind(scene.heightProperty().subtract(buttonArea.getHeight() + 6));
            root.getChildren().add(buttonGroup);
            
            primaryStage.setScene(scene);
            primaryStage.show();
        }
        
        /**
         * Returns the next index in the list of files to go to next.
         * 
         * @param direction PREV and NEXT to move backward or forward in the list of 
         * pictures.
         * @return int the index to the previous or next picture to be shown.
         */
        public int gotoImageIndex(ButtonMove direction) {
            int size = imageFiles.size();
            if (size == 0) {
                currentIndex = -1;
            } else if (direction == ButtonMove.NEXT && size > 1 && currentIndex < size - 1) {
                currentIndex += 1;
            } else if (direction == ButtonMove.PREV && size > 1 && currentIndex > 0) {
                currentIndex -= 1;
            }
    
            return currentIndex;
        }
        
    }
    Error generated when I drag-and - drop:

    ATTENTION: It won't let me copy the first two lines and the last two lines of the error:

    >




    java.lang.IllegalArgumentException: Invalid URL: unknown protocol: c
    at javafx.scene.image.Image.validateUrl (unknown Source)
    to javafx.scene.image.Image. < init >(Unknown Source)
    to CapituloII.Pagina70$ 2.handle(Pagina70.java:96)
    to CapituloII.Pagina70$ 2.handle(Pagina70.java:80)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent (unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent (unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent (unknown Source)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent (unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent (unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent (unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent (unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent (unknown Source)
    at com.sun.javafx.event.EventUtil.fireEventImpl (unknown Source)
    at com.sun.javafx.event.EventUtil.fireEvent (unknown Source)
    at javafx.event.Event.fireEvent (unknown Source)
    to javafx.scene.Scene$ DnDGesture.fireEvent (unknown Source)
    to javafx.scene.Scene$ DnDGesture.processTargetDrop (unknown Source)
    to javafx.scene.Scene$ DnDGesture.access$ 6500 (unknown Source)
    to javafx.scene.Scene$ DropTargetListener.drop (unknown Source)
    at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.handleDragDrop (unknown Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleDragDrop (unknown Source)
    at com.sun.glass.ui.View.handleDragDrop (unknown Source)
    at com.sun.glass.ui.View.notifyDragDrop (unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop (Native Method)
    in com.sun.glass.ui.win.WinApplication.access$ 100 (unknown Source)
    to com.sun.glass.ui.win.WinApplication$ $2 1.run (unknown Source)
    at java.lang.Thread.run(Thread.java:722)
    Caused by: java.net.MalformedURLException: unknown protocol: c
    at java.net.URL. < init > (URL.java:590)
    at java.net.URL. < init > (URL.java:480)
    at java.net.URL. < init > (URL.java:429)
    ... more than 27
    Exception in thread 'Thread of Application JavaFX' E

    Hello

    I think that the string you give to the new Image (string) must be a URL, not a single file path.

    So if you have a file, it would be something like:

    File file = ...;
    Image image = new Image(file.toURI().toURL().toExternalForm());
    

    Hope this helps,

    -daniel

  • Uninstall software update Apple says error in seller contact package package unstaller

    Try to get itunes working to make a backup of my faulty iphone before repair.

    First-itunes does not start says error. I'm trying to fix it, who said success but same error when you try to start it.

    Then uninstall completely worked. Then reinstall that seemed to be over except for a message "an older version of Apple software update already exists" then he went down and install itunes apparently had not been completed.

    Then I try to remove the update from the apple software and executed by an error in the installation program - it says there is an error in the installation and contact the supplier of the installation package. Same error if I run the uninstall command line program.

    Try to repair the Apple Software Update of programs & features Control Panel and then try to update iTunes again.

    For general advice, see troubleshooting problems with iTunes for Windows updates.

    The steps described in the second case are a guide to remove everything related to iTunes and then rebuild what is often a good starting point, unless the symptoms indicate a more specific approach.

    Review the other boxes and other support documents list to the bottom of the page, in case one of them applies.

    The more information box has direct links with the current and recent if you have problems to download, must revert to an older version or want to try the version of iTunes for Windows (64-bit - for older video cards) as a workaround for problems with installation or operation, or compatibility with third-party software.

    Backups of your library and device should be affected by these measures but there are links to backup and recovery advice there.

    TT2

  • SUMIF error

    I'm new to apple and get a syntax error when you use SUMIF.  In my table, I just need column F to test the value of column E.  If it is greater than 0, then divide by 20.  Thank you!

    In cell F1

    = E1/if(E1>0, 20, 1)

    fill down as needed

  • An error in this Applescript that I can't understand

    Hi, I searched some forums and found this script below which I modified. It works great except for a single statement:

    runScript If = 1 then number error -128 I want the script to do is, when a USB drive is mounted and is in the ignoredVolumes as "USB Untitled" I want the script to stop. What I can't understand is, runScript is set to 1, "Untitled USB" Monte, runScript is not changed, why don't the script stops with an error "user cancelled"? On the other hand, if a key USB Monte is not in the ignoredVolumes, runScript is set to 2 and copy the file I want it. What hurts? It's probably something that will be very obvious when I see the answer.

    Thanks for any help with this problem,

    Mike.



    property ignoredVolumes: {'10,10 30 1. 5 't', 'files 1. 5 't', "Untitled USB"} - add if necessary

    property videoExtensions: {"avi", "mov", "mpg", "wmv", "mp4" and "mkv"}

    the value newVolume to the alias (POSIX file "/ Volumes/files 1.") ("5T / new")

    the value oldVolume to the alias (POSIX file "/ Volumes/files 1.") ("5T / old")

    game runScript to 1

                   tell application "System events".

    the value rootVolumes to disk (POSIX file ' / Volumes ' in the text)

    the value allVolumes to name of every element of disc of rootVolumes

    the value numofallVolumes to the County of allVolumes

    Repeat with the present book in allVolumes

    say application 'Finder '.

    if (the present book is not in ignoredVolumes and (this book as text) is not '. ') DS_Store') then

    if there are alias (POSIX (' / Volumes / "& the present book) as text file ) then game runScript to 2

    runScript If = 1 then number error -128 - it does not give a 'User cancelled' error when "Untitled USB" is mounted

    runScript If = 2 then

                                                                            try

    duplicate (elements whose name is in the videoExtensions extension) in alias (POSIX file (' / Volumes / "& the present book &" / new ") as text) to newVolume

    on error number errorNumber errorMessage

    _error value of errorMessage

    _errorNum the value to errorNumber

    If errorNumber is -15267 then

    display the dialog box "This file already exists in folder a." buttons {"OK", "No"} default button 1 with the title "Film copy error?" giving upwards after 10

    If the returned button of result is 'No' then

    Error number-128

    on the other

    If the result is 'OK' or back button gave up lead and then of

    eject the present book

    display the dialog box "U S B D r i v e E j e c t e d - K O t o R e m o v e" {"no need to click on this button"} default button 1 button give up after 5

    return

    end if

    end if

    end if

    end try

    Try

    duplicate (elements whose name is in the videoExtensions extension) in alias (POSIX file (' / Volumes / "& the present book &" / old ") as text) to oldVolume

    on error number errorNumber errorMessage

    _error value of errorMessage

    _errorNum the value to errorNumber

    If errorNumber is -15267 then

    display the dialog box "This file already exists in the folder B" buttons {"OK", "No"} default button 1 with the title "Film copy error?" giving upwards after 10

    If the returned button of result is 'No' then

    Error number-128

    on the other

    If the result is 'OK' or back button gave up lead and then of

    eject the present book

    display the dialog box "U S B D r i v e E j e c t e d - K O t o R e m o v e" {"no need to click on this button"} default button 1 button give up after 5

    return

    end if

    end if

    end if

    end try

    display the dialog box "USB key will Auto Eject in 10 seconds or click OK... "buttons button 1 with the title"copy Complete - Eject? "default {'OK', 'No'} which gives after 10

    If the returned button of result is 'No' then

    Error number-128

    on the other

    If the button returned of result is "OK" or gave up a result then ejection of the this book

    display the dialog box "U S B D r i v e E j e c t e d - K O t o R e m o v e" {"no need to click on this button"} default button 1 button give up after 5

    end if

    end if

    end if

    end say

    end Repeat

              end say

    The way in which your external block If is currently based, the script can't do anything when this book is in the ignoredVolumes, it can not yet test the runScript value. Try something like this:

    If the present book is in the ignoredVolumes then

    game runScript to 1

    on the other

    if (the present book as text is not '. ') DS_Store') then

    if there are alias (POSIX (' / Volumes / "& the present book) as text file ) then game runScript to 2

    end if

    end if


    Of course, you need to remove a "end if' the end of the script.



  • error message when try to sync the iPhone, "invalid response from the device?

    What can I do when I receive this error message when you try to sync to my iPhone 5 s - "invalid response from the device?

    -What are your 5 updating to 10.0.2 iOS iPhone? If this is the case, you must have the latest version of iTunes on your computer, which is required for Mac OS X 10.9.5 12.5.1, or above. To meet these specifications will be receiving this error.

Maybe you are looking for

  • I need to install a full standalone version for a system on the internet.

    I have a requirement to install FireFox on the internet connected non-systemes. I SCCM 2012 and want to use it. However, for the test, a complete stand-alone single version is good at the moment. Not necessary for working with SCCM. But must be fully

  • Safari bookmarks

    I have Safari 9.1.2 and any time that I open it the bookmarks on the left side bar opens, make my screen relatively (and annoyingly) smaller. It also happens if I click out of Safari or open a new tab. I googled on all senses in the sentence of this

  • driver wireless help

    I have a HP Mini 110-3547tu, it seems that the only thing missing is the wireless driver, btw installs Windows 7 Ultimate edition. any help will be highly appreciated, thanks in advance

  • Safari locked Zeus virus

    Should I be worried? Today, while trying to go to the Gmail site this (see photo) came on the screen and I had to do a closed hard. The message says windows detected that? Is the Zeus on the Mac virus. Older (about 5-6 years) iMac, running OSX 10.7.5

  • Looking for audio driver HP 14 r-017tx

    I download driver for my laptop HP 14 r-017tx, but it is not compatible with my laptop, at the moment im using the default windows driver, so if anyone can help me find my audio driver it would be appreciated