Dynamic scrolling

does anyone know or could give an advise how to create
"dynamicly scrolled content" in flash?
here are the examples:
http://kashiwasato.com
http://www.mamastudio.pl
the flash content of the window is repositioning according to
the window resize
thanks a lot for any help :)

hi,
This code will set only 5 visible rows .
Bind the visiblerow count property of table with an attribute of type I.
Before binding the table with internal table write this code :
    DESCRIBE TABLE t_selected_hcp LINES lv_visiblerow.
****** Reduce the no of visible rows  *************
    IF lv_visiblerow > 5.
      lv_visiblerow = 5 .
    ENDIF.
* navigate from <CONTEXT> to <CN_TABLEPROP> via lead selection
    lo_nd_cn_tableprop = wd_context->get_child_node( name = wd_this->wdctx_cn_tableprop_pvl ).
get element via lead selection
    lo_el_cn_tableprop = lo_nd_cn_tableprop->get_element(  ).
    IF lv_visiblerow > 0 .
get single attribute
      lo_el_cn_tableprop->set_attribute(
          name =  `CA_VISIBLEROW_PVL`
          value = lv_visiblerow ).
    ELSEIF lv_visiblerow = 0 .
      lo_el_cn_tableprop->set_attribute(
         name =  `CA_VISIBLEROW_PVL`
         value = -1 ).
    ENDIF.
This will make sure that only 5 rows are visible and rest you have to scroll to see.
Now if you want that out of 6 rows added to the table , last 5 rows should be visible then :
Create a Context Attribute of type I "LEAD_SELECTION" and bind this to firstVisibleRow property of table .
Write this code:
Get the number of rows in table ****
    DESCRIBE TABLE it_selected_hcp1 LINES lv_count.
    DATA lo_el_context TYPE REF TO if_wd_context_element.
Set the lead selection to last row *****
    lo_el_context = wd_context->get_element(  ).
    lo_el_context->set_attribute( name =  `LEAD_SELECTION` value = lv_count ).
    lo_nd_cn_entertainment->set_lead_selection_index( lv_count ).
This will work.
Edited by: Saurav Mago on Oct 9, 2009 3:16 PM

