Pytanie początkującego :-)
Mam taki kodzik:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class SimpleTableExample
extends Panel
{
// Instance attributes used in this example
private Panel topPanel;
private JTable table;
private JScrollPane scrollPane;
// Constructor of main frame
public SimpleTableExample()
{
topPanel = new Panel();
topPanel.setLayout( new BorderLayout() );
String columnNames[] = { "Column 1", "Column 2", "Column 3" };
String dataValues[][] =
{
{ "12", "234", "67" },
{ "-123", "43", "853" },
{ "93", "89.2", "109" },
{ "279", "9033", "3092" },
{ "12", "234", "67" },
{ "-123", "43", "853" },
{ "93", "89.2", "109" },
{ "12", "234", "67" },
{ "-123", "43", "853" },
{ "93", "89.2", "109" },
{ "279", "9033", "3092" }
};
// Create a new table instance
table = new JTable( dataValues, columnNames );
// Add the table to a scrolling pane
scrollPane = new JScrollPane( table );
topPanel.add( scrollPane, BorderLayout.CENTER);
add(topPanel);
}
}
public class tabela1 extends java.applet.Applet {
SimpleTableExample mainFrame;
public void init() {
mainFrame = new SimpleTableExample();
add(mainFrame);
}
}
Tabelka sie wyświetla bardzo ładnie, ale niestety brak suwaków.
O czym zapomniałem ?