/* 3magic Coffee Table Tutorial 8 Tutorial8.java - Scrolling Utilities. © 1997-1999 3magic. All rights reserved worldwide. */ import java.awt.*; import java.applet.*; import java.util.*; import java.awt.event.*; import CoffeeTable.Grid.*; public class Tutorial8 extends Applet implements ActionListener { // Our grid. GridPanel fGrid; // Rows and Columns; int fNumCols = 100; int fNumRows = 500; // Some Edit Text fields. TextField fJumpCol = new TextField("Col"); TextField fJumpRow = new TextField("Row"); // Some Buttons. int fNumButtons = 3; Button fButton[] = new Button[fNumButtons]; String buttonLabels[] = { "Jump To Cell", "Jump To Col", "Jump To Row"}; // Message area. Label fMsg = new Label("Enter a column and row and press one of the buttons."); /** * Initialize. */ public void init() { // Let's use a BorderLayout to help us with the user input areas. setLayout(new BorderLayout()); // Instantiate a new Grid Panel with the specified rows and columns // and other defaults like cell selection, row and column headers, // row and column lines enabled and with scrollbars. fGrid = new GridPanel(fNumRows, fNumCols); // Add in the DEMO_TEXT mode. fGrid.setFlags(fGrid.getFlags() | GridPanel.DEMO_TEXT); // Show the row headers. fGrid.setRowHeaderWidth(40); fGrid.setRowNumbers(true); // Let's use Times, plain, 9-point. fGrid.setGridFont(new Font("TimesRoman", Font.PLAIN, 9)); // Add the grid into the applet panel add("Center", fGrid); // Add the message area. add("North", fMsg); // Create a panel for our widgets. Panel panel = new Panel(); // Add the user input fields. panel.add(new Label("Col=")); panel.add(fJumpCol); panel.add(new Label("Row=")); panel.add(fJumpRow); // Add some control buttons. for (int i = 0; i