Hello all,
Extremely new to Java an just playing around with it. I'm trying to add text fields to below a table and for some reason I can't see them. Code is below:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class danTeamProject extends JApplet implements ActionListener
{
danTable aTable;
//private JLabel rowLabel, colLabel;
private JTextField rowNum;
private JTextField colNum;
public void init() {
JButton btnStart = new JButton("Start");
this.add(btnStart);
aTable = new danTable();
this.add( aTable );
//rowLabel = new JLabel( "Enter number of rows:" );
rowNum = new JTextField( 1 );
//colLabel = new JLabel( "Enter number of columns:" );
colNum = new JTextField( 1 );
//this.add (rowLabel);
this.add (rowNum);
//this.add (colLabel);
this.add (colNum);
rowNum.addActionListener(this);
colNum.addActionListener(this);
}
public void actionPerformed(ActionEvent event) {
String s = rowNum.getText();
String sUp = s.toUpperCase();
rowNum.setText(sUp);
}
}
import javax.swing.*;
class danTable extends JPanel {
public danTable() {
Object[][] cellData = {
{"row1-col1", "row1-col2"},
{"row2-col1", "row2-col2"}};
String[] columnNames = {"col1", "col2"};
add( new JTable(cellData, columnNames) ) ;
}
}
`<!DOCTYPE HTML>
<HTML>
<HEAD>
</HEAD>
<BODY>
<div>
<APPLET
CODE="danTeamProject"
CODEBASE="."
width=900 height=900>
<PARAM name="boxbgcolor" value="cyan">
</APPLET>
</div>
</BODY>
</HTML>`
Any ideas where the problem is coming from? All the other post I've looked at recommend checking the applet size, but 900x900 should hold everything, right? Thanks in advance...
Also, I know I recently posted a question about this same program. This is simply the best forum to get fast, reliable information...