home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / text / TableView$TableCell.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.6 KB  |  61 lines

  1. package com.sun.java.swing.text;
  2.  
  3. import java.awt.Graphics;
  4. import java.awt.Rectangle;
  5. import java.awt.Shape;
  6.  
  7. public class TableView$TableCell extends BoxView {
  8.    // $FF: synthetic field
  9.    private final TableView this$0;
  10.    int row;
  11.    int col;
  12.  
  13.    public TableView$TableCell(TableView var1, Element var2) {
  14.       super(var2, 1);
  15.       this.this$0 = var1;
  16.       this.this$0 = var1;
  17.    }
  18.  
  19.    public int getColumnCount() {
  20.       return 1;
  21.    }
  22.  
  23.    public int getRowCount() {
  24.       return 1;
  25.    }
  26.  
  27.    public void setGridLocation(int var1, int var2) {
  28.       this.row = var1;
  29.       this.col = var2;
  30.    }
  31.  
  32.    public int getPreferredColumnSpan() {
  33.       return (int)super.getPreferredSpan(0) / this.getColumnCount();
  34.    }
  35.  
  36.    public void paint(Graphics var1, Shape var2) {
  37.       Rectangle var3 = var2.getBounds();
  38.       int var4 = this.getRowCount();
  39.       int var5 = this.getColumnCount();
  40.       if (var4 > 1 || var5 > 1) {
  41.          for(int var6 = 1; var6 < var5; ++var6) {
  42.             var3.width += this.this$0.getColumnSpan(this.col + var6);
  43.          }
  44.  
  45.          for(int var7 = 1; var7 < var4; ++var7) {
  46.             var3.height += this.this$0.getRowSpan(this.row + var7);
  47.          }
  48.       }
  49.  
  50.    }
  51.  
  52.    public float getPreferredSpan(int var1) {
  53.       switch (var1) {
  54.          case 0:
  55.             return (float)this.this$0.getColumnSpan(this.col);
  56.          default:
  57.             return super.getPreferredSpan(var1);
  58.       }
  59.    }
  60. }
  61.