ScrollPane Help

initially i didn't split the panel and data..
the scrollPane was showing good (table - JTable)...
            table = mainPanel.atmBean.getReturnTable();
            //Set Mode, Border, Size
            table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            table.setBorder(BorderFactory.createEtchedBorder());
            table.setPreferredScrollableViewportSize(mainPanel.getPopupTablePreferredSize());
            //Add table to Scroll Pane
            scrollPane = new JScrollPane(table);
            scrollPane.setPreferredSize(mainPanel.getPopupTablePreferredSize());after splitting the data, i changed like
add()
scrollPane = new JScrollPane();
set()
            table = mainPanel.atmBean.getReturnTable();
            //Set Mode, Border, Size
            table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            table.setBorder(BorderFactory.createEtchedBorder());
            table.setPreferredScrollableViewportSize(mainPanel.getPopupTablePreferredSize());
            //Add table to Scroll Pane
           //THIS IS THE DIFFERENCE
            scrollPane.add(table);
            scrollPane.validate();
            scrollPane.repaint();
           //c is contentPane()
           c.validate();
           c.repaint();
}the scrollpane doesn't seem to contain the table..

if i add 1 more panel, the problem gets solved, but wondering why shouldn't the scrollPane work ..
ie
add()
  JPanel panel = new JPanel();
set()
  ..all other steps as shown above
  scrollPane = new JScrollPane(table)
  //one more panel
  panel.removeAll();
  panel.add(scrollPane);
  panel.validate();
  panel.repaint();
}

