Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to rotate an image?

"im  a student its my assigment"

Shouldn't you be writing your own code then?

 

I don't think I can add to the comments I made in this post:

http://supportforums.blackberry.com/t5/Java-Development/How-to-rotate-an-image/m-p/1705095#M198123

Please use plain text.
New Contributor
farhankhan0987
Posts: 7
Registered: ‎05-08-2012
My Device: blackberry 9930 simulator
My Carrier: blackberry

Re: How to rotate an image?

how to invoke this method??

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to rotate an image?

What method?

 

Can I suggest that you start by learning the basics of Java.  Once you have done that, then you should start your Blackberry coding.  Until then, you trying to write Java code for the BlackBerry will be like trying to climb a very steep wall with no grip. 

 

If you want somewhere to start with Java on BlackBerry, I suggest here:

http://supportforums.blackberry.com/t5/Java-Development/Tutorials-for-new-developers-Part-1/m-p/1621...

Please use plain text.
New Contributor
farhankhan0987
Posts: 7
Registered: ‎05-08-2012
My Device: blackberry 9930 simulator
My Carrier: blackberry

Re: How to rotate an image?

i have a sample  picture scroll  demo blackberry code below  how iwhich just simple show pictures how i convert this code to auto  rotate continuesly  circle moving      like

 

                                                                     pic1
                                                         pic2                 pic6
                                                              pic3            pic5
                                                                      pic4



/**
 * PictureScrollFieldDemoScreen.java
 *
 * Copyright © 1998-2011 Research In Motion Ltd.
 *
 * Note: For the sake of simplicity, this sample application may not leverage
 * resource bundles and resource strings.  However, it is STRONGLY recommended
 * that application developers make use of the localization features available
 * within the BlackBerry development platform to ensure a seamless application
 * experience across a variety of languages and geographies.  For more information
 * on localizing your application, please refer to the BlackBerry Java Development
 * Environment Development Guide associated with this release.
 */
 
package com.rim.samples.device.ui.picturescrollfielddemo;

import net.rim.device.api.system.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.decor.*;
import net.rim.device.api.ui.extension.component.*;
import net.rim.device.api.ui.extension.component.PictureScrollField.*;


/**
 * The main screen class for the the Picture Scroll Field Demo application
 */
public final class PictureScrollFieldDemoScreen extends MainScreen implements FieldChangeListener
{
    private static final String CALL_OUT_TEXT = "Call-out ";
    
    private static final int NUM_ENTRIES = 4;
    
    private PictureScrollField _pictureScrollField;       
    private boolean _overlap;
    private CheckboxField _centerLensCheckBox;
    private CheckboxField _overlapCheckBox;
    private ObjectChoiceField _choiceField;
    
    private Bitmap[] _bitmaps;
    
    /**
     * Creates a new PictureScrollFieldDemoScreen object
     */
    public PictureScrollFieldDemoScreen()
    {      
        setTitle("Picture Scroll Field Demo");       
        
        // Initialize an array of Bitmaps
        _bitmaps = new Bitmap[NUM_ENTRIES];
        _bitmaps[0] = Bitmap.getBitmapResource("berry.jpg");
        _bitmaps[1] = Bitmap.getBitmapResource("logo_blue.jpg");
        _bitmaps[2] = Bitmap.getBitmapResource("logo_black.jpg");
        _bitmaps[3] = Bitmap.getBitmapResource("building.jpg");

        // Initialize an array of scroll entries
        ScrollEntry[] entries = new ScrollEntry[NUM_ENTRIES];
        entries[0] = new ScrollEntry(_bitmaps[0], "BlackBerry", CALL_OUT_TEXT + 1);
        entries[1] = new ScrollEntry(_bitmaps[1], "Blue logo", CALL_OUT_TEXT + 2);
        entries[2] = new ScrollEntry(_bitmaps[2], "Black logo", CALL_OUT_TEXT + 3);
        entries[3] = new ScrollEntry(_bitmaps[3], "Building", CALL_OUT_TEXT + 4);

        // Initialize the picture scroll field
        _pictureScrollField = new PictureScrollField(150, 100);
        _pictureScrollField.setData(entries, 0);        
        _pictureScrollField.setHighlightStyle(HighlightStyle.ILLUMINATE);
        _pictureScrollField.setHighlightBorderColor(Color.RED);
        _pictureScrollField.setBackground(BackgroundFactory.createSolidBackground(Color.LIGHTBLUE));
        _pictureScrollField.setLabelsVisible(true);
        _pictureScrollField.setLensShrink(0.4f);
        add(_pictureScrollField);
        
        // Initialize a choice field for highlight style selection
        String[] choices = new String[]  {"No highlight", "Illuminate",  "Illuminate with round border",
            "Illuminate with square border", "Square border", "Magnify lens", "Shrink lens", "Illuminate with magnify lens",
                "Illuminate with shrink lens"};
        add(new SeparatorField());
        add(new LabelField("Select highlight style", Field.FIELD_HCENTER));
        _choiceField = new ObjectChoiceField("", choices, HighlightStyle.ILLUMINATE, Field.FIELD_HCENTER);
        _choiceField.setChangeListener(this);
        add(_choiceField);
        
        add(new SeparatorField());
        
        // Initialize a check box for toggling the center lens
        _centerLensCheckBox = new CheckboxField("Enable center lens", false, Field.FIELD_HCENTER);
        _centerLensCheckBox.setChangeListener(this);
        add(_centerLensCheckBox);        
        
        // Initialize a check box for overlapping images
        _overlapCheckBox = new CheckboxField("Overlap images", false, Field.FIELD_HCENTER);
        _overlapCheckBox.setChangeListener(this);
        add(_overlapCheckBox);        
    }    
    
    
    /**
     * @see MainScreen#onSavePrompt()
     */
    protected boolean onSavePrompt()
    {
        // Suppress the save dialog
        return true;
    }
     