Similar Messages

  • Dynamic Text Feild with Dynamic Scroll Bar

    I have a Dynamic Text Feild with a dynamic Scroll bar.
    It loads a simple ASCI text file with some html formating.
    but I still can not manage to get the text to format.
    The biggest problem with the format is a big space between
    paragraphs.
    I am not sure why but I think the Frame must need a var to
    render to html.
    Can anybody help please?

    My text had the following, similar but no parsing string.
    I guess
    yourstring.split("\n\r").join("\r").split("\r\n").join("\r");
    takes out the carrage returns or <br>?
    I notice the one I had just say's String.
    I assume that would be the text that is the string?
    Thank you for sharing your knowledge of this.
    var my_lv:LoadVars = new LoadVars();
    my_lv.onData = function(src:String) {
    if (src != undefined) {
    myTxtFeild.text = src;
    } else {
    myTxtFile.text = "Error loading text.";
    my_lv.load("CadnetPage1_html.txt");

  • Dynamic scrolling heading muse

    How would i create a dynamic scrolling heading similar to that off www.cnet.com where the header starts with a full sized logo but changes to a simple block format and stays locked at the top. I was considering using two different nag bars, the scrolling one under the main one but completely transparent and have them both set to scroll opacity so that the main one would disappear as you scroll and the smaller one would appear to replace it but I'm not too sure how to use that feature or even if it would work. I know it likely involves jQuery but I'm new to coding and web development so if anyone has an answer it would be greatly appreciated, thanks.
    Rodneytf

    Hi
    You can try using any composition or panel where you have to insert another object such as rectangles or menu items which would act on mouse click.
    For example :
    Insert composition/panel widget
    In target container insert another object such as rectangle with hyperlink to specific pages with styles applied.
    Thanks,
    Sanjit

  • Dynamic Scrolling of MovieClip

    Hi everyone,
    I have an application in which i am making a dynamic photo
    gallery. I have made a scroller movieClip "thumbs_mc". Now i want
    to make it scroll. for that i created 2 movieClips ,left and right.
    and wrote some code. but its not working.
    1st depth is the main picture's movieClip's depth, 2nd depth
    is thumbs_mc, 3rd is mask movieClip. 4th and 5th are for left and
    right. Also, I am creating movieClips within Thumbs_mc for holding
    thumbnails.
    and two buttons leftScroll and rightScroll.
    can anyone tell me, why is it not working?, how should i
    modify it..
    waiting for someone to throw some good light on this peice..
    Thanks

    here are my files, Please have a look at them..I want to make
    the thumbnail movieclip scrolling...
    [deleted]
    I want to make the thumbnail movieclip scrolling...
    Thanks alot

  • Dynamic scrolling slideshow

    Hi there I am creating a shop website
    I am using DWCS3 and PHPMYSQL
    I can already create all the product pages that can be
    dynamically populated from a form...... I can add, edit and delete
    products from my admin section of my site .... using a form ....
    all easy using a database to store all the picture and product
    details
    What I would like to be able to do is have the pictures that
    I upload to be automatically placed in a scrolling slideshow
    So that when you add a new product ...... when you click on
    the product detail page you see all the still pictures of the
    product ( which I can already do) .......but have an animated
    scrolling slideshow of the pictures as well
    Is there a program that can achieve this? Without knowing a
    lot of flash?
    Or is it possible and necessary to create the whole system
    using flash?
    Any help would be great
    Have a nice day

    Hi, check out this add-on for DW. :
    http://dmxzone.com/showDetail.asp?TypeId=3&NewsId=13984

  • Dynamic scroll bar not visible

    I created my text in a text file (saved as testtext.txt),
    then in Flash I added a dynamic text box (instance name: testtext)
    and dragged a scrollbar component (instance name: ttscroll) onto
    it. I then added this action script to the first frame:
    ttscroll._visible = (testtext.maxscroll >1);
    loadVariables("testtext.txt", this);
    The text shows up fine, and scrolls if I put my mouse in the
    text box and drag down. However, the scroll bar doesn't show up.
    How do I get this to work?
    Thanks.
    PS Due to company policies I'm not allowed to download and
    install anything, so I have to stick with what comes with Flash, so
    please don't recommend I download someone else's scrollbar.

    My first guess is that you are testing for maxScroll before
    the text is
    actually loaded, so the test result is false.
    You could use a listener for the loading function and let the
    listener's
    onLoadInit() event set the scrollbar.
    Another option is to use a textArea component. It has an
    automatic
    scrollbar.
    Rob
    Rob Dillon
    Adobe Community Expert
    http://www.ddg-designs.com
    412.243.9119

  • HTML Article put together dynamically, scroll only possible after orientation change

    Hi guys,
    i have encountered the following problem today:
    im having a HTML page put together dynamically from a JSON source file, handling the JSON information with jQuery. i am uploading said HTML page (html page is empty until the page is in the DPS stack, then it builds itself) as an HTML article with "Smooth Scrolling: Vertical". So far, so good.
    When i open the page inside the Adobe Viewer App on my iPad, i can see the "first" part of the page (the first 1024px in portrait-orientation) but i am not able to scroll further down the page.
    however, when i do a orientation change of the device (turn it landscape and then back), i can scroll perfectly fine and am able to see everything on the page (so im quite sure the conversion from json to jquery to html does work). even stranger, when i let the page tell me its height ( via $("body").height() and $(document).height() ) it shows me, that the height of the page is indeed (e.g.) 10.000px, but i am not able to scroll down until i do the orientation change.
    am i missing something? im pretty sure that my code is correct, because once i change the orientation of my device, everything does work flawless.
    i hope my problem is understandable, any help is much appreciated.
    thanks
    Max

    Nevermind... since the HTML is empty, when the magazin gets opened, i suspect the HTML tells DPS "hey, my height is 0px, dont bother scrolling!". but once i am on the page itself and the process of bulding the page starts (HTML elements are added on the fly), it doesnt tell DPS "hey, my height changed, check if i need to be scrollable please" since im not able to scroll. when im changing orientation, it forces DPS to rerender the page and thus getting the correct height of the page.
    my workaround: setting the body height to (e.g.) 20.000px and then, later on, reduce it to the actual height needed by the HTML elements.
    but still: can someone explain me the process of loading / rendering pages inside DPS? when do DPS render pages, does it render pages the first time i open the app and then again when im on the page itself (or rather a page before the actual page?) is there a command to force DPS to rerender the page?

  • Need dynamic scroller mc to work in main timeline

    I have a dynamic image scroller that scrolls right or left following where the mouse is.  When you hover over the images, a pop-up box also appears with information.
    This scroller works perfectly fine within the mc scene, but once i drag the mc into the main timeline the mc doesn't smoothly scroll right or left.  It's jumpy and the infobox doesn't work at all.
    How can I get it to work smoothly on the main timeline?

    the first problem i see is you're repeatedly executing that onMouseMove.  use:
    //roll over is equal to the function
    panel.onRollOver = panelOver;
    //when it enters the box, it makes the "scrollPanel" function work
    function panelOver() {
    this.onEnterFrame = scrollPanel;
    delete this.onRollOver;
    var b = stroke.getBounds (this);
    //makes the panel scroll with the mouse
    function scrollPanel () {
    if(_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {
    this.onRollOver = panelOver;
    delete this.onEnterFrame;
    if(panel._x <= -707.8) {
    panel._x = -707.8;
    if(panel._x >= 332.4) {
    panel._x = 332.4;
    var xdist = _xmouse - 275;
    panel._x += -xdist / 7;
    //tip box is set to invisible to not be seen
    infobox_mc._visible = false;
    var tipInt;
    //when rollover on button, tip box will say "blank"
    panel.pic1_btn.onRollOver = function () {
    mmF();
    tipInt = setInterval(showTip, 100, "Piece 1");
    panel.pic1_btn.onRollOut = function() {
    hideTip();
    panel.pic4_btn.onRollOver = function () {
    tipInt = setInterval(showTip, 100, "Piece 2");
    panel.pic4_btn.onRollOut = function() {
    hideTip();
    //counts the time that the mouse is over the button
    var count = 0;
    //clears the text in the textbox and makes the box follow the mouse, and if the count is at 3 then, it appears, otherwise, it adds "1"
    function showTip(tiptext) {
    if(count == 3) {
    clearInterval(tipInt);
    count = 0;
    infobox_mc.tiptext.text = tiptext;
    infobox_mc._x = _root._xmouse+this._x;
    infobox_mc._y = _root._ymouse+this._y;
    infobox_mc._visible = true;
    else {
    count++;
    function mmF(){
    this.onMouseMove = function() {
    infobox_mc._x = _root._xmouse+this._x;
    infobox_mc._y = _root._ymouse+this._y;
    //hides the box when rolled off the button
    function hideTip() {
    clearInterval(tipInt);
    infobox_mc._visible = false;
    delete this.onMouseMove;

  • Puting images into dynamic scrolling text

    So I have a dynamic text box and it is linked to the UI
    Scroll component. How do I put images in so that the image scrolls
    with the text?

    What i find works is to import the the text into a dynamic
    text field in flash. I use notepad to write the HTML (which is to
    be loaded externally) and use this HTML to bring in the images,
    this way they all scroll with the text in the dynamic text box. So
    you could use the <img src> tag in the external text (in
    notepad) then import the text into flash using LoadVars() into the
    frame where you want the text.
    I've used this countless time for sites and stuff although im
    having problems getting the text nest into a movie clip (im about
    to post for help on that one .....
    Not sure how clear all that is to you......

  • How do I create dynamic scrolling text in Flash CS5?

    Hi everyone,
    I am a complete newbie to Flash. I'm tyring to build a scrolling text box that automatically scrolls. On mouse over, I want the scrolling to stop so users can click on an item in the text box. All of the items will be tied to external hyperlinks. I want to populate the text box with an external file. I've done some searches on Adobe, but haven't found anything that takes me through the whole process.
    I have the complete Adobe Master Collection. So if this is easier in Flash Catalyst, let me know. I know how to buid a manual scroll box in Flash Catalyst. Could I export this to and add the auto-scrolling?
    Remember, I'm a complete newbie.
    Any help will be greatly appreciated.
    Thanks!

    Thanks again Kglad,
    I really have no preference of Action Script since I don't have any significant experience with either one.
    I'll keep doing searches to see if I can get the information I need.
    Have a great holiday.

  • How to dynamicly scroll a text area?

    Hi,
    i put my JTextArea on top of a JScrollPane.
    i want to set the JScrollPane scroll to the end of the JTextArea everytime i do textArea.append(someString);
    is there an easy way of doing this? or i have to program the logic?
    Thanks.

    This question has probably been asked a hundred times. The default behaviour is for the textare to scroll automatically if the following conditions are met:
    a) the caret is at the end of the document
    b) the append is done from the event thread
    If you want more adice then try searching the forum. Using keywords "jtextarea scrolling" would be a good place to start.

  • Making a line's coordinates adjust to a Dynamic/Scrolling Canvas

    Hi,
    I am trying to use Flex to develop a simple display... I have a canvas
    with couple of Buttons. I draw line between some of these buttons. As long as
    there is no scroll on the screen the line show up fine. But once width/Height 
    of the Canvas increases and you get the scroll... the lines don't scroll
    accordingly. The lines appear to be sticky on the Canvas rather than
    move with the buttons...
    Any idea how I can overcome this???

    Once i draw the line i add it as a child to the canvas. But when the size of the canvas changes, the line seems like it sticks to the canvas while the other components of the canvas adjust well.

  • Dynamic Scrolling List with jpg support!

    Anybody if you can help. I'm trying to create a list
    basically with more than one selectable field and the a jpg field
    all aligned together a la list field but I want to be able to add a
    field that uses a jpg as well and I want the fields to be
    selectable. I dont want to select on one item in the row and all of
    the rest in the row get selected.
    Similar to what I'm trying to do is the Tilelist and the list
    component combined.
    I'm getting an array from database query.....with
    info......for music
    player.....artist....song....index.....id....jpg.....etc
    And i want to put them into a List/Tilelist and have each one
    selectable.....lets say call a function/pass a variable to a
    function.....cant figure this out.....racking my nerves.....I dont
    want to hard code em all because array will be dynamic.....i know
    when using the TileList and the List....you can get other
    info....by using like list.index or list.label...list.row....
    ......ahhhhhh.........help.....coding world i'm losing it :D

    Don't loose it. Just implement your own custom scrollable
    list! I'll take you a few hours, but you'll understand
    everything.

  • Swing bug?: scrolling BLIT_SCROLL_MODE painting JTextArea components hangs

    java version "1.5.0_04"
    Hello,
    When drawing JComponent Text Areas and dynamically scrolling, Java gets confused, gets the shivers and freezes when the viewport cannot get its arms around the canvas. ;)
    Possible problem at JViewport.scrollRectToVisible().
    When painting non-text area components eg. graphics circles, it is ok.
    Have provided example code. This code is based on the ScrollDemo2 example provided in the Sun Java
    Tutorial
    thanks,
    Anil Philip
    juwo LLC
    Usage: run program and repeatedly click the left mouse button near right boundary to create a new JComponent node each time and to force scrolling area to increase in size to the right.
    When the first node crosses the left boundary, then the scroll pane gets confused, gets the shivers and hangs.
    The other scroll modes are a bit better - but very slow leaving the toolbar (in the oroginal application) unpainted sometimes.
    * to show possible bug when in the default BLIT_SCROLL_MODE and with JTextArea components.
    * author: Anil Philip. juwo LLC. http://juwo.com
    * Usage: run program and repeatedly click the left mouse button near right boundary to
    * create a new JComponent node each time and to force scrolling area to increase in size to the right.
    * When the first node crosses the left boundary, then the scroll pane gets confused, gets the shivers
    and hangs.
    * The other scroll modes are a bit better - but very slow leaving the toolbar (in the oroginal
    application)
    * unpainted sometimes.
    * This code is based on the ScrollDemo2 example provided in the Sun Java Tutorial (written by John
    Vella, a tutorial reader).
    import javax.swing.*;
    import javax.swing.border.EtchedBorder;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    /* ScrollDemo2WithBug.java is a 1.5 application that requires no other files. */
    public class ScrollDemo2WithBug extends JPanel {
    private Dimension area; //indicates area taken up by graphics
    private Vector circles; //coordinates used to draw graphics
    private Vector components;
    private JPanel drawingPane;
    public ScrollDemo2WithBug() {
    super(new BorderLayout());
    area = new Dimension(0, 0);
    circles = new Vector();
    components = new Vector();
    //Set up the instructions.
    JLabel instructionsLeft = new JLabel(
    "Click left mouse button to place a circle.");
    JLabel instructionsRight = new JLabel(
    "Click right mouse button to clear drawing area.");
    JPanel instructionPanel = new JPanel(new GridLayout(0, 1));
    instructionPanel.add(instructionsLeft);
    instructionPanel.add(instructionsRight);
    //Set up the drawing area.
    drawingPane = new DrawingPane();
    drawingPane.setBackground(Color.white);
    drawingPane.setPreferredSize(new Dimension(200, 200));
    //Put the drawing area in a scroll pane.
    JScrollPane scroller = new JScrollPane(drawingPane);
    // scroller.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
    if(scroller.getViewport().getScrollMode() == JViewport.BACKINGSTORE_SCROLL_MODE)
    System.out.println("BACKINGSTORE_SCROLL_MODE");
    if(scroller.getViewport().getScrollMode() == JViewport.BLIT_SCROLL_MODE)
    System.out.println("BLIT_SCROLL_MODE");
    if(scroller.getViewport().getScrollMode() == JViewport.SIMPLE_SCROLL_MODE)
    System.out.println("SIMPLE_SCROLL_MODE");
    //Lay out this demo.
    add(instructionPanel, BorderLayout.PAGE_START);
    add(scroller, BorderLayout.CENTER);
    /** The component inside the scroll pane. */
    public class DrawingPane extends JPanel implements MouseListener {
    private class VisualNode {
    int x = 0;
    int y = 0;
    int id = 0;
    public VisualNode(int id, int x, int y) {
    this.id = id;
    this.x = x;
    this.y = y;
    title.setLineWrap(true);
    title.setAlignmentY(Component.TOP_ALIGNMENT);
    titlePanel.add(new JButton("Hi!"));
    titlePanel.add(title);
    nodePanel.add(titlePanel);
    nodePanel.setBorder(BorderFactory
    .createEtchedBorder(EtchedBorder.RAISED));
    box.add(nodePanel);
    ScrollDemo2WithBug.this.drawingPane.add(box);
    Box box = Box.createVerticalBox();
    Box titlePanel = Box.createHorizontalBox();
    JTextArea title = new JTextArea(1, 10); // 1 rows x 10 cols
    Box nodePanel = Box.createVerticalBox();
    public void paintNode(Graphics g) {
    int ix = (int) x + ScrollDemo2WithBug.this.getInsets().left;
    int iy = (int) y + ScrollDemo2WithBug.this.getInsets().top;
    title.setText(id + " (" + ix + "," + iy + ") ");
    box.setBounds(ix, iy, box.getPreferredSize().width, box
    .getPreferredSize().height);
    int n = 0;
    DrawingPane() {
    this.setLayout(null);
    addMouseListener(this);
    protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.fill3DRect(10, 10, 25, 25, true);
    Point point;
    for (int i = 0; i < circles.size(); i++) {
    point = (Point) circles.elementAt(i);
    VisualNode node = (VisualNode) components.get(i);
    node.paintNode(g);
    //Handle mouse events.
    public void mouseReleased(MouseEvent e) {
    final int W = 100;
    final int H = 100;
    boolean changed = false;
    if (SwingUtilities.isRightMouseButton(e)) {
    //This will clear the graphic objects.
    circles.removeAllElements();
    area.width = 0;
    area.height = 0;
    changed = true;
    } else {
    int x = e.getX() - W / 2;
    int y = e.getY() - H / 2;
    if (x < 0)
    x = 0;
    if (y < 0)
    y = 0;
    Point point = new Point(x, y);
    VisualNode node = new VisualNode(circles.size(), point.x,
    point.y);
    // add(node);
    components.add(node);
    circles.addElement(point);
    drawingPane.scrollRectToVisible(new Rectangle(x, y, W, H));
    int this_width = (x + W + 2);
    if (this_width > area.width) {
    area.width = this_width;
    changed = true;
    int this_height = (y + H + 2);
    if (this_height > area.height) {
    area.height = this_height;
    changed = true;
    if (changed) {
    //Update client's preferred size because
    //the area taken up by the graphics has
    //gotten larger or smaller (if cleared).
    drawingPane.setPreferredSize(area);
    //Let the scroll pane know to update itself
    //and its scrollbars.
    drawingPane.revalidate();
    drawingPane.repaint();
    public void mouseClicked(MouseEvent e) {
    public void mouseEntered(MouseEvent e) {
    public void mouseExited(MouseEvent e) {
    public void mousePressed(MouseEvent e) {
    * Create the GUI and show it. For thread safety, this method should be
    * invoked from the event-dispatching thread.
    private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("ScrollDemo2");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    JComponent newContentPane = new ScrollDemo2WithBug();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.setSize(800, 600);
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    }

    I changed the name so you can run this as-is without name clashing. It works okay now.
    import javax.swing.*;
    import javax.swing.border.EtchedBorder;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class SD2 extends JPanel {
        public SD2() {
            super(new BorderLayout());
            //Set up the instructions.
            JLabel instructionsLeft = new JLabel(
                    "Click left mouse button to place a circle.");
            JLabel instructionsRight = new JLabel(
                    "Click right mouse button to clear drawing area.");
            JPanel instructionPanel = new JPanel(new GridLayout(0, 1));
            instructionPanel.add(instructionsLeft);
            instructionPanel.add(instructionsRight);
            //Set up the drawing area.
            DrawingPane drawingPane = new DrawingPane(this);
            drawingPane.setBackground(Color.white);
            drawingPane.setPreferredSize(new Dimension(200, 200));
            //Put the drawing area in a scroll pane.
            JScrollPane scroller = new JScrollPane(drawingPane);
            // scroller.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
            if(scroller.getViewport().getScrollMode() == JViewport.BACKINGSTORE_SCROLL_MODE)
                System.out.println("BACKINGSTORE_SCROLL_MODE");
            if(scroller.getViewport().getScrollMode() == JViewport.BLIT_SCROLL_MODE)
                System.out.println("BLIT_SCROLL_MODE");
            if(scroller.getViewport().getScrollMode() == JViewport.SIMPLE_SCROLL_MODE)
                System.out.println("SIMPLE_SCROLL_MODE");
            //Lay out this demo.
            add(instructionPanel, BorderLayout.PAGE_START);
            add(scroller, BorderLayout.CENTER);
         * Create the GUI and show it. For thread safety, this method should be
         * invoked from the event-dispatching thread.
        private static void createAndShowGUI() {
            //Make sure we have nice window decorations.
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            JFrame frame = new JFrame("ScrollDemo2");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new SD2();
            newContentPane.setOpaque(true);      //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.setSize(800, 600);
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    /** The component inside the scroll pane. */
    class DrawingPane extends JPanel implements MouseListener {
        SD2 sd2;
        private Dimension area;     //indicates area taken up by graphics
        private Vector circles;     //coordinates used to draw graphics
        private Vector components;
        int n = 0;
        final int
            W = 100,
            H = 100;
        DrawingPane(SD2 sd2) {
            this.sd2 = sd2;
            area = new Dimension(0, 0);
            circles = new Vector();
            components = new Vector();
            this.setLayout(null);
            addMouseListener(this);
         * The 'paint' method is a Container method and it passes its
         * Graphics context, g, to each of its Component children which
         * use it to draw themselves into the parent. JComponent overrides
         * this Container 'paint' method and in it calls this method in
         * addition to others - see api. So the children of DrawingPane will
         * each paint themselves. Here you can do custom painting/rendering.
         * But this is not the place to ask components to paint themselves.
         * That would get swing very confused...
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.fill3DRect(10, 10, 25, 25, true);
            g.setColor(Color.red);
            Point point;
            for (int i = 0; i < circles.size(); i++) {
                point = (Point) circles.elementAt(i);
                g.fillOval(point.x-2, point.y-2, 4, 4);
        //Handle mouse events.
        public void mousePressed(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
                //This will clear the graphic objects.
                circles.removeAllElements();
                components.removeAllElements();
                removeAll();                    // to clear the components
                area.width = 0;
                area.height = 0;
                setPreferredSize(area);
                revalidate();
                repaint();
            } else {
                int x = e.getX() - W / 2;
                int y = e.getY() - H / 2;
                if (x < 0)
                    x = 0;
                if (y < 0)
                    y = 0;
                Point point = new Point(x, y);
                VisualNode node = new VisualNode(this, circles.size(), point.x, point.y);
                // add(node);
                components.add(node);       // not needed
                circles.addElement(point);
                checkBoundries(x, y, node);
        private void checkBoundries(int x, int y, VisualNode node) {
            boolean changed = false;
            // since we used the setPreferredSize property to set the size
            // of each box we'll have to use it again to let the JScrollPane
            // know what size we need to show all our child components
            int this_width = (x + node.box.getPreferredSize().width + 2);
            if (this_width > area.width) {
                area.width = this_width;
                changed = true;
            int this_height = (y + node.box.getPreferredSize().height + 2);
            if (this_height > area.height) {
                area.height = this_height;
                changed = true;
            if (changed) {
                //Update client's preferred size because
                //the area taken up by the graphics has
                //gotten larger or smaller (if cleared).
                setPreferredSize(area);
                scrollRectToVisible(new Rectangle(x, y, W, H));
                //Let the scroll pane know to update itself
                //and its scrollbars.
                revalidate();
            repaint();
        public void mouseReleased(MouseEvent e) { }
        public void mouseClicked(MouseEvent e)  { }
        public void mouseEntered(MouseEvent e)  { }
        public void mouseExited(MouseEvent e)   { }
    * We are adding components to DrawingPanel so there is no need to get
    * into the paint methods of DrawingPane. Components are designed to draw
    * themseleves when their parent container passes them a Graphics context
    * and asks them to paint themselves into the parent.
    class VisualNode {
        DrawingPane drawPane;
        int x;
        int y;
        int id;
        Box box;
        public VisualNode(DrawingPane dp, int id, int x, int y) {
            drawPane = dp;
            this.id = id;
            this.x = x;
            this.y = y;
            box = Box.createVerticalBox();
            Box titlePanel = Box.createHorizontalBox();
            JTextArea title = new JTextArea(1, 10);     // 1 rows x 10 cols
            Box nodePanel = Box.createVerticalBox();
            title.setLineWrap(true);
            title.setAlignmentY(Component.TOP_ALIGNMENT);
            titlePanel.add(new JButton("Hi!"));
            titlePanel.add(title);
            nodePanel.add(titlePanel);
            nodePanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
            box.add(nodePanel);
            // here we are adding a component to drawPane so there is really
            // no need to keep this VisualNode in a collection
            drawPane.add(box);
            int ix = (int) x + drawPane.getInsets().left;
            int iy = (int) y + drawPane.getInsets().top;
            title.setText(id + " (" + ix + "," + iy + ") ");
            // since we are using the preferredSize property to setBounds here
            // we'll need access to it (via box) for the scrollPane in DrawPane
            // so we expose box as a member variable
            box.setBounds(ix, iy, box.getPreferredSize().width,
                                  box.getPreferredSize().height);
    }

  • Flash dynamic text links

    I've created a dynamic (scrolling) text field in Flash MX
    2004 Pro. The text contains links to webpages. The links work in
    the published Flash SWF but not when I place the SWF in Director.
    Please help?
    Lars

    You need to catch the getURL() message in Director and have
    it open your
    browser to the link. Try attaching the following as a
    behavior to the
    Flash sprite:
    on getURL me, aLink
    gotoNetPage(aLink)
    -- better to use Buddy API:
    -- OK = baOpenURL(aLink)
    end

Maybe you are looking for

  • Using columns of user defined types

    Can anyone help me display data from a column within a table which is of a user defined type - a object with 4 elements . Discoverer wont currently display the data - it says a MAP or ORDER method is required. The type is declared as : create or repl

  • Xperia SP M25c

    This phone has a dual SIM in it. The CDMA sim has CDMA 800 and CDMA 1900. With 3g of CDMA 2000 -> 1xRTT   1xeEV-DO Rel 0 and 1xEV-Do REV A Will this phone work on this network if it becomes locked to Verizon's Network? and Will it be able to access 3

  • IDM 11g installation issues on x64 for OIM startup

    Hello, I am trying to build a IDM 11g env on x64 machine. We have installed the following components. a. Weblogic 10.3.4/JDev b. SOA 11.1.1.2 and patch SOA 11.1.1.3 c. RCU to create schemas for OIM, MDS, OAM etc. d. IAM 11.1.1.3 for OIM e. Configured

  • DSL performing very poorly...

    Over the last month or so, my DSL connection has become increasingly unpredictable, with the modem's Internet light going out/turning red, stopping downloads dead in their tracks; waiting to get back online, etc. Having read suggestions in the Forum,

  • User Error explanation

    Hi, Can anyone please advise or provide an explanation for this General error which has appeared on a User sign in history com.siebel.occam.security.SiebelConException: Unable to establish a new session: No instances of the 'OnDemandObjMgr_eng' compo