Creating a JTable of JLabels presented in a JScrollPane()

Hi, I want to create an object showing all/some colored labels. I get it presented with 5 columns, but nothing is colored. Her is a part of the logic:
public MyColorTableModel()
// String [][] array;
array = new JLabel [280][10]; //Just for test purposes
int row=0;
int col=0;
String cc;
JLabel lbl;
for (r=0; r<256; r++)
System.out.println("Red number is : " + r);
for (g=0; g<256; g++)
System.out.println("Green number is: " + g);
for (b=0; b<256; b++)
cc = ("R= "+r+" G= "+g+" B= "+b);
lbl = new JLabel(cc);
lbl.setOpaque(true);
lbl.setBackground(new Color(r, g, b));
array[row] [col] = lbl; //Is this the problem???
if (col==4)
col=-1;
row++;
col++;
r=600; g=600; //Force stop
Thanks
tjoge01

Totally the wrong way of going about it, using exactly what JTable is designed to avoid (ie huge numbers of components).
Read this,
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#renderer

Similar Messages

  • Create a JTable based on an ArrayList containing instances of a class.

    I have a class, IncomeBudgetItem, instances of which are contained in an ArrayList. I would like to create a JTable, based on this ArrayList. One variable is a string, while others are type double. Not all variables are to appear in the JTable.
    The internal logic of my program is already working. And my GUI is largely constructed. I'm just not sure how to make them talk to each other. The actually creation of the JTable is my biggest problem right now.

    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.util.ArrayList;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    public class TableDemo extends JPanel {
         private boolean DEBUG = false;
         public TableDemo() {
              super(new GridLayout(1, 0));
              ArrayList<MyObject> list = new ArrayList<MyObject>();
              list.add(new MyObject("Kathy", "Smith", "Snowboarding", new Integer(5),
                        new Boolean(false)));
              list.add(new MyObject("John", "Doe", "Rowing", new Integer(3),
                        new Boolean(true)));
              list.add(new MyObject("Sue", "Black", "Knitting", new Integer(2),
                        new Boolean(false)));
              list.add(new MyObject("Jane", "White", "Speed reading",
                        new Integer(20), new Boolean(true)));
              JTable table = new JTable(new MyTableModel(list));
              table.setPreferredScrollableViewportSize(new Dimension(500, 70));
              table.setFillsViewportHeight(true);
              // Create the scroll pane and add the table to it.
              JScrollPane scrollPane = new JScrollPane(table);
              // Add the scroll pane to this panel.
              add(scrollPane);
         class MyObject {
              String firstName;
              String lastName;
              String sport;
              int years;
              boolean isVeg;
              MyObject(String firstName, String lastName, String sport, int years,
                        boolean isVeg) {
                   this.firstName = firstName;
                   this.lastName = lastName;
                   this.sport = sport;
                   this.years = years;
                   this.isVeg = isVeg;
         class MyTableModel extends AbstractTableModel {
              private String[] columnNames = { "First Name", "Last Name", "Sport",
                        "# of Years", "Vegetarian" };
              ArrayList<MyObject> list = null;
              MyTableModel(ArrayList<MyObject> list) {
                   this.list = list;
              public int getColumnCount() {
                   return columnNames.length;
              public int getRowCount() {
                   return list.size();
              public String getColumnName(int col) {
                   return columnNames[col];
              public Object getValueAt(int row, int col) {
                   MyObject object = list.get(row);
                   switch (col) {
                   case 0:
                        return object.firstName;
                   case 1:
                        return object.lastName;
                   case 2:
                        return object.sport;
                   case 3:
                        return object.years;
                   case 4:
                        return object.isVeg;
                   default:
                        return "unknown";
              public Class getColumnClass(int c) {
                   return getValueAt(0, c).getClass();
          * Create the GUI and show it. For thread safety, this method should be
          * invoked from the event-dispatching thread.
         private static void createAndShowGUI() {
              // Create and set up the window.
              JFrame frame = new JFrame("TableDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // Create and set up the content pane.
              TableDemo newContentPane = new TableDemo();
              newContentPane.setOpaque(true); // content panes must be opaque
              frame.setContentPane(newContentPane);
              // Display the window.
              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();
    }

  • Create a new user in Presentation Services

    Hello All,
    I would like to know if it is possible to create a user in Presentation Services.
    For now, when we create a user, we use the administration tool. We do the following manipulation:
    Manage-> Security-> Action-> users
    Is it possible to create a new user in Presentation Services?
    Thank you in advance for your answers
    Best regards

    Hi,
    Users are created in the Repository. When a user logs in via the presentation server, this user is validated against the one created in the repository.
    Cheers.
    Daan Bakboord
    http://obiee.nl

  • How do I create a jtable with horizontalScroll bar,plz help me!

    I created a jtable component,Because my table's columns has 50 items,I must need a horizontalScroll Bar.
    but I find the horizontalScroll don't display,when I add record to the jtable,the verticalScroll Bar is showed.How do I create a jtable with horizontalScroll bar,can u help me!
    thank you in advance!

    Hi,
    This piece of code will help :
         //Get the Component Adapter for taking action against resizing of
    //of Panel
    ComponentListenerAdapter componentAdapter =
    new ComponentListenerAdapter()
    //Get the scrollbar or remove the scrollbar upon resizing
    protected void resizingAction()
    Container tableParent = table.getParent();
    if (tableParent instanceof JViewport)
    //Check if the width of the Table Parent Container
    //is less than the Preferred Size of the Table
    if (tableParent.getSize().getWidth() <
    table.getPreferredSize().getWidth())
    //Yes it is
    //Remove the Auton Resize Function and get the
    //Scrollbar
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF );
    else
    //No it is not
    //Get the Auto Resize functionality back in place
    table.setAutoResizeMode(
    JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
    //Add the component Adapter to the Table Header
    table.getTableHeader().addComponentListener(componentAdapter);
    private abstract class ComponentListenerAdapter
    implements ComponentListener
              * The <code>componentHidden<code> method has no implementation
              * @param event The Event occured whenever the Component is Hidden
              public void componentHidden(ComponentEvent event)
                   //No Implementaion - Intentially Left Blank
              * The <code>componentShown</code> method has no implementation
              * @param event The Event occured whenever the Component is Shown
              public void componentShown(ComponentEvent event)
                   //No Implementaion - Intentially Left Blank
              * The <code>componentMoved</code> method has no implementation
              * @param event The Event occured whenever the Component is Moved
              public void componentMoved(ComponentEvent event)
                   //No Implementaion - Intentially Left Blank
              * The <code>componentResized</code> method is invoked whenever the
              * component is resized. The resizing action will set the columns and
              * scrollbar to act properly
              * @param event The Event occured whenever the Component is Resized
              public void componentResized(ComponentEvent event)
                   resizingAction();
    * Subclasses of this override this method to determine what is to be
    * done once the Component has been Resized
    protected abstract void resizingAction();
    Hope this will solve all your JTable horizontal resizing problems
    --j                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can anyone teach me how to create a JTable

    In my project, i would like to make a class extends JTable for which it can function like the excel one.
    This means that the table can split into two parts.
    Each of them have a standalone view and can let user to update the table.

    Had some time to spare so a quick rough example.
    Note this makes use of the TableModel created by JTable when passed an Object[][].
    I'd recommend instead that you create your own TableModel and pass that to both JTables yourself.
    import javax.swing.*;
    import javax.swing.table.*;
    public class SplitTableDemo extends JFrame
       public SplitTableDemo(String title) {
            super(title);
            // prepare data
            int cols = 26;
            int rows = 200;
            Object[][] data = new Object[rows][cols];
            for (int j=0; j<rows; j++) {
                for (int k=0; k<cols; k++) {
                    data[j][k] = new String("");
            // prepare column names
            Object[] columnNames = new Object[cols];
            for (int m=0; m<cols; m++) {
                char c = (char) (65+m);   
                columnNames[m] = String.valueOf(c);
            // create first table view
            JTable upperTable = new JTable(data, columnNames);
            // create second table view with same model (obtained from first)
            TableModel tm = upperTable.getModel();
            JTable lowerTable = new JTable(tm);
            // put tables in ScrollPanes
            JScrollPane upperScroller = new JScrollPane(upperTable);
            JScrollPane lowerScroller = new JScrollPane(lowerTable);
            // display in split pane
            JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upperScroller, lowerScroller);
            this.getContentPane().add(sp);
       public static void main (String[] args)
          SplitTableDemo splitTableDemo = new SplitTableDemo("Split Table Demo");
          splitTableDemo.pack();
          splitTableDemo.show();
    }

  • Creating a JTable as a leaf for JTree

    Is it possible to create a JTable as leaf node of a JTree..?
    I used treecellrenderer which returns JTable as component.. but i'm getting a single row of table in my tree..? How can i solve this..?

    bbritta,
    Thanks a lot.. for u'r support. But actually i don't want to have some kind of explorer type interface with a tree on the left side of a panel & a TABLE . I want to have a JTable as a leaf node in JTree. I mean i need JTable as node for Jtree.. But still teh code u suggested make some sense.. i will give a try.. Thanks..
    gussev,
    U got my problem..!
    "that is possible, at the beginning of the next month, even at the end of this I'm going to release several JavaBeans and "JTable as a node for a JTree" bean would be available. I'll send a message to forum. "
    I'm eagerly waiting for u'r message..
    Thanks
    Saran

  • Creating a JTable with resizeable columns and Horizontal Scrollbar

    Hi,
    I would like to create a JTable with about 24 columns in it. The problem is, my ViewPort in my JScrollPane is about 3-400pixels wide, and the JTable tries to cram itself into the ViewPort. This makes the columns too tiny to read. I'd like it to do something a little more sensible, like use the PreferredSize of the columns. Can anyone point me in the right direction to keep JTable from creating scrunched up little columns, so that it creates columns that are at least partially readable? Thanks.
    BTW, I suppose I could set NO_AUTO_RESIZE but I would rather not do that. I like being able to resize columns. Basically what I want to do is control the JTable's width and not worry about the ViewPort's width.

    This made it impossible to resize columns. Works fine for me:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableHorizontal extends JFrame
        public TableHorizontal()
            JTable table = new JTable(5, 10);
            table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
            JScrollPane scrollPane = new JScrollPane( table );
            getContentPane().add( scrollPane );
            table.getColumnModel().getColumn(0).setPreferredWidth(10);
            table.getColumnModel().getColumn(1).setPreferredWidth(20);
            table.getColumnModel().getColumn(2).setPreferredWidth(30);
            table.getColumnModel().getColumn(3).setPreferredWidth(40);
            table.getColumnModel().getColumn(4).setPreferredWidth(50);
        public static void main(String[] args)
            TableHorizontal frame = new TableHorizontal();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setVisible(true);
    }

  • How do I create a JTable with some empty cells in it?

    I have a three column JTable. The first column is a String showing description. The second column contains numbers (double) and the third column also contains numbers. In some cases not all cells in a row should contain data. So for instance, I could have row one showing only description (a String in the first column), and then row two showing description (a String in the first column) and a number (a double in the second column) in columns one and two respectively. My problem is that, the data gets copied from the cells with data to the cells which are supposed to be empty. So, how do I create a JTable with some empty cells in it.

    I have tried empty strings for those values, but it did not work. My table puts objects in an arraylist called reconciliation. The arraylist takes different objects with the same super class. The code below explains. Are you suggesting I pass null to my constructor?
    JTable table = new JTable(new ReconTableModel());The method below is from the table model
    protected  List<Reconciliation> reconciliation = new ArrayList<Reconciliation>();
    protected void fillModel(){
          reconciliation.add(new CashBook("Cash Book Report"," "," "));
          reconciliation.add(new CheckingBankAccount("Checking Bank Account"," "," "));
          reconciliation.add(new BankBalance("Bank Balance As Per Bank Statement",500," "));
          reconciliation.add(new PaymentVouchers("Payment Voucher Receipt",300," "));
          reconciliation.add(new DepositVoucher("Deposit Voucher Receipt",1000," "));
          reconciliation.add(new ReconciledBalance("Reconcilied Bank Balance",1200," "));
          reconciliation.add(new BalanceAt("Bank Balance At",800," "));
          reconciliation.add(new Difference("Difference",400," "));
          Collections.sort( reconciliation, new Comparator<Reconciliation>(){
          public int compare( Reconciliation a, Reconciliation b) {
            return a.getTransactionName().compareTo( b.getTransactionName());
      }

  • Create new JTable based on selection of previous table

    Hello All,
    I want to create a sort of selection table. I have a fairly large JTable that is row selectable. I want the user to be able to select some rows, and then create a smaller table just displaying the selected rows.
    The current problem I am having (I say current b/c I'm sure more will follow) results from users rearranging the columns.
    Example) When columns are arranged as: A B C. Then the user rearranges to B A C. The getColumns() method returns the columns in the right order (B A C), but the getData() method returns the data in the old arrangement. So the data now does not match up to the column names.
    Here are the two methods I mention above (note: This class extends from JTable, so the "super" calls call back to JTable):
    * Retrieves data from table.
    public Vector getData() {
      Vector data = ((DefaultTableModel)super.getModel()).getDataVector();
      return data;
    * Retrieves the column names
    public Vector getColumns() {
      Vector fieldNames = new Vector();
      Enumeration e = super.getTableHeader().getColumnModel().getColumns();
      while(e.hasMoreElements()) {
        String name = (String)((TableColumn)e.nextElement()).getHeaderValue();
        fieldNames.add(name);
      return fieldNames;
    }I hope I made my problem clear. Thanks for any/all suggestions!

    Ah! A vector of vectors is returned from the getData call.
    I assumed is was a vector as follows:
    A -> __data for A__
    B -> __data for B__
    C -> __data for C__
    But no, its:
    Row1 -> __A B C__
    Row2 -> __A B C__
    Row3 -> __A B C__
    etc...
    So after trying to code, I realized what I was doing. I was rearranging rows! Not columns! Why would JTable set up its rows in this fashion? Wouldn't it be more efficient to have the primary vector be the order of the columns? It seems that would make things much easier. Well, that's my little rant after finally realizing that my code wasn't broken, it was doing exactly what I told it to do!

  • Fonts in PDF created from Pages doesn't present correctly on Windows PCs

    The fonts documents that I'm creating in Pages and then converting to PDF, aren't presenting properly to people using Windows PC's. Some of the fonts are "wonky".
    What I'm doing is creating documents in Pages and then creating PDF's either by Print, save as PDF or Share, Export, PDF.
    On my MacBook and iPad the PDFs are perfect. However when viewed on Windows, they are wonky. Not all of the document/fonts are messed up. An example of a font that appears wonky, is Baskerville.
    I've used Adobe Reader to check whether the fonts appear embedded, and they seem to be there.
    This is a huge problem for me because, at the moment, all documents I'm sending to clients who use Windows, are looking really unprofessional.
    Any suggestions or solutions?
    Anyone else seen this?

    Since the problem is to be seen in Adobe Reader for Microsoft Windows, you might want to ask a forum at Adobe.com. There is no way of knowing what you mean by 'wonky.'
    The principle is that the scalable glyph shapes in the font program are subset and the subset of glyph shapes is inserted with the start point and the set widths that are used for drawing ('showing') the glyphs in the graphic co-ordinate geometry that you have defined in the document setup dialogue. There are two basic ways to embed Apple SFNT-housed TrueType (which is what your Baskerville is, if it is the one that installs with the system software) in Adobe PDF, either as several font programs each with a max of 256 glyphs or as a single font program within which there are several tiled font programs. Both are basically hacks, because Adobe PDF cannot contain the Unicode and TrueType glyph run complete, the way Adobe PDF 1.3 and higher can in fact contain the ICC ColorWorld complete. But that is a monster bug matrix that is beyond this discussion - only that you need to understand what you are seeing in the dialogue for embedded fonts shown in Adobe Acrobat products. That is, the fonts are always re-encoded and are never the original, intact fonts.
    Best,
    Henrik Holmegaard
    would-be technical writer

  • How to create an EXCEL file in Presentation server

    hello experts,
    please suggest  me a solution for the following problem :
    I have an internal table with some data.
    how can i create an excel file with that data in Presentation Server.
    Thanks & Regards
    sasi.

    hi,
        u can use FM: 'DOWNLOAD'.
    it will prompt u for destination - just give the requd filename and extension.                      
    Ex:
        call function 'DOWNLOAD'
             exporting
                 filename                =
                  filetype                = 'DAT'
             tables
                  data_tab                = tb_output
                  fieldnames              = tb_fld_nam
             exceptions
                  invalid_filesize        = 1
                  invalid_table_width     = 2
                  invalid_type            = 3
                  no_batch                = 4
                  unknown_error           = 5
                  gui_refuse_filetransfer = 6
                  customer_error          = 7
                  others                  = 8.
    where,
             tb_output = internal table having the fields which u want in the O/P
    Ex:
             data:  begin of tb_output occurs 0,
                               name_1(20)      type c,
                               name_2(20)      type c,
                       end of tb_output.
             tb_fld_nam = Field headings :
    Ex:
             data:  begin of tb_fld_nam occurs 0,
                            name(25)              type c,
                      end of tb_fld_nam.
                     tb_fld_nam-name = 'Name 1'.
                     append tb_fld_nam.
                     tb_fld_nam-name = 'Name 2'.
                     append tb_fld_nam.
    Thanx & Regards,
    Ajoy

  • How to create a constant variable(or presentation variable) inside request

    hi i have a prompt with from_month and to_month(both i have declared as presentation variable)
    i need transactions of from_month to be saved as presentation variable say from_data and use it for further processing.
    I tried the below one
    created one more prompt with column function as 'filter transactions using from_month' and saved it as from_data presentation variable.
    but i do not know how to hide the second prompt from dashboard.
    Please help.

    Hi,
    try like this. this is a working solution.
    in your report add a field with below formula. Remember you need month_id not month_name i.e. a no. needs to be passed. this will give you the value of the month you selected in your prompt in all the rows.
    RSUM(case when Calendar_Month = @{Month_ID}{201212} then tot_txn end)
    in your variance use like
    tot_txn - RSUM(case when Calendar_Month = @{Month_ID}{201201} then tot_txn end)/ tot_txn
    create a filter like month_id>= @{Month_ID}{201201}

  • How to create new user for OBIEE presentation service

    Hello Guys
    I now only have 2 users on my OBIEE, demo1, demo2.. Now I'd like to create a new user call A and make this new user able to log on to OBIEE presenation service..
    So I went to the RPD admin tool and created new user there and gave password. It was done online mode and I checked out..
    I am able to login to admin tool with the new user account, but when I go to presentation service, I am not able to see this new user nor would I be able to log on using the new user account..
    So how does this work? If I wanted to create a new user and let it access dashboard, I'd I do it
    Any pointer will be greatly appreciated
    Thanks

    Hi.
    actually there is no option available in presentation service to create user. There you can just delete user and create and delete the groups.
    Anyhow, you said you have created a user in rpd.
    To see this user in answers, you must login into answers with this user once.
    are you able to login with the newly created user?
    (As you said you done the creation of user in online mode, this may not effect to the answers)
    if not, just login with administrator into answers, click on reload server metadata, then log off from there.
    Now, try to login with the new user. You may able to login.
    OR
    just restart your BI Server services.

  • Creating a gridlayout of jlabels and jbuttons in a JPanel

    The assignment:
    "Create a JPanel that contains an 8x8 checkerboard. Make all of the red squares JButtons and be sure to add them to the JPanel. Make all of the black squares JLabels and add them to the JPanel. Don't forget, you must use the add method to attach the JPanel to the JApplet's contentPane but that there is no contentPane for a JPanel. Be sure to set up any interfaces to handle the JButtons. Use a GridLayout to position and size each of the components instead of absolute locations and sizes."
    This assignment introduces the JPanel to me for the first time, I have not seen what the JDialog and JFrame are.
    What I have:
    import java.awt.*;
    import javax.swing.*;
    * Class CheckerBoard - write a description of the class here
    * @author (your name)
    * @version (a version number)
    public class CheckerBoard extends JPanel
        JButton redSquare;
        JLabel blackSquare;
         * Called by the browser or applet viewer to inform this JApplet that it
         * has been loaded into the system. It is always called before the first
         * time that the start method is called.
        public void init()
            JPanel p = new JPanel();
            setLayout(new GridLayout(8,8));
            setSize(512,512);
            ImageIcon red = new ImageIcon("GUI-006-RedButton.png");
            ImageIcon black = new ImageIcon("GUI-006-BlackSquare.png");
            blackSquare = new JLabel(black);
            blackSquare.setSize(64,64);
            redSquare = new JButton(red);
            redSquare.setSize(64,64);
            for (int i = 0; i < 64; i++) {
                if ((i % 2) == 1)
                    add(blackSquare);
                else
                   add(redSquare);
            // this is a workaround for a security conflict with some browsers
            // including some versions of Netscape & Internet Explorer which do
            // not allow access to the AWT system event queue which JApplets do
            // on startup to check access. May not be necessary with your browser.
            JRootPane rootPane = this.getRootPane();   
            rootPane.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
    }After successfully compiling it when I try to run it there appears to be nothing to run. I've tried messing around with content panes but I'm not sure if I need to add one for this assignment at all.

    Some suggestions:
    1) First and foremost, read about JPanels, JApplets, and JFrames. None of the help you can get here will substitute for your applying yourself towards this, absolutely none, and judging by your code, you have your work cut out for you.
    2) Don't have your JPanel initialize with an init method, that's what Applets and JApplets do. Instead have it initialize with a proper constructor.
    3) I'm wondering if your "workaround" code belongs in the JApplet that contains the JPanel and not in the JPanel. It has nothing to do with the JPanel's mission. For instance, what if you later decide to place this panel into a JFrame?
    4) Avoid "setSize", and if at all possible, use "setPreferredSize" instead. You are working with LayoutManagers who do the size setting. You are best served by suggesting the size to them.
    5) Please ask specific questions. Just dumping your code without a question is considered quite rude here. We are all volunteers. If you want our free advice, you really should be considerate enough to make it easy for us to help you.
    Good luck.
    Edited by: Encephalopathic on Dec 21, 2007 6:14 PM

  • Creating a interactive prerendered 3d presentation.

    Hello I'm creating a presentation in adobe flash pro cs5. I wanted a interface of buttons that would if you clicked on one of them play a prerendered movie clip that would after it has been played be jumping to another keyframe and stay on that keyframe. Then from that keyframe you would be able to play another video clip and jump to another keyframe. To create the illusion of 3d by using prerendered clips. I hope you get what I mean.
    Anyway in order to do this I need a few commands for controlling the timeline. I think it's the commands for jumping to a certain frame then stopping at a certain frame.
    Two commands I can't find in the confusing menu of action commands. Also for a file like this what would be the best type of document to use. Flash project I presume?
    Sorry I'm very new to flash...

    To jump to a new frame you can use gotoAndStop(...) or gotoAndPlay(...), where "..." represents a frame numnber or label, and if they happen to be adjacent frames you can use nextFrame() or prevFrame() (which act like gotoAndStop() commands). 
    If you happen to be trying to tell something other than the current timeline to go to a new frame, then you need to target the intended object/timeline.
    This can tell the timeline that holds the object that contains this line to move to a new frame...
         MovieClip(parent).gotoAndPlay(...); 
    This tells an object on the same timeline to move to a new frame...
         objectInstanceName.gotoAndStop(...);
    If you are after something more complex than that then I have probably missed the point of your posting... I don't see where 3D fits into the discussion of moving to frames.

Maybe you are looking for