Using ScrollPane in Flashbuilder

Hi,
if i follow the example in the API. I can't get a ScrollPane to work.
I import fl.containers.ScrollPane but FlashBuilder4 says it can't be found.
That the rest can't work is obvious.
How can I work with ScrollPanes only using FlashBuilder?

If you must use Flex 3 but want to use Flash Builder 4, you can choose the 3.5 SDK when you create a project in Flash Builder, and you will be building a Flex 3 project and all the old videos should work for you.
If you want to use Flex 4 and Flash Builder 4, then I suggest you learn from the Flex 4 and Flash Builder 4 videos (http://www.adobe.com/devnet/flex/videotraining/). That way there won't be any confusion between the old and new versions.
You can download the solution files for any of the exercises. The one called "Adding data to your application" will help you populate a DropDownList control. HTHs.

Similar Messages

  • How to scroll panels using scrollpane?

    i am having two panels containing different images in a main panel.
    my problem is that due to big size only one panel is visible in run time so i want to add scrollbar to the main panel.
    i have used scrollpane for the main panel but i am getting confused that at which event i should put the code of repainting the visible area.
    can anybody tell me how to implement this.
    plz... help

    gaurav_mishra wrote:
    actually i am working in netbeans so i don't know where is the paint method of the panel.can anybody plz help me get rid of this problemApparently we were all mistaken by your description, it looked like you were writing a custom JPanel subclass, with a custom paintComponent() method that would draw the images...
    I don't know how you display images in a Panel with NetBeans, but presumably it re-uses some existing JComponent and it doesn't have to generate a paintComponent() method.
    At that step you should consider the very first reply: please post some code, the shortest running example that demonstrates your problem.
    If you're reluctant, try a simple scroll example: put a single JButton in a JPanel with a FlowLayout, using an image as the button's icon. Stuff this panel into a JScrollPane, itslef in a JFrame, run the app and resize the JFrame. Check whether the button displays appropriately. If it does, try to check what's different with your problematic case.
    I like NetBeans (or merely, NetBeans's GUI designer), but it's not the best way to learn Swing programming, which looks like what you're doing.

  • Problem using scrollPane

    Hi All
    Let me explain the problem to u guys..
    I have a dialog whose contentPane is set to BorderLayout.A scrollPane is added to this dialog.Next a Panel is added to this ScrollPane and the panel is having a gridbaglayout.Some components are added to this Panel is rows and columns dynamically,everytime new components need to be added the old components are removed using removeAll.The scrollPane is having VERTICAL_SCROLLBAR_AS_NEEDED and HORIZONTAL_SCROLLBAR_NEVER (The component is given a fixed prefferedSize,MaximumSize and Minimum size).The problem is I am not getting to view all the components widthwise,vertically its OK since I have a scrollBar.I want all the compnents in the row to be displayed within the viewport area.
    Is it bcoz of fixed preferredSize,maximumsize and minimum size of componets that i am not getting to view them fully?Please give me a solution as to how i can solve the problem
    regards
    Oliver

    I would suspect the gridbag layout. If you add a horizontal scrollbar (just to find out what's going on), can you see all the components? Maybe you can post some code for us to look at. . .

  • I cant use ScrollPane in JList

    JList list=new JList(kaynak);
    list.setBounds(0,0,40,40);
    JScrollPane sc=new JScrollPane(list);
    add(list);
    add(sc);
    setVisible(true);
    why I do not have scrollBars arround my jlist? what is the problem?

    JList list=new JList(kaynak);
    list.setBounds(0,0,40,40);
    ScrollPane sc=new JScrollPane(list);
    add(list);
    add(sc);
    setVisible(true);
    why I do not have scrollBars arround my jlist? what
    is the problem?You've added the list to the scroll pane, but then you add the list to the frame. And then you add the scrollpane to the frame.
    This approach contains two flaws:
    A. You can't add a component to two different parents. When you try to do so, the component is removed from the original parent and added to the new parent. So, when your code says
    add(list);the list is removed from the scrollpane and added to the frame.
    B. You can't add two different components to the same container without indicating where to put them. Assuming your container has a default BorderLayout, your code adds the list at the CENTER position, and then adds the scrollpane at the CENTER position. As a result, your list is removed from the container and the scrollpane is added. but since the first flaw in your code removed the list from the scrollpane, nothing appears. The scrollpane is there, but it has nothing in it so the frame appears empty.
    Remove the line:
    add(list);and things should work.
    Jim S.

  • Using FlashBuilder 4 with Flex sdk 3.5

    Has anyone experianced any problems with using the new FlashBuilder 4 together with the Flex 3.5 sdk?

    I have not had any issues so far in the short time I have used FB4.
    I would like to use the new FB4 IDE but cant upgrade the SDK at the moment.
    It will potentialy also be an environment with mixed IDEs using both FB3 and FB4.
    So I am wondering if there are any known issues with the set up FB4 + sdk3.5 in general.

  • Updating player version used in FlashBuilder

    hallo people,
    i'm trying to use OSMF in FlashBuilder 4 but i encounter this error ...
    I configured Flex SDK for my project to include Flex 4.1(C:\flex_sdk_4.1) but when i try to launch my project i get this error box:
    C:\flex_sdk_4\runtimes\player\10\win\FlashPlayer.exe
    This project requires a more recent version of the Adobe Flash Player. You might need to install the Flash Player or reinstall Flash Builder.
        Installed Adobe Flash Player version: 10,0,45,2
        Required version: 10,1,0,0
    Do you still want to launch the application?
    why FlashBuilder is still looking at C:\flex_sdk_4......?
    anyone can help me?
    thanks a lot
    gpleone

    You could use field-symbols.
    like
    DATA: l_text(18) VALUE '(SOURCE_PROGRAM_NAME)table_name[]'.
    field-symbols <fs> type table.
    Assign (ltext) to <fs>.
    if sy-subrc eq 0.
    "Do what you want with <fs>
    endif.

  • Problem in using JScrollPane

    hiii i am creating an image editor in java...
    here is my code for using scrollpane
      contentpane = getContentPane();
                view  =  new JLabel(new ImageIcon(bufferedImage));
                scrollpane =  new JScrollPane(view,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
                scrollpane.setPreferredSize(new Dimension(800,600));
                contentpane.add(scrollpane);The problem is that the content of viewport does not change...i.e if i apply any effect to an image....after that as soon as i use the scrollbar, the viewport displays the original image!!!
    What is the problem??
    could someone suggest a solution?

    Can you plzz help me with this??...it is very urgent...
    As i am creating an image editor, so the scrollpane must be updated as soon as i apply any effect to it .....
    along with that whenever a user selects a file from FileDialog...then also it must be updated!!!
    I have extended JFrame for my main class.
    //this is the code i have written when user selects a new file...
    contentpane = getContentPane();
    view =  new JLabel(new ImageIcon(bufferedImage));
    view.setVisible(true);
    crollpane =  new                   JScrollPane(view,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
                scrollpane.setPreferredSize(new Dimension(200,200));
                contentpane.add(scrollpane);
    // This is the code for scollpane update
        iicon.setImage(bufferedImage);
          view.setIcon(iicon);
          scrollpane =  new                     JScrollPane(view,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
                scrollpane.setPreferredSize(new Dimension(200,200));
                contentpane.add(scrollpane);
               scrollpane.updateUI();Message was edited by:
    rav_ahj

  • ScrollPane zoom in/out

    Hello, this is my first post.
    I'd like to add zoom in/out function to my ScrollPane, and make shortcut (CTRL+MOUSE SCROLL UP/DOWN) for it. ( like Inkscape )
    I made the following code ( Canvas ) to achieve this, but have some problems.
    *1. How can I prevent ScrollBar's thumb to move when pressing CTRL?*
    When ScrollBar is visible and ScrollBar's thumb (or scroller, knob) has room to move, CTRL+MOUSE SCROLL UP/DOWN doesn't work because the thumb moves instead of zooming in/out.
    When the thumb moves up/down to bar's end, then zoom in/out finally works fine.
    *2. ScrollEvent handler is sometimes not called in ScrollPane*
    When ScrollBarPolicy is not ScrollBarPolicy.ALWAYS and Scrollbar is not visible, SOMETIMES CTRL+SCROLL UP/DOWN operation dosen't work.
    (ScrollEvent handler is not called. For other panes, ScrollEvent works fine. Please check MouseScrollEventTest below)
    Thank you in advance.
    Canvas
    public class Canvas extends Application {
         DoubleProperty zoom = new SimpleDoubleProperty(1.0);
         final double MAX_ZOOM = 3.0;
         final double MIN_ZOOM = 0.1;
         @Override
         public void start(Stage stage) throws Exception {
              Rectangle rectangle = RectangleBuilder.create()
                   .width(1000).height(1000)
                   .fill( LinearGradientBuilder.create()
                        .stops(new Stop(0, Color.BLUE), new Stop(1, Color.RED))
                        .build()
                   ).build();
              ScrollPane scrollPane = ScrollPaneBuilder.create()
                   .content(
                        GroupBuilder.create()
                             .children(rectangle)
                             .build())
    //               .hbarPolicy(ScrollBarPolicy.ALWAYS)
    //               .vbarPolicy(ScrollBarPolicy.ALWAYS)
                   .build();
              rectangle.scaleXProperty().bind(zoom);
              rectangle.scaleYProperty().bind(zoom);
              scrollPane.setOnScroll(new EventHandler<ScrollEvent>(){
                   public void handle(ScrollEvent event) {
                        if( !event.isControlDown() ) return ;
                        double zoomValue;
                        if ( event.getDeltaY() > 0 ) {
                             zoomValue = zoom.get() + 0.1;
                        } else {
                             zoomValue = zoom.get() - 0.1;
                        if( zoomValue > MAX_ZOOM || zoomValue < MIN_ZOOM ) return ;
                        zoom.set(zoomValue);
              Scene scene = SceneBuilder.create()
                        .width(500).height(500)
                        .root(scrollPane)
                        .build();
              stage.setScene(scene);
              stage.show();
         public static void main(String[] args) {
              launch(args);
    Mouse Scroll Event Test
    public class MouseScrollEventTest extends Application {
         BorderPane bPane;
         ScrollPane sPane;
         public void start(Stage stage) throws Exception {
              EventHandler<ScrollEvent> handler = new EventHandler<ScrollEvent>() {
                   public void handle(ScrollEvent event) {
                        System.out.println(event);
              bPane = new BorderPane();
              bPane.setPrefSize(100, 100);
              sPane = new ScrollPane();
              sPane.setPrefSize(100, 100);
    //          sPane.setContent( new Rectangle(50,50) );
    //             This works fine.
              bPane.setOnScroll(handler);
    //             Sometimes, this is not called.
              sPane.setOnScroll(handler);
              HBox root = new HBox();
              root.getChildren().addAll(bPane, sPane);
              Scene scene = new Scene(root);
    //          scene.setOnScroll(handler);
              stage.setScene(scene);
              stage.show();
         public static void main(String[] args) {
              launch(args);
    }--- My Environment
    Windows Vista
    JavaFX 2.0 SDK
    Edited by: 932474 on 2012/05/07 4:31
    Edited by: 932474 on 2012/05/07 4:47

    Thank you for the good example.
    But actually, I just give up using ScrollPane and created a ZoomCanvas which can zoom in/out and pan.
    The code is here.
    Any comments or improvement would be appreciated.
    ZoomCanvas
    public class ZoomCanvas extends StackPane {
         private ZoomController zoomController;
         private Group contentWrapper;
         private double translateXWhenMousePressed, translateYWhenMousePressed;
         private double xWhenMousePressed , yWhenMousePressed;
         private static class ZoomController {
              private int deltaCount = 0;
              private final double DEFAULT_ZOOM = 1.0;
              private boolean useAnimation = true;
              private DoubleProperty zoomMax   = new SimpleDoubleProperty(10.0);
              private DoubleProperty zoomMin   = new SimpleDoubleProperty(0.1);
              private DoubleProperty zoomDelta = new SimpleDoubleProperty(1.2);
              private DoubleProperty zoom      = new SimpleDoubleProperty( DEFAULT_ZOOM );
              public ZoomController() {
              public void zoomIn() {
                   double zoomValue = DEFAULT_ZOOM * Math.pow(zoomDelta.get(), deltaCount+1);
                   if( zoomValue > zoomMax.get() ) {
                        setZoom(zoomMax.get());
                        return;
                   deltaCount++;
                   setZoom( zoomValue );
              public void zoomOut() {
                   double zoomValue = DEFAULT_ZOOM * Math.pow(zoomDelta.get(), deltaCount-1);
                   if( zoomValue < zoomMin.get() ) {
                        setZoom(zoomMin.get());
                        return;
                   deltaCount--;
                   setZoom( zoomValue );
              public void setZoom( double zoomValue ) {
                   if( useAnimation ) {
                        Timeline zoomTimeline = new Timeline();
                        zoomTimeline.getKeyFrames().add(
                             new KeyFrame(Duration.millis(300), new KeyValue(zoom, zoomValue))
                        zoomTimeline.play();
                   } else {
                        zoom.set(zoomValue);
         public ZoomCanvas(Node content) {
              super();
              Rectangle clip = new Rectangle();
              clip.widthProperty().bind(widthProperty());
              clip.heightProperty().bind(heightProperty());
              // to adjust layoutBounds when drawingPane's scale changes
              contentWrapper = new Group(content);          
              StackPane.setAlignment(contentWrapper, Pos.CENTER);
              getChildren().add(contentWrapper);
              zoomController = new ZoomController();
              content.scaleXProperty().bind(zoomController.zoom);
              content.scaleYProperty().bind(zoomController.zoom);
              content.translateXProperty();
              hookEvents();
              setClip(clip);
         private void hookEvents() {
              setOnScroll(new EventHandler<ScrollEvent>() {
                   public void handle(ScrollEvent event) {
                        if( event.getDeltaY() > 0 ) {
                             zoomController.zoomIn();
                        } else {
                             zoomController.zoomOut();
              setOnMousePressed(new EventHandler<MouseEvent>(){
                   public void handle(MouseEvent event) {
                        if( !event.isMiddleButtonDown() ) return ;
                        translateXWhenMousePressed = contentWrapper.getTranslateX();
                        translateYWhenMousePressed = contentWrapper.getTranslateY();
                        xWhenMousePressed = event.getX();
                        yWhenMousePressed = event.getY();
                        setCursor(Cursor.MOVE);
                        event.consume();
              setOnMouseReleased(new EventHandler<MouseEvent>(){
                   public void handle(MouseEvent event) {
                        setCursor(Cursor.DEFAULT);
              setOnMouseDragged(new EventHandler<MouseEvent>(){
                   public void handle(MouseEvent event) {
                        if(!event.isMiddleButtonDown())
                             return;
                        contentWrapper.setTranslateX( translateXWhenMousePressed +  event.getX() - xWhenMousePressed );
                        contentWrapper.setTranslateY( translateYWhenMousePressed +  event.getY() - yWhenMousePressed );
                        event.consume();
    ZoomCanvasTest
    public class ZoomCanvasTest extends Application {
         public void start(Stage primaryStage) throws Exception {
              Rectangle rect = new Rectangle(0,0,100,100);
              rect.setStyle("-fx-fill: blue;");
              Circle circle = new Circle(100,100,50);
              circle.setStyle("-fx-fill: red;");
              Pane canvasContent = new Pane();
              canvasContent.setStyle(
                        "-fx-background-color: papayawhip;" +
                        "-fx-border-color: black;");
              canvasContent.getChildren().add(circle);
              canvasContent.getChildren().add(rect);
              ZoomCanvas canvas = new ZoomCanvas(canvasContent);
              canvas.setStyle(
                   "-fx-background-color: mistyrose;" +
                   "-fx-border-color: black;"
              ToolBar toolBar = new ToolBar();
              toolBar.setOrientation(Orientation.VERTICAL);
              toolBar.getItems().add( new Button("sample") );
              BorderPane root = new BorderPane();
              root.setCenter(canvas);
              root.setRight(toolBar);
    //          root.getChildren().addAll(canvas, toolBar);
              Scene scene = new Scene(root);
              primaryStage.setScene(scene);
              primaryStage.show();
         public static void main(String[] args) {
              launch(args);
    }Edited by: 932474 on 2012/05/08 10:17
    Edited by: 932474 on 2012/05/08 10:40
    Edited by: 932474 on 2012/05/08 10:56

  • Resizing ScrollPane and Dimension dynamically

    I am currently making a scrollbar program using ScrollPane and Dimension. I have to use those classes.
    When I click "ok" button, that calls dc.enlarge(500,800) method. But it doesn't work.
    When it is clicked, Dimension object should be changed and the panel has to show Horizotal
    and Vertical scrollbar according to the width and height parameters.
    Of course, the size will be calculated by the String contents object's rows and width. But it does not work.
    How to resize the Dimension and How to display the Horizontal, Vertical scrollbar accoring to dc.enlarge's parameters?
    Plz... help me...
    -------------- ScrollerTest.java -----------------------------------------------
    import java.awt.*;
    import java.applet.Applet;
    public class ScrollerTest extends Applet {
       public Scroller sc = null;
        public void init() {
            sc = new Scroller(700,250);
            sc.setVisible(true);
         add(sc);         
    }-------------- Scroller.java -----------------------------------------------
    import java.awt.*;
    import java.awt.Window;
    import java.applet.Applet;
    import java.awt.event.*;
    public class Scroller extends Panel implements  ActionListener {
        private Button btOk;   
        private int width = 0;
        private int height = 0;   
        private DrawCanvas dc;   
        public Scroller(int width, int height){   
            this.width = width;
            this.height = height;   
            dc = new DrawCanvas(width, height);
            setNewsContents();                           
        private void setNewsContents() {
            setLayout(new BorderLayout());
            ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);       
            scroller.add(dc);
            Adjustable vadjust = scroller.getVAdjustable();
            Adjustable hadjust = scroller.getHAdjustable();
            hadjust.setUnitIncrement(10);
            vadjust.setUnitIncrement(10);
            scroller.setSize(615     , 272);
            btOk = new Button("ok");
            btOk.addActionListener(this);
            add("Center", scroller);
            add("South", btOk);       
        public void actionPerformed(ActionEvent event) {
            if(event.getSource()==btOk) {
                dc.enlarge(500,800);
                dc.validate();
    }    -------------- DrawCanvas.java -----------------------------------------------
    import java.awt.*;
    class DrawCanvas extends Component {
        private int width = 0;
        private int height = 0;
        private Dimension d;
        public DrawCanvas(int width, int height) {
            this.width = width;
            this.height = height;
       Dimension theSize = new Dimension(300, 200);   
       public Dimension getPreferredSize() {
            return new Dimension(width,height);               
       public void enlarge(int width, int height) {       
            theSize.width =  width;
            theSize.height = height;
            setSize(theSize);       
        public void update(Graphics g) {
            paint(g);
        public void paint(Graphics g) {       
            Rectangle r = getBounds();       
            String contents[] = {
            "addition to its usual stable of Clydesdale horses, the company will also enlist help this year ",
            "from racing star Dale Earnhardt Jr., some beer-thieving crabs and a scary hitchhiker.",       
            "The Super Bowl represents an enormous commitment for Budweiser. Bob Lachky, chief creative" ,
            "officer of Anheuser-Busch, said the St. Louis-based brewer has been advertising on the game since 1976 and has been the exclusive alcoholic beverage sponsor since 1989",
            "since 1976 and has been the exclusive alcoholic beverage sponsor since 1989, an arrangement that runs through 2012.",
            "It's important to us because it kicks off our selling season, it's the best platform",
            "possible to launch new ideas or to sustain existing campaigns, and it's absolutely the most efficient way to reach the most  it's absolutely the most efficient way to reach the most",
            "adult consumers in one sitting,",
            "Despite the rise of cable, the Internet other media to compete with broadcast television iewers and enticing a huge array of marketers ",
            ", the Super Bowl remains the most-viewed media event all year, drawing in some 90 million ",
            "viewers and enticing a huge array of marketers to pony up the big bucks for an ad",
            ", the price of which is running as high as $2.6 million for this year's broadcast",
            "on CBS Corp.'s CBS network, up slightly from about a top price of about $2.5 million last year.",
            "Comedian Carlos Mencia, of the Comedy Central show  gets ",
            "a big break with a spot set in a classroom. Lachky predicts that Mencia will get an enormous boost Lachky predicts that Mencia will get an enormous boost ",
            "following the appearance, which similarly did wonders for Cedric the Entertainer.",
            "And what would Budweiser Super Bowl ads be without some animated critters? This year, a ga",
            "ng of mischievous red crabs turn up on a beach to carry off a cooler full of beers. As in past years, Bud is keeping many ",
            g.setColor(new Color(226,250,255));
            g.fillRect(0, 0, r.width, r.height);
            g.setColor(new Color(233,231,224));            
            int line = 35;
            int line_1 = 39;
            for (int i = 0; i < contents.length; i++) {       
                 g.setColor(Color.BLACK);
                 g.drawString(contents, 5,line);
         g.setColor(new Color(233,231,224));
         g.drawLine(0,line_1,605,line_1);
         line += 20;
         line_1 += 20;

    I am currently making a scrollbar program using ScrollPane and Dimension. I have to use those classes.
    When I click "ok" button, that calls dc.enlarge(500,800) method. But it doesn't work.
    When it is clicked, Dimension object should be changed and the panel has to show Horizotal
    and Vertical scrollbar according to the width and height parameters.
    Of course, the size will be calculated by the String contents object's rows and width. But it does not work.
    How to resize the Dimension and How to display the Horizontal, Vertical scrollbar accoring to dc.enlarge's parameters?
    Plz... help me...
    -------------- ScrollerTest.java -----------------------------------------------
    import java.awt.*;
    import java.applet.Applet;
    public class ScrollerTest extends Applet {
       public Scroller sc = null;
        public void init() {
            sc = new Scroller(700,250);
            sc.setVisible(true);
         add(sc);         
    }-------------- Scroller.java -----------------------------------------------
    import java.awt.*;
    import java.awt.Window;
    import java.applet.Applet;
    import java.awt.event.*;
    public class Scroller extends Panel implements  ActionListener {
        private Button btOk;   
        private int width = 0;
        private int height = 0;   
        private DrawCanvas dc;   
        public Scroller(int width, int height){   
            this.width = width;
            this.height = height;   
            dc = new DrawCanvas(width, height);
            setNewsContents();                           
        private void setNewsContents() {
            setLayout(new BorderLayout());
            ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);       
            scroller.add(dc);
            Adjustable vadjust = scroller.getVAdjustable();
            Adjustable hadjust = scroller.getHAdjustable();
            hadjust.setUnitIncrement(10);
            vadjust.setUnitIncrement(10);
            scroller.setSize(615     , 272);
            btOk = new Button("ok");
            btOk.addActionListener(this);
            add("Center", scroller);
            add("South", btOk);       
        public void actionPerformed(ActionEvent event) {
            if(event.getSource()==btOk) {
                dc.enlarge(500,800);
                dc.validate();
    }    -------------- DrawCanvas.java -----------------------------------------------
    import java.awt.*;
    class DrawCanvas extends Component {
        private int width = 0;
        private int height = 0;
        private Dimension d;
        public DrawCanvas(int width, int height) {
            this.width = width;
            this.height = height;
       Dimension theSize = new Dimension(300, 200);   
       public Dimension getPreferredSize() {
            return new Dimension(width,height);               
       public void enlarge(int width, int height) {       
            theSize.width =  width;
            theSize.height = height;
            setSize(theSize);       
        public void update(Graphics g) {
            paint(g);
        public void paint(Graphics g) {       
            Rectangle r = getBounds();       
            String contents[] = {
            "addition to its usual stable of Clydesdale horses, the company will also enlist help this year ",
            "from racing star Dale Earnhardt Jr., some beer-thieving crabs and a scary hitchhiker.",       
            "The Super Bowl represents an enormous commitment for Budweiser. Bob Lachky, chief creative" ,
            "officer of Anheuser-Busch, said the St. Louis-based brewer has been advertising on the game since 1976 and has been the exclusive alcoholic beverage sponsor since 1989",
            "since 1976 and has been the exclusive alcoholic beverage sponsor since 1989, an arrangement that runs through 2012.",
            "It's important to us because it kicks off our selling season, it's the best platform",
            "possible to launch new ideas or to sustain existing campaigns, and it's absolutely the most efficient way to reach the most  it's absolutely the most efficient way to reach the most",
            "adult consumers in one sitting,",
            "Despite the rise of cable, the Internet other media to compete with broadcast television iewers and enticing a huge array of marketers ",
            ", the Super Bowl remains the most-viewed media event all year, drawing in some 90 million ",
            "viewers and enticing a huge array of marketers to pony up the big bucks for an ad",
            ", the price of which is running as high as $2.6 million for this year's broadcast",
            "on CBS Corp.'s CBS network, up slightly from about a top price of about $2.5 million last year.",
            "Comedian Carlos Mencia, of the Comedy Central show  gets ",
            "a big break with a spot set in a classroom. Lachky predicts that Mencia will get an enormous boost Lachky predicts that Mencia will get an enormous boost ",
            "following the appearance, which similarly did wonders for Cedric the Entertainer.",
            "And what would Budweiser Super Bowl ads be without some animated critters? This year, a ga",
            "ng of mischievous red crabs turn up on a beach to carry off a cooler full of beers. As in past years, Bud is keeping many ",
            g.setColor(new Color(226,250,255));
            g.fillRect(0, 0, r.width, r.height);
            g.setColor(new Color(233,231,224));            
            int line = 35;
            int line_1 = 39;
            for (int i = 0; i < contents.length; i++) {       
                 g.setColor(Color.BLACK);
                 g.drawString(contents, 5,line);
         g.setColor(new Color(233,231,224));
         g.drawLine(0,line_1,605,line_1);
         line += 20;
         line_1 += 20;

  • Resizing ScrollPane and Dimension

    I am currently making a scrollbar program using ScrollPane and Dimension. I have to use those classes.
    When I click "ok" button, that calls dc.enlarge(500,800) method. But it doesn't work.
    When it is clicked, Dimension object should be changed and the panel has to show Horizotal
    and Vertical scrollbar according to the width and height parameters.
    Of course, the size will be calculated by the String contents object's rows and width. But it does not work.
    How to resize the Dimension and How to display the Horizontal, Vertical scrollbar accoring to dc.enlarge's parameters?
    Plz... help me...
    -------------- ScrollerTest.java -----------------------------------------------
    import java.awt.*;
    import java.applet.Applet;
    public class ScrollerTest extends Applet {
       public Scroller sc = null;
        public void init() {
            sc = new Scroller(700,250);
            sc.setVisible(true);
         add(sc);         
    }-------------- Scroller.java -----------------------------------------------
    import java.awt.*;
    import java.awt.Window;
    import java.applet.Applet;
    import java.awt.event.*;
    public class Scroller extends Panel implements  ActionListener {
        private Button btOk;   
        private int width = 0;
        private int height = 0;   
        private DrawCanvas dc;   
        public Scroller(int width, int height){   
            this.width = width;
            this.height = height;   
            dc = new DrawCanvas(width, height);
            setNewsContents();                           
        private void setNewsContents() {
            setLayout(new BorderLayout());
            ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);       
            scroller.add(dc);
            Adjustable vadjust = scroller.getVAdjustable();
            Adjustable hadjust = scroller.getHAdjustable();
            hadjust.setUnitIncrement(10);
            vadjust.setUnitIncrement(10);
            scroller.setSize(615     , 272);
            btOk = new Button("ok");
            btOk.addActionListener(this);
            add("Center", scroller);
            add("South", btOk);       
        public void actionPerformed(ActionEvent event) {
            if(event.getSource()==btOk) {
                dc.enlarge(500,800);
                dc.validate();
    }    -------------- DrawCanvas.java -----------------------------------------------
    import java.awt.*;
    class DrawCanvas extends Component {
        private int width = 0;
        private int height = 0;
        private Dimension d;
        public DrawCanvas(int width, int height) {
            this.width = width;
            this.height = height;
       Dimension theSize = new Dimension(300, 200);   
       public Dimension getPreferredSize() {
            return new Dimension(width,height);               
       public void enlarge(int width, int height) {       
            theSize.width =  width;
            theSize.height = height;
            setSize(theSize);       
        public void update(Graphics g) {
            paint(g);
        public void paint(Graphics g) {       
            Rectangle r = getBounds();       
            String contents[] = {
            "addition to its usual stable of Clydesdale horses, the company will also enlist help this year ",
            "from racing star Dale Earnhardt Jr., some beer-thieving crabs and a scary hitchhiker.",       
            "The Super Bowl represents an enormous commitment for Budweiser. Bob Lachky, chief creative" ,
            "officer of Anheuser-Busch, said the St. Louis-based brewer has been advertising on the game since 1976 and has been the exclusive alcoholic beverage sponsor since 1989",
            "since 1976 and has been the exclusive alcoholic beverage sponsor since 1989, an arrangement that runs through 2012.",
            "It's important to us because it kicks off our selling season, it's the best platform",
            "possible to launch new ideas or to sustain existing campaigns, and it's absolutely the most efficient way to reach the most  it's absolutely the most efficient way to reach the most",
            "adult consumers in one sitting,",
            "Despite the rise of cable, the Internet other media to compete with broadcast television iewers and enticing a huge array of marketers ",
            ", the Super Bowl remains the most-viewed media event all year, drawing in some 90 million ",
            "viewers and enticing a huge array of marketers to pony up the big bucks for an ad",
            ", the price of which is running as high as $2.6 million for this year's broadcast",
            "on CBS Corp.'s CBS network, up slightly from about a top price of about $2.5 million last year.",
            "Comedian Carlos Mencia, of the Comedy Central show  gets ",
            "a big break with a spot set in a classroom. Lachky predicts that Mencia will get an enormous boost Lachky predicts that Mencia will get an enormous boost ",
            "following the appearance, which similarly did wonders for Cedric the Entertainer.",
            "And what would Budweiser Super Bowl ads be without some animated critters? This year, a ga",
            "ng of mischievous red crabs turn up on a beach to carry off a cooler full of beers. As in past years, Bud is keeping many ",
            g.setColor(new Color(226,250,255));
            g.fillRect(0, 0, r.width, r.height);
            g.setColor(new Color(233,231,224));            
            int line = 35;
            int line_1 = 39;
            for (int i = 0; i < contents.length; i++) {       
                 g.setColor(Color.BLACK);
                 g.drawString(contents, 5,line);
         g.setColor(new Color(233,231,224));
         g.drawLine(0,line_1,605,line_1);
         line += 20;
         line_1 += 20;

    The class names have been changed so you can run this as-is without name-clashing.
    //  <applet code="ST" width="720" height="300"></applet>
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    public class ST extends Applet {
        public ScrollerRx sc;
        public void init() {
            sc = new ScrollerRx(700,250);
            add(sc);
    class ScrollerRx extends Panel implements ActionListener {
        private Button btOk;
        private DrawCanvasRx dc;
        public ScrollerRx(int width, int height) {
            dc = new DrawCanvasRx(width, height);
            setNewsContents();
        private void setNewsContents() {
            setLayout(new BorderLayout());
            ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
            scroller.add(dc);
            Adjustable vadjust = scroller.getVAdjustable();
            Adjustable hadjust = scroller.getHAdjustable();
            hadjust.setUnitIncrement(10);
            vadjust.setUnitIncrement(10);
            scroller.setSize(615, 272);
            btOk = new Button("ok");
            btOk.addActionListener(this);
            add("Center", scroller);
            add("South", btOk);
        public void actionPerformed(ActionEvent event) {
            if(event.getSource()==btOk) {
                dc.enlarge(500,800);
                // validate is a Container method.
                validate();
    class DrawCanvasRx extends Component {
        Dimension theSize = new Dimension(300, 200);
        String[] contents = {
            "addition to its usual stable of Clydesdale horses, the company will " +
            "also enlist help this year ",
            "from racing star Dale Earnhardt Jr., some beer-thieving crabs and a " +
            "scary hitchhiker.",       
            "The Super Bowl represents an enormous commitment for Budweiser. Bob " +
            "Lachky, chief creative" ,
            "officer of Anheuser-Busch, said the St. Louis-based brewer has been " +
            "advertising on the game since 1976 and has been the exclusive alcoholic " +
            "beverage sponsor since 1989",
            "since 1976 and has been the exclusive alcoholic beverage sponsor since " +
            "1989, an arrangement that runs through 2012.",
            "It's important to us because it kicks off our selling season, it's the " +
            "best platform",
            "possible to launch new ideas or to sustain existing campaigns, and it's " +
            "absolutely the most efficient way to reach the most  it's absolutely " +
            "the most efficient way to reach the most",
            "adult consumers in one sitting,",
            "Despite the rise of cable, the Internet other media to compete with " +
            "broadcast television iewers and enticing a huge array of marketers ",
            ", the Super Bowl remains the most-viewed media event all year, drawing " +
            "in some 90 million ",
            "viewers and enticing a huge array of marketers to pony up the big bucks " +
            "for an ad",
            ", the price of which is running as high as $2.6 million for this year's " +
            "broadcast",
            "on CBS Corp.'s CBS network, up slightly from about a top price of about " +
            "$2.5 million last year.",
            "Comedian Carlos Mencia, of the Comedy Central show  gets ",
            "a big break with a spot set in a classroom. Lachky predicts that Mencia " +
            "will get an enormous boost Lachky predicts that Mencia will get an " +
            "enormous boost ",
            "following the appearance, which similarly did wonders for Cedric the " +
            "Entertainer.",
            "And what would Budweiser Super Bowl ads be without some animated " +
            "critters? This year, a ga",
            "ng of mischievous red crabs turn up on a beach to carry off a cooler " +
            "full of beers. As in past years, Bud is keeping many ",
        public DrawCanvasRx(int width, int height) {
            theSize.setSize(width, height);
        public Dimension getPreferredSize() {
            System.out.printf("theSize = [%d, %d]%n", theSize.width, theSize.height);
            return theSize;
        public void enlarge(int width, int height) {
            theSize.width  = width;
            theSize.height = height;
            // Mark this component as needing a new layout.
            invalidate();
        public void update(Graphics g) {
            paint(g);
        public void paint(Graphics g) {
            Rectangle r = getBounds();
            g.setColor(new Color(226,250,255));
            g.fillRect(0, 0, r.width, r.height);
            g.setColor(new Color(233,231,224));
            int line = 35;
            int line_1 = 39;
            for (int i = 0; i < contents.length; i++) {
                g.setColor(Color.BLACK);
                 g.drawString(contents, 5, line);
         g.setColor(new Color(233,231,224));
         g.drawLine(0, line_1, 605, line_1);
         line += 20;
         line_1 += 20;

  • ScrollPane in Flash MX and flash Mx 2004 professional

    Summary:
    The refreshPane method works differently in Flash MX and
    Flash MX 2004 Professional
    What went wrong?:
    I have used scrollPane component in Flash mx and loaded some
    content. I changed the content size i.e. width and height
    at runtime and after that called the refreshPane() method to
    resize the scrollPane. It works fine with Flash MX
    But same I tried with Flash Mx 2004 Professional, but it
    doesn't work, since in Flash Mx the refreshPane() method resizes
    the content and in flash Mx 2004 Professional the
    refreshPane() metod reloads the content.
    What should have happened?:
    Can there be a method in flash Mx 2004 Professional which
    just resizes the scrollPane and not reloads the whole content?
    Since if I have to generate a content at runtime and resize
    it also at runtime then just by calling the method refreshPane() in
    flash Mx 2004 Professional, it loads the content what it was
    originally and not the changed one.
    Product version: flash Mx, Flash Mx 2004 Professional
    Product: Flash
    Component: scrollPane
    I would like to request you to help me in the same as early
    as possible.
    Thanks and regards,
    Shreeram Shiralkar

    "vookster" <[email protected]> wrote in
    message
    news:go7cec$obn$[email protected]..
    >
    > I was wondering are files produced from Flash MX
    compatible with
    > Dreamweaver
    > cs4? I have Flash MX and don't want to buy Flash cs4 if
    I don't need
    > to.
    Flash MX creates .swf files. Dreamweaver CS4 creates HTML
    files, and
    has the capability of inserting .swf files in a web page. It
    doesn't
    matter which version of Flash you use to create your .swf
    files; they
    can be inserted into a web page in any version of
    Dreamweaver.
    David Powers
    Adobe Community Expert, Dreamweaver
    http://foundationphp.com

  • Scrolling of images using scroll panes

    sir,
    i have a problem in laying the scroll bars in the frames using scrollpanes.
    i want to display the images having BIL format.
    so,plz help me

    I stand corrected, there's no mention of this on the user guide, odd. 
    http://blogs.sonymobile.com/press_release/xperia-z-1-compact-best-camera-in-compact-waterproof-smart...
    A clever design refinement is the new Glove Mode4 that lets you use your Xperia Z1 Compact even while wearing gloves, making it even easier to use your phone, no matter what the weather.
    4 Supports maximum 2mm thickness
    "I'd rather be hated for who I am, than loved for who I am not." Kurt Cobain (1967-1994)

  • Android Air App using AdMob "NULL Object" Error?!?

    Hi,
    I am currently developing an app using adobe air flashbuilder and I have incorporated AdMob type html adverts into it. The Adverts do come up nicely however if I run the app in debug mode I get this error:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at model::AdMob/createAd()[C:\Users\Jack\Documents\Dropbox\Projects\App\App Final\src\model\AdMob.as:37]
    The Ads do still work regardless of this however this is then affecting other elements within the app so I would like to get rid of the error that is happening. Below is my code in the "AdMob.as" file where I believe the issue to be occuring, can someone please help me with this?
    package model
        import flash.display.Stage;
        import flash.events.Event;
        import flash.events.LocationChangeEvent;
        import flash.events.MouseEvent;
        import flash.geom.Rectangle;
        import flash.media.StageWebView;
        import flash.net.URLRequest;
        import flash.net.navigateToURL;
        public class AdMob
            // setup variables
            private var _stageWebView:StageWebView;
            private var myAdvertURL:String = "http://www.test.co.uk/AdMob/test.html";
            //private var myAdvertURL:String;
            private var adWidth:Number=480;
            private var adHeight:Number=85;
            private var stage:Stage;
            public function AdMob(adURL:String,_stage:Stage)
                myAdvertURL=adURL;
                stage=_stage;
                createAd();
            public function createAd():void {
                // check that _stageWebView doersn't exist
                if (! _stageWebView) {
                    _stageWebView = new StageWebView () ;
                    // set the size of the html 'window'
                    _stageWebView.viewPort = new Rectangle(0,stage.stageHeight-adHeight, 800, adHeight);
                    //_stageWebView.viewPort = new Rectangle((stage.stageWidth-adWidth)/2,stage.stageHeight-adHeight,adWidth,adHeight);
                    // add a listener for when the content of the StageWebView changes
                    _stageWebView.addEventListener(LocationChangeEvent.LOCATION_CHANGE,onLocationChange);
                    //add a listener for when the ad is loaded
                    _stageWebView.addEventListener(Event.COMPLETE,onComplete);
                    // start loading the URL;
                    _stageWebView.loadURL(myAdvertURL);
                // show the ad by setting it's stage property;
                //showAd();
            public function destroyAd():void {
                // check that the instace of StageWebView exists
                if (_stageWebView) {
                    trace("removing advert");
                    // destroys the ad
                    _stageWebView.stage = null;
                    _stageWebView = null;
            public function toggleAd():void {
                trace("toggling advert",_stageWebView);
                // check that StageWebView instance exists
                if (_stageWebView) {
                    trace("_stageWebView.stage:"+_stageWebView.stage);
                    if (_stageWebView.stage == null) {
                        //show the ad by setting the stage parameter
                        _stageWebView.stage = stage;
                    } else {
                        // hide the ad by nulling the stage parameter
                        _stageWebView.stage = null;
                } else {
                    // ad StageWebView doesn't exist - show create it
                    createAd();
            public function onLocationChange(event:LocationChangeEvent):void {
                // check that it's not our ad URL loading
                if (_stageWebView.location != myAdvertURL) {
                    // destroy the ad as the user has kindly clicked on my ad
                    destroyAd();
                    // Launch a normal browser window with the captured  URL;
                    navigateToURL( new URLRequest( event.location ) );
            public function onComplete(event:Event):void{
                //add the ad when it is loaded. If not it will apear a white rectangle until the load is complete.
                showAd();
            public function updateAd(adURL:String=null):void{
                if (adURL!=null){
                    myAdvertURL = adURL;
                destroyAd();
                createAd();
            public function showAd():void{
                if (_stageWebView)
                    _stageWebView.stage = stage;
            public function hideAd():void{
                if (_stageWebView)
                    _stageWebView.stage = null;

    @zhenya1919 - since you're currently going through this, could you please open a new bug report on this over at https://bugbase.adobe.com?  When adding the bug, please include some sample code or a sample application so we can quickly test this out internally.  If you'd like to keep this private, feel free to email the attachment to me directly ([email protected]). 
    Once added, please post back with the URL so that others effected can add their comments and votes.
    Thanks,
    Chris

  • Flash mx -ScrollPane - scroll bar issue

    If we create some dynamic content and display it using
    scrollPane and if the width and height of the clip( the clip
    displayed in ScrollPane) changes dynamically by clicking on a
    button then refreshPane method does not work properly. We have to
    set original position of the clip to (0, 0) when scroll bar
    (vertical/ horizontal) disappears. I think this is not a good idea
    to work around with scrollPane.
    Let me know if there are any efficient methods with which we
    can handle dynamic data in scrollPane to display it properly.
    Thanks in advance,
    Shreeram

    Hi,
    Thanks for your co-operation. Please let me know if
    Macromedia Team fixes this bugs. Till then please let know about
    any methods or any solutions if you know.
    thanks
    Shreeram

  • How I use swf in swf (nested) ?

    Flash is case-sensitive in naming(symbols,form
    fields,components) ?
    How I use ScrollPane ?
    How I use swf in swf (nested) ?

    What I've done in the past is created an image using an image editor like MS Paint,  then change the image to black/white instead of color, and used grey instead of black.  Then upload the image via SE78.  Then you can include the image in your sapscript using the BITMAP statement.  Search for watermark in this forum and you should get some more info.
    BITMAP ZIMAGE OBJECT GRAPHICS ID BMAP TYPE BCOL
    Regards,
    Rich Heilman

Maybe you are looking for