2
현재 활성화 된 줄의 글 머리 기호 배경을 강조 표시하려고하지만 글 머리 기호의 배경색 만 설정하면 숫자 부분 만 강조 표시됩니다. 총알이 차지하고있는 모든 공간을 강조하고 싶습니다.SWT Bullet 전체 배경 변경
은 너무 오른쪽에있는 모든뿐만 아니라 강조하는 9의 왼쪽에 공간과 아마 조금 싶습니다.
내가 지금까지
@Override
public void lineGetStyle(LineStyleEvent event) {
// Set the line number
int activeLine = styledText.getLineAtOffset(styledText.getCaretOffset());
int currentLine = styledText.getLineAtOffset(event.lineOffset);
event.bulletIndex = currentLine;
int width = 36;
if (styledText.getLineCount() > 999)
width = (int) ((Math.floor(Math.log10(styledText.getLineCount()))+1) * 12);
// Set the style, 12 pixles wide for each digit
StyleRange style = new StyleRange();
style.metrics = new GlyphMetrics(0, 0, width);
if (activeLine == currentLine) {
style.background = highlightedLine;
}
style.foreground = mainBackground;
// Create and set the bullet
event.bullet = new Bullet(ST.BULLET_NUMBER, style);
event.styles = matchKeywords(event);
}
입니다 무엇을 얻기 위해 사용하고 코드이 가능합니까?
나는 이것을 추가하려고했지만 리스너는 결코 호출되지 않습니다. 그게 왜 어떤 아이디어일까요? – EmbMicro