Results 1 to 4 of 4

Thread: Java for iPhone with iSpectrum

  1. #1
    Join Date
    Sep 2010

    Java for iPhone with iSpectrum

    I am giving an explanation by introducing 2 new classes UIKit: UIScrollView and UIPageControl. A scroll view is used to display content that is larger than the size allocated for this purpose (usually the entire screen). It supports the keys of the user can scroll the view by sweeping gestures (swiping gestures) or zoom in by pinching (pinch gesture to zoom). It draws nothing if not scroll bars vertical and horizontal and is used to hold other views. The graphical component (widget) Control page represents all views displayed by a line whose white point means the displayed frame. An example of use can be observed in managing tabs in Safari for iPhone. Required Softwares, To begin using iSpectrum, You Will Need to Have Installed On your computer:
    • Eclipse 3.4 (Ganymede) or 3.5 (Galileo)
      Recommended packages Eclipse IDE: Eclipse IDE for Java Developers gold annually Eclipse Java Development Tools (JDT) plugin (included in MOST Eclipse IDE packages).
    • JDK or JRE, version 5 or later
    • iPhone SDK

    If JDK is already installed is your development computer, please take a moment to make sure that it meets the requirements recreational or version. In particular, that note some Linux distributions include may JDK 1.4 or gnu compiler for java, both of which are not supported for flexycore plug in.

    Description :

    This sample application allows the user to use a sweeping motion to navigate between 4 monochrome pages. This action brings up the next page with an animation of translation. Meanwhile component control page shows what the current page with a white dot.


    This view is custom made from 2 sub-views: a scroll view and page view control.
    public class MyView extends UIView { 
    / ** 
    * Fields 
    * / 
    private Vector <UIViewController> viewControllers; 
    Private UIScrollView ScrollView; 
    Private UIPageControl PageControl;

  2. #2
    Join Date
    Sep 2010

    Re: Java for iPhone with iSpectrum

    A Vector containing the list of our monochrome views are to be placed in the scroll view. Here's how they are created:
    public MyView () { 
    super (); 
    initWithFrame (CGRect. CGRectMake (0, 0, 320, 380)); 
    / * 
    * Construction Views 
    * / 
    Vector colors = new Vector <UIColor> <UIColor> (); 
    colors.add (UIColor. blueColor ()); 
    colors.add (UIColor. whiteColor ()); 
    colors.add (UIColor. redColor ()); 
    colors.add (UIColor. greenColor ()); 
    viewControllers = new Vector <UIViewController> (); 
    for (int i = 0; i <colors.size (); i + +) 
    // New UIViewController 
    UIViewController viewCtr UIViewController = new (); 
    viewCtr.init (); 
    // New UIView 
    UIView view = new UIView (); 
    view.initWithFrame (CGRect. CGRectMake (0, 0, 320, 380)); 
    view.setBackgroundColor (colors.elementAt (i)); 
    // Add a label 
    UILabel UILabel label = new (); 
    label.initWithFrame (CGRect. CGRectMake (0, 100, 320, 40)); 
    label.setBackgroundColor (UIColor. clearColor ()); 
    label.setTextColor (UIColor. blackColor ()); 
    label.setTextAlignment (UITextAlignment. UITextAlignmentCenter); 
    label.setText ("PAGE" + (i +1)); 
    view.addSubview (label); 
    viewCtr.setView (view); 
    viewControllers. add (viewCtr); 
    A UILabel is included on the page to indicate what page it is to see that the control page returns a good value.
    / * 
    * PageControl 
    * / 
    PageControl UIPageControl = new () { 
    @ Override 
    public ControlEvent void () { 
    changePage (this. currentPage ()); 
    PageControl. initWithFrame (CGRect. CGRectMake (0, 385, 320, 31)); 
    PageControl. setNumberOfPages (viewControllers. size ()); 
    PageControl. setCurrentPage (0); 
    PageControl. addTargetActionForControlEvents (UIControlEvents. UIControlEventValueChanged); 
    addSubview (PageControl);
    The page control is initialized to manage 4 pages, starting at page 0 and reacts to the event UIControlValueChanged. When this event occurs, its method ControlEvent () is called. This is how the paradigm UIKit Target-Action has been adapted to Java. This event is triggered whenever the currentPage attribute will be changed. We'll see where this is the case in the next section with the section of scroll view delegate. When this event occurs, it calls the method changePage ().

  3. #3
    Join Date
    Sep 2010

    Re: Java for iPhone with iSpectrum

    / ** 
    * Change Of The content offset ScrollView To The new current page. 
    * / 
    public changePage void (int page) { 
    CGPoint contentOffset CGPoint = new (); 
    contentOffset.init (320 * page, 0); 
    ScrollView. setContentOffsetAnimated (contentOffset, true); 
    As the commentary suggests, the method is to change the offset of the scroll view that determines which of the views contained will be displayed. The offset is chosen to be a multiple of the width of the screen (320), which is also the width of sub-views. So that the pages are displayed one to one entirely. Returning now to the constructor: it now creates the scroll view.
    / * 
    * Scroll setting properties 
    * / 
    ScrollView UIScrollView = new (); 
    ScrollView. initWithFrame (CGRect. CGRectMake (0, 0, 320, 380)); 
    float W = this. frame (). getSize (). getWidth () * viewControllers. size (); 
    float H = this. frame (). getSize (). getHeight (); 
    ScrollView. setContentSize (new CGSize (). init (W, H)); 
    ScrollView. setPagingEnabled (true); 
    ScrollView. setShowsHorizontalScrollIndicator (false); 
    ScrollView. setShowsVerticalScrollIndicator (false); 
    ScrollView. setScrollsToTop (false); 
    ScrollView. setUIScrollViewDelegate (new ScrollDelegate (this)); 
    addSubview (ScrollView);
    The frame of the view is set to full screen and contentSize attribute to define the display area of sub-views. Then pagingEnabled is set to true which has the effect of stopping the animation scroll pages in multiples of the size of the view. As this corresponds to sub-views, it has a "page by page. Then, we associate a custom delegate and then added to the current view. Finally we load all pages.
    / / Load all views 
    for (int i = 0; i <viewControllers. size (); i + +) { 
    loadScrollViewWithPage (i); 
    Let's see what it is: 
    public loadScrollViewWithPage void (int page) { 
    if (page <0) return; 
    if (page> = viewControllers. size ()) return; 
    UIViewController ViewController = viewControllers. ElementAt (page); 
    if (ViewController == null) return; 
    / / Add The Controller's View To The scroll view 
    if (viewController.view (). SuperView () == null) { 
    CGRect frame = this. Frame (); 
    frame.setOrigin (new CGPoint (). init (frame.getSize (). getWidth () * page, 0)); 
    viewController.view (). setFrames (frame); 
    ScrollView. addSubview (viewController.view ()); 
    This method creates the sub-views, side by side in the scroll view contentView from screens created and developed in Vector viewControllers. This callback method is called at the end of the animation page change that has previously enabled through pagingEnabled true. In this method we look at the offset of the scroll view to know the current page and thus update the page control. This will cause an event type UIControlValueChanged. The following image shows what happens when calling setCurrentPage () is called. You now know how to integrate scanning movement in your applications to handle more pages using UIScrollView class and associating it with the page control. You can give thanks to that render iPhone standard applications.

  4. #4
    aadithyas Guest

    Re: Java for iPhone with iSpectrum

    I have use it and get lots of benefits in my business. is a new york based mobile site builder company. We at offer latest and user friendly tools for website. If you want too cheap and best mobile web application then you can contact with me at
    Last edited by Maqbool; 26-11-2010 at 01:00 AM. Reason: External Links Not Allowed, Removed The Same.

Similar Threads

  1. Replies: 4
    Last Post: 04-09-2013, 11:04 PM
  2. Replies: 12
    Last Post: 14-01-2012, 01:50 AM
  3. Link List Example in Java Sample program in Java
    By trickson in forum Software Development
    Replies: 2
    Last Post: 04-08-2009, 08:23 PM
  4. how to activate java in mini iphone m531g??
    By banbanme in forum Portable Devices
    Replies: 1
    Last Post: 18-06-2009, 10:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts