Results 1 to 3 of 3
  1. #1
    opeboy is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Is this right to change the labels [row][2] into double?

    String x = Double.parseDouble(labels[row][2]);?
    I know this is a kinda of cross post but I need to do this for my final project ..



    Java Code:
    JLabel[][] labels = new JLabel[5][3];
            // index which row I am at
            int row = 0;
             
            DisplayPanel() {
                // 6 rows and 3 columns
                super(new GridLayout(6, 3, 5, 5));
                // add the 3 header
                for(int i = 0; i < header.length; ++i)
                    add(new JLabel(header[i]));
                // the other JLabel. Each row
                for(int i = 0; i < labels.length; ++i) {
                    // each columns
                    for(int j = 0; j < labels[i].length; ++j) {
                        labels[i][j] = new JLabel("");
                        labels[i][j].setOpaque(true);
                        labels[i][j].setBackground(Color.WHITE);
                        add(labels[i][j]);
                    }
                }
            }
            // adds the new entry into the next one
            void addFiedls() {
                if(row == labels.length)
                    return;              // sorry no more room
                labels[row][0].setText(id.getText());
                labels[row][1].setText(name.getText());
                labels[row][2].setText(sales.getText());
                ++row;
    Last edited by opeboy; 09-25-2012 at 05:41 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Is this right to change the labels [row][2] into double?

    Quote Originally Posted by opeboy View Post
    I know this is a kinda of cross post
    No 'kinda' about it.
    How Can I Transfer The Data To Other Txtfield When Click Submit - Java | Dream.In.Code - Page 2

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    opeboy is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Re: Is this right to change the labels [row][2] into double?

    sigh.......ok
    Last edited by opeboy; 09-25-2012 at 06:01 PM.

Similar Threads

  1. GUI labels allignment
    By dragon_baby in forum New To Java
    Replies: 2
    Last Post: 06-17-2012, 06:32 PM
  2. Change backgroundcolor of Labels
    By Jan D in forum New To Java
    Replies: 2
    Last Post: 01-21-2012, 11:13 PM
  3. Replies: 1
    Last Post: 01-03-2012, 12:16 AM
  4. Printing labels to A4
    By eggy524 in forum New To Java
    Replies: 3
    Last Post: 09-23-2010, 05:53 PM
  5. Replies: 6
    Last Post: 03-17-2009, 03:23 AM

Posting Permissions

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