나는 블랙 베리 UI 개발을 처음 접했고 비트 맵에 힌트 상자를 추가 할 수있는 방법이 있는지 알고 싶습니까? 단지 HTML의 요소에 title 속성처럼Blackberry UI 힌트 상자
0
A
답변
2
다음과 같은 TooltipScreen를 사용하여 다음과 같은 방법으로 화면에 필드를 추가 할 수 있습니다
add(new ButtonField(“myButton”), “My Tooltip text”);
TooltipScreen는
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.XYRect;
import net.rim.device.api.ui.container.MainScreen;
public class TooltipScreen extends MainScreen {
TooltipScreen screen = this;
boolean doRedraw = false;//prevent infinte redrawing
Vector tooltips = new Vector();//vector to hold tooltip strings
private Timer tooltipTimer = new Timer();
private TimerTask tooltipTask;
boolean alive = false;//is the tooltip alive? used to pop it after our timeout
int count = 0;//used to calculate time tooltip is displayed
//tooltip popup colours:
int backgroundColour = 0xeeeeee;
int borderColour = 0xaaaaaa;
int fontColour = 0x666666;
//the tooltip:
String tooltip;
int tooltipWidth;
int yCoord;
int xCoord;
//region parameters:
XYRect contentArea;
int contentBottom;
int contentRight;
public TooltipScreen() {
super();
//when timeout reaches 100ms*20 ie. 2seconds set alive to false and redraw screen:
tooltipTask = new TimerTask() {
public void run() {
if (alive) {
count++;
if (count == 20) {
alive = false;
invalidate();
}
}
}
};
tooltipTimer.scheduleAtFixedRate(tooltipTask, 100, 100);
}
//override add method adds an empty string to tooltip vector:
public void add(Field field) {
tooltips.addElement("");
super.add(field);
}
//custom add method for fields with tooltip: add(myField, "myTooltip");
public void add(Field field, String tooltip) {
super.add(field);
tooltips.addElement(tooltip);
}
public void setColours(int backgroundColour, int borderColour, int fontColour) {
this.backgroundColour = backgroundColour;
this.borderColour = borderColour;
this.fontColour = fontColour;
}
//reset everything when user changes focus,
//possibly needs logic to check field has actually changed (for listfields, objectchoicefields etc etc)
protected boolean navigationMovement(int dx, int dy, int status, int time) {
count = 0;
alive = true;
doRedraw = true;
return super.navigationMovement(dx, dy, status, time);
}
protected void paint(Graphics graphics) {
super.paint(graphics);
if (alive) {
Field focusField = getFieldWithFocus();
tooltip = (String) tooltips.elementAt(screen.getFieldWithFocusIndex());
//don't do anything outside the norm unless this field has a tooltip:
if (!tooltip.equals("")) {
//get the field content region, this may fall inside the field actual region/coordinates:
contentArea = focusField.getContentRect();
contentBottom = contentArea.y + contentArea.height;
contentRight = contentArea.x + contentArea.width;
//+4 to accomodate 2 pixel padding on either side:
tooltipWidth = graphics.getFont().getAdvance(tooltip) + 4;
yCoord = contentBottom - focusField.getManager().getVerticalScroll();
//check the tooltip is being drawn fully inside the screen height:
if (yCoord > (getHeight() - 30)) {
yCoord = getHeight() - 30;
}
//check the tooltip doesn't get drawn off the right side of the screen:
if (contentRight + tooltipWidth < getWidth()) {
xCoord = contentRight;
} else {
xCoord = getWidth() - tooltipWidth;
}
//draw the tooltip
graphics.setColor(backgroundColour);
graphics.fillRect(xCoord, yCoord, tooltipWidth, 30);
graphics.setColor(borderColour);
graphics.drawRect(xCoord, yCoord, tooltipWidth, 30);
graphics.setColor(fontColour);
graphics.drawText(tooltip, xCoord + 2, yCoord);
}
}
//doRedraw logic prevents infinite loop
if (doRedraw) {
//System.out.println("redrawing screen: " + System.currentTimeMillis());
screen.invalidate();
doRedraw = false;
}
}
}
+0
thnx rfsk2010이 문제는 내 문제를 해결합니다 –
+0
다행 이군요. – rfsk2010
관련 문제
- 1. Blackberry 고급 UI 라이브러리
- 2. Blackberry UI building tool
- 3. 모달 대화 상자 Jquery UI Blackberry Curve 문제
- 4. BlackBerry 용 UI 테스트 도구
- 5. BlackBerry Cascades UI 파일 선택
- 6. Dreamweaver 5.5의 CSS 힌트 힌트
- 7. jQuery를 UI 대화 상자
- 8. jQuery를 UI 대화 상자
- 9. Jquery UI 대화 상자
- 10. JQUERY UI 대화 상자
- 11. JQuery UI 모달 상자
- 12. Jquery UI 슬라이더와 Jquery UI 대화 상자
- 13. Blackberry ListField에 UI 구성 요소 추가
- 14. Blackberry UI - 텍스트 내에 링크를 포함하는 방법
- 15. Blackberry OS 6.0 용 UI 처리기가 있습니까
- 16. JPA에 대한 최대 절전 모드 힌트 힌트
- 17. ListBox 긴 항목 힌트
- 18. 워터 마크 힌트 및 제출 된 값으로 입력 텍스트 상자
- 19. 사용자가 입력하는 동안 힌트 상자 또는 툴팁을 표시하려면 어떻게합니까?
- 20. 투명한 jQuery UI 대화 상자
- 21. 링크가있는 jquery UI 대화 상자
- 22. PackageMaker Custom UI 대화 상자
- 23. jquery UI 대화 상자 확장
- 24. jQuery-UI 대화 상자 업데이트
- 25. jQuery UI 대화 상자 충돌
- 26. jQuery UI 대화 상자 - 애니메이션
- 27. jQuery-UI 재사용 대화 상자
- 28. 타이밍 jQuery UI 대화 상자
- 29. jQuery UI 대화 상자 링크
- 30. 닫기 jQuery를 UI 대화 상자
당신은을 사용하여 작업을 수행 할 수 있습니다 'BitmapField'와'LabelField'를 선택하여'VerticalFieldManger' 또는'HorizontalFieldManager'에 추가하십시오. 또한 사용자 정의'Field'를 작성할 수 있습니다. – Rupak
귀하의 의견을 주셔서 감사합니다 Rupak, 실제로 내 BitMapField 내 화면 에서이 BitmapField 때 초점을 맞춘 또는 호버, 그냥이 페이지에서 트위터, 페이 스북 또는 Google + 아이콘에 마우스를 이동 같은 타이틀을 표시하는 것입니다 JDE6을 사용하고 있습니다 –