12-03-2012 07:20 AM
Hello sir
can you please tell me how to implement custom listfield having alternate color in alternate row.actually this type of list field used to many time so i want to make custime listfield
Thanks is advance.
Solved! Go to Solution.
12-03-2012 07:28 AM
12-03-2012 07:30 AM
any other example..![]()
12-03-2012 07:39 AM
12-03-2012 07:42 AM
How to make column in list as in my in listfield..?
12-03-2012 07:49 AM
Thanks sir how to make coloumn
12-03-2012 08:00 AM
12-03-2012 11:06 AM
Thanks sir ...
more suggestion to clear this thing..i
12-03-2012 12:15 PM
12-04-2012 01:22 AM
hello
i am using the download code (customcolorList.zip).here Here i change some thing in paint method .actually i need different colour in each colum also as i display in my image (previous post).But when focus is coming in row it paint the whole column (didn't display 2 column ) . i only change in paint method.
public void paint(Graphics graphics) {
// Get the current clipping region as it will be the only part that
// requires repainting
XYRect redrawRect = graphics.getClippingRect();
if (redrawRect.y < 0) {
throw new IllegalStateException("Clipping rectangle is wrong.");
}
// Determine the start location of the clipping region and end.
int rowHeight = getRowHeight();
int curSelected;
// If the ListeField has focus determine the selected row.
if (hasFocus) {
curSelected = getSelectedIndex();
} else {
curSelected = -1;
}
int startLine = redrawRect.y / rowHeight;
int endLine = (redrawRect.y + redrawRect.height - 1) / rowHeight;
endLine = Math.min(endLine, getSize() - 1);
int y = startLine * rowHeight;
// Setup the data used for drawing.
int[] yInds = new int[] { y, y, y + rowHeight, y + rowHeight };
int[] xInds = new int[] { 0, getPreferredWidth(), getPreferredWidth(),
0 };
// Get the ListFieldCallback.
// This sample assumes that the object returned by the get
// method of the callback is a String or has a toString method.
// If this is not the case you will need to add the required logic
// for your implementation.
ListFieldCallback callBack = this.getCallback();
// Draw each row
for (; startLine <= endLine; ++startLine) {
if (startLine % 2 == 0 && startLine != curSelected) {
// Draw the even and non selected rows.
graphics.setColor(LIGHT_TEXT);
graphics.drawShadedFilledPath(xInds, yInds, null, cols, null);
graphics.setColor(DARK_TEXT);
graphics.drawText((String) callBack.get(this, startLine), 0,
yInds[0]);
graphics.setColor(DARK_TEXT);
graphics.drawText((String) callBack.get(this, startLine), 200,
yInds[0]);
//graphics.setColor(DARK_TEXT);
} else {
// Draw the odd or selected rows.
graphics.setColor(DARK_TEXT);
graphics.drawText((String) callBack.get(this, startLine), 0,
yInds[0]);
}
// Assign new values to the y axis moving one row down.
y += rowHeight;
yInds[0] = y;
yInds[1] = yInds[0];
yInds[2] = y + rowHeight;
yInds[3] = yInds[2];
}
}