Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Create a JDialog with with changeable number of components

807569May 15 2006 — edited May 15 2006
Hi,

I want to create a JDialog with a list of JTextField's in it. There will be two buttons on also. One plus (+) button and one minus (-) button. When pressed, the window should repaint with one JTextField more or less. There will be also othe componets on the JDialog, all in a GridBagLayout. For the moment, I have something like this:
private int number;

public Test() {
    number = 4;
    initializeComponent();
    pack();
}

private void initializeComponent() {
    GridBagLayout gbl = new GridBagLayout();
    setLayout(gbl);
    GridBagConstraints gbc = new GridBagConstraints();
    // ...
    for(int i = 0; i <= number; i++) {
        gbc.gridy = i;
        gbc.gridx = 1;
        JTextField temp = new JTextField(1);
        gbl.setConstraints(temp, gbc);
        add(temp);
    }
    //....
}

// called when one of the buttons is pressed
private void changeNr(boolean plus) {
   if(plus) {
        number++;
    } else if(number > 1) {
        number--;
    }
    btn_min.setEnabled(nr > 1);

    // DOESN'T SEEM TO WORK ?!
    repaint();        
}

Comments

Hansur,
This appears to be a configuration error of the OML4R libraries on the database server. When you installed the OML4R server components on the database server, did the rqcfg.sql script report any errors?
Sherry

1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 12 2006
Added on May 15 2006
1 comment
84 views