Similar Messages

  • Need scrollpane help

    i am making a website and as the title says need some help with the scroll pans that im working on. i made the scroll pane gave it the instance name menupagescroll, made my comtent i want to display in there, enter the coe menupagescroll.source = menuscroll and when i preview its blank.
    some help fast would be awesome.

    The reason I asked the three things I did is to narrow down which approach you need to take to do what you want.  Since that approach isn't working out very well, just do the following...
    1) make sure the scrollpane is on the stage and has the instance name "menupagescroll" assigned to it in the Properties panel
    2) place an instance of the menuscroll symbol on the stage and assign it an instance name "menupage" in the Properties panel
    3) add the following line of code to the timeline...
        menupagescroll.source = menupage;
    If that doesn't work for you, reread and try again.

  • Please Help me place the arrows of my ScrollPane scroll bar together on one end of the scroll track!!

    I have a scrollpane component with a movie clip of some
    thumbnail images.
    I just want to have its scrollbar arrows together on one end
    of the track (or together ANYwhere) instead of having them at
    opposite ends of the scroll track.
    I have been able to customize the appearance of the
    scrollpane and its scrollbar using the HaloTheme library, but that
    approach has so far been of no use in getting the arrows together.
    I cannot tell you how deeply any help will be appreciated. I
    will probably sob and mewl with gratitude, the way I imagine
    someone lost in a vast rain forest for many weeks mewls when
    rescued. I am desperate. I am going insane. Please, please help me.

    Cherrylanenc are you on a managed network?  If not then I would recommend reviewing the steps listed in Sign in, activation, or connection errors | CC, CS6, CS5.5 - http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html.

  • Scrollpane/Scrollbar Help

    The items in the list are being generated from an XML file.
    At the moment, I only have 5 in the list because that's all that
    would fit. What I want to do is have a scrollable list in that
    area, so that my XML file could list many more than 5 items.
    I'm not sure where to begin. I've done searches online, but
    they don't seem to be what I'm looking for. What makes it more
    complicated is that those items in the list are dynamically created
    from a "linkaged" movie clip in the project library.
    Any help would be appreciated. Even if it's just a point in
    the right direction. Thanks.

    Rob - The items in the list are dynamically created movie
    clips that contain two dynamic text fields (title, short
    description) and a transparent hit area. This isn't going to help,
    but thanks for the thought.
    At the moment, I'm thinking that I could create the list in a
    separate SWF and then "import" it in a scrollpane placed in the
    original SWF. This isn't preferable to me, though, because I'd
    rather keep it all self-contained. If I'm barking-up the wrong
    tree, let me know, please!

  • How To make a custom ScrollPane/scroller Help.

    I want to make a MC that holds various Data such as textfields images maybe a video, ect just basic content, so i want to put that into a MC and be able to scroll it. But i cant figure out how to do this, no tutorials on the internet. And i dont want to use the UIScroller and Scrollpane components as they are highly unnatractive.. It is for a touch enabled device so maybe a gesture could be used? But im sure a Mouse Event would work, Can some one help me out or point me in the right direction?
    Thanks in advance.

    Your best bet for finding tutorials is Google.  Here's one result for a search using "AS3 movieclip scroller" that shows the basics.
    http://tutorials.flashmymind.com/2009/02/movieclip-scroller/

  • ScrollPane!!!!! Help please!!!!

    Hi guys, i'm trying to create a scrollPane to put into a
    captivate project...
    I downloaded a version of a tutorial and that works fine in
    captivate...
    But when i have created my own i can't seem to attach any
    files to it...
    I need to attach a big text docuemnt... i have tryed saving
    the text as a swf and attaching that but it didn't work :(
    I have also tryed using the scroll bar from compoments and
    putting that into captivate but once again no luck, when i preview
    in captivate the scroll bar jumps about the page like a mad man...
    I am becoming very frustrated:(
    Please somebody help me....

    OMG! it's worse! now I have the scroller (both horizontal and vertical!)all the time!!! It's as if it doesn't even see the JComponent!
    I tried changing the method paint to paintComponent but it doesn't change anything :o(
    anyway, this is really weird, i don't understant why it's ok with LINUX and not with windows :o(
    thanx for trying anyway :o) :o) :o)

  • Help with a gallery. scrollPane maybe?

    To see what I'm working with go here --> http://cgd1000.com/my_portfolio/pages/fllash_test.html > click enter> portfolio
    What I want to happen.
    When somebody goes to the portfolio page i would like them to see a scrolling(vertical up/down) window in the yellow background containing rows of thumbs (btns). When a thumb is clicked on i want the image/video to open to the size of the yellow background. The user will be able to click on a close button that is over the image/video and return to the portfolio page/frame.
    What I'm thinking
    is making an swf (to make changes in the future whitout altering the main swf) containing rows of thumbs. Then placing a scrollPane in the center of the yellow background with the source portfolio.swf.
    Where I get lost with this idea
    is when someone clicks on one of the thumbs how can I make the image be the same size as the yellow background, outside of/over the scrollPane? Can I make the thumbs in the swf, in the scrollPane, when clicked, goto a frame in the main timline that contains the image/video?
    Help figuring this out would be great. I would also be open to alternitive suggestions as well. I'm new so please be as descriptive as possible.
    Thanks

    If you're using AS3, then you do not want to assign the "Identifier"... you want to assign the "Class" (AS2 uses the Identifier).
    So you can just assign the source as that class...
    scrPane.source = MCClassName;

  • I can't get ScrollPane.invalidate() to work.  Need help on this one.

    I have a dynamically created scrollpane who's content comes
    from a movieclip in the library.
    When I add this content from the library, I can't for the
    life of me get the scrollpane to correctly render the scrollbars.
    This is the code that I have. The movieclip in the library is
    linked as mc1 (width 100 height 46)
    import fl.containers.ScrollPane;
    import fl.controls.ScrollPolicy;
    import fl.controls.DataGrid;
    import fl.data.DataProvider;
    var aSp:ScrollPane = new ScrollPane();
    aSp.verticalScrollPolicy = "on";
    aSp.horizontalScrollPolicy = "on";
    var aBox:MovieClip = new MovieClip();
    drawBox(aBox);
    aSp.setSize(300, 300);
    aSp.source = aBox;
    addChild(aSp);
    function drawBox(box:MovieClip):void {
    var myMc1:mc1 = new mc1();
    myMc1.y = 50;
    myMc1.x = 50;
    box.addChild(myMc1);
    var mymc2:mc1 = new mc1();
    mymc2.x = 200;
    mymc2.y = 50;
    box.addChild(mymc2);
    }

    I figured it out. Nevermind.

  • ScrollPane Problem (please help!!!!)

    I've got a class PanneauImages (extends JPanel) and it contains (zone_photo) a canvas on which i draw images(several images ( a set of images) on one canvas, that's y i need a ScrollPane).
    In the application, we have a button to change the set of images, like to go from set 1 to set 2 etc...
    we may need the scroller to show for the first set for example, but not the second. so it's supposed to show for the 1st set, disapear for the 2nd and come back for set 3 for example.
    I have a method repaint in the canvas class....
    my problem is, that the scroller jsut doesn't move when i change the set of images. and the weird thing is that this happens only when I run the application on Windows. On LINUX i don't have any problems...
    here's the full code of the two classes...
    PS : the button that chages the set is contained in another class that contains the class PanneauImage...
    first, Panneau Images...
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    import dbtables.*;
    * Classe : PanneauImages
    * Description : Cette classe represente un panneau contenant l'ensemble des images
    * elles meme contenues dans une zone
    * Societe : Medias France
    * @version 1.0
    class PanneauImages extends JPanel
         * La page resultat contenat cette page
         ResultPanel parent;
         * La zone contenant les images encadrees
         Imag zone_photo;
         * Dimensions
         int width, height;
         * La barre de defilement contenant les images
         ScrollPane sp;
         //===========================================================================================
         * Constructeur par defaut.
         * @param     res Le parent
         * @param     chain La dexieme partie de l'adresse
         * @return     Sans objet.
         public PanneauImages(ResultPanel res, int w, int h)
              parent = res;
              width = w;
              height = h;
              setLayout(new BorderLayout());
              sp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
              zone_photo = new Imag(this, sp, width, height);     
              sp.add(zone_photo);
              Adjustable vadjust = sp.getVAdjustable();
              Adjustable hadjust = sp.getHAdjustable();
              add(sp, "Center");
         * redessiner les photos
         * @param     Sans objet.
         * @return     Sans
         public void redessiner()
              //zone_photo.changeHeight();
              zone_photo.effacer();
         zone_photo.repaint();
         * Trouver la meilleure taille pour le composant
         * @param     Sans objet.
         * @return     La taille optimale
         public Dimension getPreferredSize()
              return new Dimension(width, height);
         * Trouver la meilleure marge pour le composant
         * @param     Sans objet.
         * @return     La marge optimale
         public Insets getInsets()
              return new Insets(5,5,5,5);
    and Imag
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    import dbtables.*;
    * Classe : Imag
    * Description : Cette classe represente plusieurs image dans des cadres
    * Societe : Medias France
    * @version 1.0
    class Imag extends Canvas
         * Le scrollPane contenant cette classe
         ScrollPane scroll;
         * La classe contenant ces images
         PanneauImages parent;
         * Variables
         int id,nb_images=0, indice=0, ancien_hauteur=0;
         int width, height;
         * Hauteur et largeur du cadre
         int hauteur, largeur;
         * tableau contenant les adresses des images
         java.awt.Image[] img;
         * les Coordonnees des images
         int x,y, xx, yy;
         * lee nombre d'images par ligne
         int nbImLigne;
         //===========================================================================================
         * Constructeur par defaut.
         * @param     par Le parent
         * @param     s Le scroller
         * @param     w la largeur du conteneur d'origine
         * @param     h La hauteur du conteneur d'origine
         * @return     Sans objet.
         public Imag(PanneauImages par,ScrollPane s, int w, int h)
              parent = par;
              width=w;
              height = h;
              indice=0;
              scroll = s;
              //le listener pour le zoom sur les images
              addMouseListener(new MouseAdapter()
                   public void mouseClicked(MouseEvent evt)
                   //Coordonnee x du click souris
                   int x;
                   //Coordonnee y du click souris
                   int y;
                   //Le numero de ligne ou l'on a clique
                   int resy;
                   //Le numero de colonne ou l'on a clique
                   int resx;
                   //Le numero de l'image selectionnee
                   int num_image;
                   //recuperer les coordonnee du click
                   y = evt.getY();
                   x = evt.getX();
                   //trouver la ligne et la colonne
                   resy = y / 210;
                   resx = x / 182;
                   //verifier si le click est effectivement sur une image
                   int i1 = 10+210*resy;
                   int i2 = 172+210*resy;
                   if((i1 < y) && (i2 > y))
                        //rien faire
                   else
                        resy = -1;
                   int i3 = 10+182*resx;
                   int i4 = 172+182*resx;
                   if((i3 < x ) && (i4 > x ))
                        //rien faire
                   else
                        resx = -1;
                   //si click bon
                   if((resx > -1) && (resy > -1))
                        num_image = (resy *nbImLigne)+resx;
                        if (num_image < nb_images)
                             //creation et ouverture d'une fenetre image
                             Frame f = new Frame("Zoom");
                             ImageZoom imgzoom = new ImageZoom(f, img[num_image]);
         * Dessiner les images
         * @param     r Le contexte graphique utilise pour le dessin.
         * @return     Sans objet.
         public void paint(Graphics g)
              //pollen courant
              int nbre = parent.parent.numPollen;
              //nombre d'images pour ce pollen
              nb_images = ((ReqPropPollen)parent.parent.vectResult.elementAt(nbre)).images.size();
              if (nb_images > 0)
              img = new java.awt.Image[nb_images];
              Photo p;
              //recuperer les images a dessiner
              for(int i = 0; i < nb_images; i++)
                   String s = ((dbtables.Image)((ReqPropPollen)parent.parent.vectResult.elementAt(nbre)).images.elementAt(i)).getChem_ima();
                   p = new Photo(this,s);
                   img[i] = p.img;
              int j;
              x=10;
              y=10;
              j=0;
              xx=0;
              yy=0;
              //variables utilisees pour distribuer les images dans la fenetre
              int xmax = parent.parent.parent.parent.getSize().width-70;
              //nbre d'images max par ligne
              nbImLigne = xmax/182;
              //cas ou on ne peut afficher qu'une colone d'images
              if (nbImLigne==0)
                   j = -1;
              //pour toutes les images, les dessiner
              for (int i=0; i<nb_images; i++)
                   largeur = img.getWidth(this);
                   hauteur = img[i].getHeight(this);
                   taille();
                   //tant qu'on peut dessiner une autre image sur la meme ligne...
                   if (j<nbImLigne)
                        g.drawRect(x-1,y-1,162,162); // trace un rectangle noir autour de la photo
                        g.drawImage(img[i],x+xx,y+yy,largeur, hauteur,this); // affiche la photo
                        x=x+182; //*(j+1);
                        j++;
                   else
                        j = 0;
                        x = 10;
                        y = y+210;
                        g.drawRect(x-1,y-1,162,162); // trace un rectangle noir autour de la photo
                        g.drawImage(img[i],x+xx,y+yy,largeur, hauteur,this); // affiche la photo
                        j++;
                        x=x+182;
              width = 0; //permet de ne pas afficher une barre horizontale
              int i1;
              int i2;
              if (nbImLigne==0)
                   i1 = nb_images;
                   i2 = nb_images - i1;
              else
                   i1 = nb_images/nbImLigne;
                   i2 = nb_images - (i1*nbImLigne);
              int i3;
              if(i2 > 0)
                   i3 = i1+1;
              else
                   i3 = i1;
              height = 210*i3;
              if (nbImLigne==0)
                   width = 182;
              else
                   width = 182*nbImLigne;
              //modifier la taille du Canvas
              setBounds(getX(), getY(), width, height);
              System.out.println("la largeur du canvas est de "+ getWidth());
              System.out.println("la hauteur du canvas est de "+ getHeight());
              else
                   System.out.println("pas d'images pour ce pollen");
         * Calculer les variables pour le placement des images
         * @param     Sans objet.
         * @return     Sans objet.
         public void taille()
              int haut_tmp = hauteur*160/largeur;
              if (haut_tmp >= 160)
                   largeur = largeur*160/hauteur;
                   hauteur=160;
                   xx = (160-largeur)/2;
                   yy = 0;
              else
                   largeur = 160;
                   hauteur = haut_tmp;
                   yy = (160-hauteur)/2;
                   xx = 0;
         * Mise a jour du Canvas sans effacer le fond a chaque fois
         * @param     p Le contexte graphique
         * @return     Sans objet.
         public void update(Graphics g)
         paint(g);
         * Effacer le fond du Canvas
         * @param     p Le contexte graphique
         * @return     Sans objet.
    public void effacer()
         Graphics g = getGraphics();
         g.clearRect(getX(), getY(), getWidth(), height);
         g.dispose();
         * Trouver la taille minimale pour le composant
         * @param     Sans objet.
         * @return     La taille minimale
         public Dimension getMinimumSize()
              return new Dimension(width, height);
         * Trouver la meilleure taille pour le composant
         * @param     Sans objet.
         * @return     La taille optimale
         public Dimension getPreferredSize()
              return new Dimension(width, height);
         * Trouver la meilleure marge pour le composant
         * @param     Sans objet.
         * @return     La marge
         public Insets getInsets()
              return new Insets(0,0,0,0);

    OMG! it's worse! now I have the scroller (both horizontal and vertical!)all the time!!! It's as if it doesn't even see the JComponent!
    I tried changing the method paint to paintComponent but it doesn't change anything :o(
    anyway, this is really weird, i don't understant why it's ok with LINUX and not with windows :o(
    thanx for trying anyway :o) :o) :o)

  • Help for scrollpanes

    Hi All,
    I am working with one application that have two Jtree Visivle. There tree are visible in left and right side of a frame. Using panels I have put SplitPanes in these . Now my problem is to draw a line from left tree node to a right tree node. Using paint method and getRowBound I use to find the points I am able to draw a line.
    My problem is , now these two trees are in different panel so I will be having a different graphics object on these panels. Secondly once I draw a line and when I scroll any tree the lines become static . I want that lines should always remain with those node even when I am scrolling.
    Please help me regarding this.
    Regards,
    Sandeep

    Try this, or use email [email protected]
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.tree.DefaultTreeCellRenderer;
    public class TreeP extends JFrame
         JTree       jtR;
         JTree       jtL;
         JScrollPane jsL;
         JScrollPane jsR;
         Vector con             = new Vector();
         MyTreeCellRenderer tcl = new MyTreeCellRenderer(con);
         Tpan   panel           = new Tpan();
         int    from            = -1;
         int    mark            = -1;
         Point  toP             = new Point(0,0);
         boolean st = true;
         int     sn = 0;
    public TreeP() 
         setBounds(1,1,600,400);     
         getContentPane().setLayout(new BorderLayout());
         addWindowListener(new WindowAdapter()
         {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);
         panel.setBorder(new EmptyBorder(4,4,4,4));
         LeftTree();
         RightTree();
         jsL = new JScrollPane(jtL);
         jsL.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
         jsR = new JScrollPane(jtR);
         jsL.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener()
         {     public void adjustmentValueChanged(AdjustmentEvent a)
                   repaint();
         jsR.getVerticalScrollBar().     addAdjustmentListener(new AdjustmentListener()
         {     public void adjustmentValueChanged(AdjustmentEvent a)
                   repaint();
         panel.add("West",jsL);
         panel.add("East",jsR);
         getContentPane().add("Center",panel);
         JPanel butt = new JPanel();
         butt.setPreferredSize(new Dimension(0,22));
         butt.setLayout(new GridLayout(0,5,10,10));     
         butt.setBorder(new EmptyBorder(1,5,0,0));
         getContentPane().add("South",butt);
         JButton jbc = new JButton("Connect");
         butt.add(jbc);
         jbc.addActionListener(new ActionListener()
         {     public void actionPerformed( ActionEvent e )
                   connect();
         JButton jbd = new JButton("DisConnect");
         butt.add(jbd);
         jbd.addActionListener(new ActionListener()
         {     public void actionPerformed( ActionEvent e )
                   if (mark > -1) 
                        con.remove(mark);
                        mark = -1;
                        panel.repaint();
         jtL.addKeyListener(new MyKeyListener());     
         setVisible(true);     
    private void LeftTree()
         Vector  v1 = new Vector();     
         for (int i=0; i < 451; i++) v1.add("l "+i+" entry "+(199-i));
         jtL = new JTree(v1);  
         jtL.setPreferredSize(new Dimension(200,70*20+15));     
         jtL.setSize(200,451*20+10);     
         jtL.setBorder(new MatteBorder(1,1,1,1,Color.orange));
         jtL.setCellRenderer(tcl);
         jtL.addMouseListener(new MouseAdapter()     
         {     public void mousePressed(MouseEvent m)
    //               L.p("p  "+m.getX());
                   from  = jtL.getClosestRowForLocation(m.getX(),m.getY());
    //               L.p(""+from);
                   toP.setLocation(-1,-1);
                   jtL.setSelectionRow(from);
              public void mouseReleased(MouseEvent m)
                   int x = m.getX() - jsR.getX() + 4;
                   Rectangle vl = jsL.getViewport().getViewRect();     
                   Rectangle vr = jsR.getViewport().getViewRect();     
                   if (x > 1)
                          int t = jtR.getClosestRowForLocation(x,m.getY()-vl.y+vr.y);
                        jtR.setSelectionRow(t);
                        connect();     
                   from = -1;
                   panel.repaint();
         jtL.addMouseMotionListener(new MouseMotionAdapter()          
         {     public void mouseDragged(MouseEvent m)
                   if (from > -1)
                        toP.setLocation(m.getX()+4,m.getY()+4);
                        panel.repaint();
    private void RightTree()
         Vector  v1 = new Vector();     
         for (int i=0; i < 70; i++) v1.add("r "+i+" entry "+(199-i));
         jtR = new JTree(v1);  
         jtR.setPreferredSize(new Dimension(200,70*20+15));     
         jtR.setSize(200,70*20+10);     
         jtR.setBorder(new MatteBorder(1,1,1,1,Color.blue)); 
         jtR.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
         jtR.setCellRenderer(tcl);
    private void connect()
         if (jtR.getSelectionCount() != 1) return;
         if (jtL.getSelectionCount() != 1) return;
         int [] sr = jtR.getSelectionRows();
         int [] sl = jtL.getSelectionRows();
         con.add(new Point(sl[0],sr[0]));
         panel.repaint();
    private void disConnect()
         if (jtR.getSelectionCount() != 1) return;
         if (jtL.getSelectionCount() != 1) return;
         int [] sr = jtR.getSelectionRows();
         int [] sl = jtL.getSelectionRows();
         for (int k=0; k < con.size(); k++)
              Point p = (Point)con.get(k);
              if (sl[0] == p.x && sr[0] == p.y) con.remove(k--);
         panel.repaint();
    public class Tpan extends JPanel
         Rectangle ll;
         Rectangle rr;
    public Tpan()
    //     super(JSplitPane.HORIZONTAL_SPLIT);     
    //     setDividerSize(88);
    //     setDividerLocation(188);
         setLayout(new BorderLayout());
         setPreferredSize(new Dimension(500,100));     
         addMouseListener(new MouseAdapter()     
         {     public void mousePressed(MouseEvent m)
                   findLine(m.getX(),m.getY());
    private void findLine(int x,int y)
         mark = -1;
         for (int k=0; k < con.size(); k++)
              calculateLine(k);
              Line2D line = new Line2D.Double(ll.x,ll.y-1,rr.x,rr.y+1);
              if (line.ptLineDist(x,y) < 2)
                   mark = k;
                   panel.repaint();
    public void paint(Graphics g)
         super.paint(g);
         myPaint(g);
    public void myPaint(Graphics g)
         for (int k=0; k < con.size(); k++)
              calculateLine(k);
              Rectangle vl = jsL.getViewport().getViewRect();     
              Rectangle vr = jsR.getViewport().getViewRect();     
              if (k == mark)      g.setColor(Color.red);
                   else        g.setColor(Color.black);     
              g.fillRect(ll.x-9,ll.y-vl.y,9,1);
              g.drawLine(ll.x-1,ll.y-vl.y,rr.x,rr.y-vr.y);
              g.fillRect(rr.x+1,rr.y-vr.y,13,1);
         g.setColor(Color.gray);     
         if (from > -1 && toP.x > -1)
              Rectangle ll = jtL.getRowBounds(from);
              Rectangle vl = jsL.getViewport().getViewRect();
              ll.y = ll.y + 4 + ll.height / 2 - vl.y;
              ll.x = jtL.getX()+jtL.getWidth();
              g.drawLine(ll.x-20,ll.y,toP.x,toP.y-vl.y);
    private void calculateLine(int k)
         Point p = (Point)con.get(k);
         ll   = jtL.getRowBounds(p.x);
         rr   = jtR.getRowBounds(p.y);
         ll.y = ll.y + 4 + ll.height / 2;
         rr.y = rr.y + 4 + rr.height / 2;
         ll.x = jsL.getX()+jsL.getWidth()-1;
         rr.x = jsR.getX();
    public class MyTreeCellRenderer extends DefaultTreeCellRenderer
         MyCell mL  = new MyCell(0);
         MyCell mR  = new MyCell(15);
         Vector vc;
    public MyTreeCellRenderer(Vector v)
         super();
         vc = v;
    public Component getTreeCellRendererComponent(JTree   tree,
                                                  Object  value,
                                                  boolean selected,
                                                  boolean expanded,
                                                  boolean leaf,
                                                  int     row,
                                                  boolean hasFocus)
         boolean b = false;
         if (tree.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
              for (int k=0; k < con.size(); k++)
                    if (((Point)con.get(k)).y == row) b = true;
              mR.setText(value.toString(),selected, b);
              return(mR);     
         else
              for (int k=0; k < con.size(); k++)
                   if (((Point)con.get(k)).x == row) b = true;;
              mL.setText(value.toString(),selected, b);
              return(mL);     
    public class MyCell extends JComponent
         String      text = "";
         boolean     sel  = false;
         boolean     con  = false;
         int         x    = 0;
         ImageIcon   i2 = new ImageIcon("bindi.gif");
         ImageIcon   i1 = new ImageIcon("attribute.gif");
         FontMetrics fm = null;
    public MyCell(int or)
         super();
         x = or;
         setPreferredSize(new Dimension(190,20));     
    public void setText(String s, boolean b, boolean b1)
         text = s;
         sel  = b;
         con  = b1;
         repaint();
    public void paint(Graphics g)
         super.paintComponent(g);
         fm = getFontMetrics(g.getFont());
         if (sel)
              g.setColor(Color.orange);
              g.fillRect(x+18,1,135,17);     
         g.setColor(Color.black);
         if (x == 0)
              g.drawString(text,21,13);
              g.drawImage(i1.getImage(),0,0,null);
              if (con) g.drawImage(i2.getImage(),161,4,null);
         if (x != 0)
              int w = fm.stringWidth(text);
              g.drawString(text,x+150-w,13);
             if (con) g.drawImage(i2.getImage(),x,4,null);
              g.drawImage(i1.getImage(),x+158,0,null);
    class MyKeyListener extends KeyAdapter
    public void keyPressed(KeyEvent e)
         st = false;
    public void keyReleased(KeyEvent e)
         int i[] = jtL.getSelectionRows();
         jtL.clearSelection() ;
         st=true;
         jtL.setSelectionRow(i[0]);
    public static void main (String[] args) throws InterruptedException
         new TreeP();
    Noah

  • Help for scrollPane

    hi
    I'm adapting my source code, following the swing tutorial example for scrollbar pane.
    I ask you to check my code because I do not see what I want.
    my code is intended to put a panel on a scrollpane and then add a textfield to the panel.
    the scrollpane is already on my "design" tab (nebeans dev env).
    I do not see this.
    thanks in advance
    testPanel.setEnabled(true);
    testPanel.setBackground(Color.black);
    testPanel.setVisible(true);
    Dimension dimension1=new Dimension(60,60);;
    testPanel.setPreferredSize(dimension1);
    testPanel.setSize(dimension1);
    testPanel.setEnabled(true);
    testPanel.setBackground(new java.awt.Color(0, 0, 0));
    JTextField testTextField=new JTextField("prova");
    testTextField.setEnabled(true);
    testTextField.setBackground(new java.awt.Color(0, 102, 153));
    testPanel.add(testTextField,new org.netbeans.lib.awtextra.AbsoluteConstraints(272, 51, 316, -1));
    JLabel instructionsLeft = new JLabel("Click left mouse button to place a circle.");
    jScrollPane1.add(instructionsLeft);
    jScrollPane1.add(testPanel,new AbsoluteConstraints(140, 10, -1, -1));
    jScrollPane1.setEnabled(true);
    testPanel.repaint();
    jScrollPane1.repaint();
    this.repaint();

    P5music wrote:
    The only hint in the API document section is to use
    jScrollPane1.setViewportView(testPanel);
    Now, I used it instead of jScrollPane1.add(testPanel);
    but nothing changed....It's very hard to guess what you're doing wrong without compilable code. Unless someone very clever comes by soon who can instantly spot your problme, my recommendation that you create and post an SSCCE still stands. In fact odds are, if you create the SSCCE, you'll spot your error and be able to fix it yourself. Much luck.

  • HELP!!!Embedding a JTable on a ScrollPane into a JTable's cell

    I have a single column DND JTable on a DND JScrollPane that I would like to put into another's JTable's cell. I've tried creating a CellRenderer that extends the DNDJScrollPane and returns this but this doesn't work. I do have code I could post if anyone is interested in helping out.

    First copy this and compile and run and c.. then look at the code
    import javax.swing.border.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    import java.awt.*;
    public class JTableExample extends JFrame
    JTableRenderer renderer;
    MyTableModel m1, m2;
    public JTableExample()
    super();
    m1 = new MyTableModel();
    m2 = new MyTableModel();
    DefaultTableModel dtm = new DefaultTableModel()
    // make first cell uneditable
    public boolean isCellEditable(int row, int column)
    return !(column == 0);
    dtm.setDataVector(new Object[][]{{ "JTable1",  m1},
    { "JTable2",  m2}},
    new Object[]{ "Column1","Column2"});
    JTable table = new JTable(dtm);
    renderer = new JTableRenderer();
    table.getColumn("Column2").setCellRenderer(renderer);
    table.getColumn("Column2").setCellEditor(new JTableEditor());
    table.setRowHeight(80);
    JScrollPane scroll = new JScrollPane(table);
    getContentPane().add(scroll);
    setSize( 400, 250 );
    setVisible(true);
    public static void main(String[] args) {
    JTableExample frame = new JTableExample();
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    * JTable Editor
    class JTableEditor extends DefaultCellEditor
    public JTableEditor()
    super(new JCheckBox());
    public Component getTableCellEditorComponent(JTable table, Object value,
    boolean isSelected, int row, int column)
    return renderer;
    public Object getCellEditorValue()
    return (MyTableModel)((JTableRenderer)renderer).jtable.getModel();
    * JTable Renederer
    class JTableRenderer extends JScrollPane implements TableCellRenderer
    JTable jtable;
    public JTableRenderer()
    jtable = new JTable();
    getViewport().add(jtable);
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus,
    int row, int column)
    if (isSelected)
    setForeground(table.getSelectionForeground());
    setBackground(table.getSelectionBackground());
    jtable.setForeground(table.getSelectionForeground());
    jtable.setBackground(table.getSelectionBackground());
    else
    setForeground(table.getForeground());
    setBackground(table.getBackground());
    jtable.setForeground(table.getForeground());
    jtable.setBackground(table.getBackground());
    jtable.setModel((AbstractTableModel)value);
    return this;
    class MyTableModel extends AbstractTableModel {
    final String[] columnNames = {"First Name",
    "Last Name",
    "Sport",
    "# of Years",
    "Vegetarian"};
    final Object[][] data = {
    {"Mary", "Campione",
    "Snowboarding", new Integer(5), new Boolean(false)},
    {"Alison", "Huml",
    "Rowing", new Integer(3), new Boolean(true)},
    {"Kathy", "Walrath",
    "Chasing toddlers", new Integer(2), new Boolean(false)},
    {"Mark", "Andrews",
    "Speed reading", new Integer(20), new Boolean(true)},
    {"Angela", "Lih",
    "Teaching high school", new Integer(4), new Boolean(false)}
    public final Object[] longValues = {"Angela", "Andrews",
    "Teaching high school",
    new Integer(20), Boolean.TRUE};
    public int getColumnCount() {
    return columnNames.length;
    public int getRowCount() {
    return data.length;
    public String getColumnName(int col) {
    return columnNames[col];
    public Object getValueAt(int row, int col) {
    return data[row][col];
    public Class getColumnClass(int c) {
    return getValueAt(0, c).getClass();
    public boolean isCellEditable(int row, int col) {
    if (col < 2) {
    return false;
    } else {
    return true;
    public void setValueAt(Object value, int row, int col) {
    if (data[0][col] instanceof Integer
    && !(value instanceof Integer)) {
    try {
    data[row][col] = new Integer(value.toString());
    fireTableCellUpdated(row, col);
    } catch (NumberFormatException e) {
    } else {
    data[row][col] = value;
    fireTableCellUpdated(row, col);
    private void printDebugData() {
    cheers
    good luck

  • Help Please, Linking from a swf in a Scrollpane to positions on the main timeline

    I have a scrollpane where I have loaded a swf of many small images that are set up as buttons.
    How do I create the link between this swf/actionscript to the main fla/timeline that the scrollpane is contained in?
    Thanks

    Buttons function with eventListeners, if they are actual button symbols then you should have an unique instance name, otherwise convert them to symbols and name the instances, if they are symbols and named then you can code them to do whatever you want.
    Add an event listener and function call for each button in the actionscirpt of the swf and provide the targets of the frame, anchor, or label for the event in the function.
    img1_btn.addEventListener(MouseEvent.CLICK, img1Handler);
    img2_btn.addEventListener(MouseEvent.CLICK, img2Handler);
    img3_btn. etc...
    function img1Handler(event:MouseEvent):void
         //go to and stop on the frame to display
         //you can also use frame labels or anchors
         // gotoAndStop("label");
         gotoAndStop(2);
    function img2Handler(event:MouseEvent):void
         //if you put the images in scene 2 for example then call the Scene the frame is in.
         // in this case for example, frame 3, Scene 1
         gotoAndStop(3, "Scene 1");
    Duplicate for each button/img.
    Have fun.

  • HELP : onPress event for a movieclip inside of ScrollPane

    I have a ScrollPane and this ScrollPane loads an item from
    the Library. And this library item contains moviecilp and I'm
    trying to add 'onPress' event to this movieclip by..
    MovieName.onPress = function()
    trace("Pressed");
    But, since this movie is inside of ScrollPane the onPress
    event never occurs.
    Please let me know how to an event to a movieclip that
    resides inside of ScrollPane.
    Thanks in advance.

    As Luigil said, there is a path problem.
    First you must find the right path.
    create in level0 the var test1:String;
    //Put this on Frame 1 of your loaded MC:
    _level0.test1 = this; //now you can see the right path
    cheers

  • Help needed in Loading Mutiple movies in ScrollPane

    Hi I am making video gallery using Action Script 3.0.I am
    loading some FLVs into movies on my stage using XML. I have
    on-click events on those movies.I have combined those all movies
    into one movie to put in the scroll pane. The movie is fine fitted
    in the scroll pane with the scrolls (which i needed )but the
    problem I have is that all the on click events which were on the
    individual movies are gone. The reason might be that because the
    on-click events were on individual movies, and movies are now
    combined in one. If anybody tells me how to load multiple
    movies(collectively) in the scroll pane, that can solve my problem
    because in that way movies can be inserted in the scroll pane
    without combining all the movie into one and events will stay there
    too.
    Any other suggestion will be also be appreciated.
    Please help me out in figuring out the solution of this
    problem.
    Thanks
    Anuj

    Hi,
    I am surprised with your steps. In APO, you want to load data from a particular infoobject from BW. Why did you create a specific extractor in SBIW???
    You have just reinvented the wheel... It reminds me some people in the world ...
    Here is what you should do:
    - in BW, at the infosource level, you create a direct infosource based on the infoobject that you want to extract the data to APO (let's say 0MATERIAL)
    - in BW, at the infosource level, you right click on the infosource itself and you choose 'GENERATE EXPORT DATASOURCE. That will create the datasources for you (attributes, texts, hierarchies) depending on the infoobject settings. The names of these datasources will begin with a 8 for the datamart
    - in APO, you replicate the BW system. Now you find the datasources 80MATERIAL something
    - in APO, you create the transfer rules to your infosource and you can load
    Just give it a try
    Regards

Maybe you are looking for

  • Planned/process ord creation on sales order creation

    Hello Experts, Is it possible to create planned/process orders on creation of a sales order? The scenario is MTO. Also, if any of you has done this, do let me know an example of where such a requirement comes to use. Thanks, Pradeep.

  • Odbc connection test success but can't link the database to oracle with 1013 call failed error.

    i am using my MS Access 2013 to connect with my oracle database. I created the odbc link and successfully have connection test pass. However i can;t link the database with my MS access. When i am using different software (mapinfo), i am able to conne

  • Best practice Warnings in OBIEE 10G

    Hi Today i suddenly checked in my RPD that tere are 250 best practice warnings. Most are related to keys not defined etc. I want to know what is the impact of best practice warnings. as to resolve 250 warnings, i will hve to invest lot of time. If it

  • Is it possible to ask iTunes to add some videos?

    Hi everyone! I just recieved my Touch (on Thursday). It's a week 39 and it's just PERFECT =). I missed the two first episodes of House season 4. Is it possible to ask iTunes to add them to the store? I konw I'm not the only one who wants that ^^. If

  • How to match custom profile of PMW-350K and Canon XF300

    Not exacctly a Premiere Pro question, but neither does it belong in the Lounge. We will be shooting the Heineken Regatta on Sint Maarten in March. We have two cameras, a Canon XF300 and a Sony PMW-350K with the standard 16x Fujinon lens. What is the