Hello all,
Extremly 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 Applet implements ActionListener { danTable aTable; private JLabel rowLabel, colLabel; private JTextField rowNum; private JTextField colNum; public void init() { Button btnStart = new Button("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) ) ; } }
and
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...HTML Code:<!DOCTYPE HTML> <HTML> <HEAD> </HEAD> <BODY> <div> <APPLET CODE="danTeamProject" CODEBASE="." width=900 height=900> <PARAM name="boxbgcolor" value="cyan"> </APPLET> </div> </BODY> </HTML>


LinkBack URL
About LinkBacks
Reply With Quote