[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[jfriends] BorderItemPainterのthis.painter == null (Re: JDK1.2.2でHGridのセルが見えない)
えんどうです。
HGrid#addNotify() は正常に呼ばれているようです。
>>higa.jhcl.view.TextItemPainter のソースを調べてますが、まだ解明できません。
HGrid#panit()
↓
GridView#paint()
↓
HPanel#paint()
↓
BorderItemPainter#paint() と調べて、
BorderItemPainter の this.paint == null なので何も描画されないことが判明しました。
99 public void paint(Object data, Graphics g,
100 Rectangle bounds, int state, ItemPaintSite site) {
101
102 Rectangle clip = g.getClipBounds();
103 if (clip == null) {
104 return;
105 }
106
107 g.clipRect(bounds.x, bounds.y, bounds.width, bounds.height);
108 drawEdge(g, bounds, edge);
109
110 System.out.println("BorderItemPainter(110): painter=" + painter + ", data=" + data + ", g=" + g + ", bounds=" + bounds + ", state=" + state + ", site=" + site);
111 if (painter != null) {
112 Insets insets = getInsets();
113 int thickness = getThickness();
114 bounds.x += insets.left;
115 bounds.width -= insets.left + insets.right;
116 bounds.y += insets.top;
117 bounds.height -= insets.top + insets.bottom;
118 g.setClip(bounds.x, bounds.y, bounds.width, bounds.height);
119 System.out.println("BorderItemPainter(119): data=" + data + ", g=" + g + ", bounds=" + bounds + ", state=" + state + ", site=" + site);
120 painter.paint(data, g, bounds, state, site);
121 }
122
123 g.setClip(clip.x, clip.y, clip.width, clip.height);
124 }
実行結果はこんな感じです。(一部)
HPanel(80): panit(), g=sun.awt.windows.WGraphicsborder=higa.jhcl.view.BorderItemPainter@xxxxxxxxxx
BorderItemPainter(110): painter=null, data=null, g=sun.awt.windows.WGraphics, bounds=java.awt.Rectangle[x=0,y=0,width=392,height=200], state=0, site=higa.jhcl.control.HGrid[,0,0,392x200]
GridView(300): paint(), g=sun.awt.windows.WGraphics
なぜ BorderItemPainter の this.painter が null なのか、これから調査します。
--
ENDO Yasuyuki <yasuyuki@xxxxxxxxxx>
http://www.javaopen.org/jfriends/ (Japanese Only)