    /**
     * @see Screen#navigationClick(int, int)
     */
    protected boolean navigationClick(int status, int time)
    {
        if(_pictureScrollField.isFocus())
        {            
            if(Touchscreen.isSupported())
            {
                UiApplication.getUiApplication().pushScreen(new PinchScreen(_bitmaps[_pictureScrollField.getCurrentImageIndex()]));
            }
            else
            {
                Dialog.inform("You selected item " + _pictureScrollField.getCurrentImageIndex());
            }
            
            return true;
        }
        
        return super.navigationClick(status, time);
    }
    
    
    /**
     * @see Screen#touchEvent(TouchEvent)
     */
    protected boolean touchEvent(TouchEvent message)
    {
        if(message.getEvent() == TouchEvent.CLICK)
        {
            if(_pictureScrollField.isFocus())
            {                
                if(Touchscreen.isSupported())
                {
                    UiApplication.getUiApplication().pushScreen(new PinchScreen(_bitmaps[_pictureScrollField.getCurrentImageIndex()]));
                }
                else
                {
                    Dialog.inform("You selected item " + _pictureScrollField.getCurrentImageIndex());
                }
                
                return true;            
            }                  
        }
        return super.touchEvent(message);         
    }
    
    
    /**
     * @see FieldChangeListener#fieldChanged(Field, int)
     */
     public void fieldChanged(Field field, int context)
     {
         if(field == _choiceField)
         {
            // Set the highlight style
            int index = _choiceField.getSelectedIndex();
            switch(index)
            {
                 case HighlightStyle.NO_HIGHLIGHT:
                     _pictureScrollField.setHighlightStyle(HighlightStyle.NO_HIGHLIGHT);
                     break;
                 case HighlightStyle.ILLUMINATE:
                     _pictureScrollField.setHighlightStyle(HighlightStyle.ILLUMINATE);
                     break;                
                 case HighlightStyle.ILLUMINATE_WITH_ROUND_BORDER:
                     _pictureScrollField.setHighlightStyle(HighlightStyle.ILLUMINATE_WITH_ROUND_BORDER);
                     break;
                 case HighlightStyle.ILLUMINATE_WITH_SQUARE_BORDER:
                     _pictureScrollField.setHighlightStyle(HighlightStyle.ILLUMINATE_WITH_SQUARE_BORDER);
                     break;       
                 case HighlightStyle.SQUARE_BORDER:
                     _pictureScrollField.setHighlightStyle(HighlightStyle.SQUARE_BORDER);
                     break;
                 case HighlightStyle.MAGNIFY_LENS:
                     _pictureScrollField.setHighlightStyle(HighlightStyle.MAGNIFY_LENS);
                     break;                
                 case HighlightStyle.SHRINK_LENS:
                     _pictureScrollField.setHighlightStyle(HighlightStyle.SHRINK_LENS);
                     break;
                 case HighlightStyle.ILLUMINATE_WITH_MAGNIFY_LENS:
                     _pictureScrollField.setHighlightStyle(HighlightStyle.ILLUMINATE_WITH_MAGNIFY_LENS);
                     break;    
                 case HighlightStyle.ILLUMINATE_WITH_SHRINK_LENS:
                     _pictureScrollField.setHighlightStyle(HighlightStyle.ILLUMINATE_WITH_SHRINK_LENS);
                     break;           
             }            
             _pictureScrollField.setFocus();
         }
         else if(field == _centerLensCheckBox)
         {
            // Enable/disable the lens
            _pictureScrollField.setCenteredLens(!_pictureScrollField.hasCenteredLens());
         }
         else if(field == _overlapCheckBox)
         {
             //Toggle overlapping
             if(_overlap)
             {
                 _pictureScrollField.setImageDistance(150);
                 _overlap = false;
             }
             else
             {
                 _pictureScrollField.setImageDistance(100);
                 _overlap = true;
             }
         }
         _pictureScrollField.setFocus();       
     }   
}


Please use plain text.