dd530253919a62fb40c3dfdfb578bd638642cee4
[jalviewjs.git] / src / javajs / swing / Cell.java
1 package javajs.swing;
2
3 public class Cell {
4
5         private JComponent component;
6         private int colspan;
7         private int rowspan;
8         int textAlign;
9         private GridBagConstraints c;
10
11         public Cell(JComponent btn, GridBagConstraints c) {
12                 this.component = btn;
13                 colspan = c.gridwidth;
14                 rowspan = c.gridheight;  // ignoring for now
15                 this.c = c;
16         }
17
18         public String toHTML(String id) {
19                 String style = c.getStyle(false); 
20                 return "<td id='" + id +"' " + (colspan < 2 ? "" : "colspan='" + colspan + "' ") 
21                 + style + "><span " + c.getStyle(true) + ">" + component.toHTML() + "</span></td>";
22         }
23
24
25 }