Blackberry JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE Průvodce řešením problémů Strana 29

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 286
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 28
29
1: Creating UIs
Create custom layout managers
Task Steps
Create a custom layout manager. > Extend the Manager class or one of its subclasses.
class DiagonalManager extends Manager {
public DiagonalManager(long style){
super(style);
}
...
}
Return a preferred field width. >Override getPreferredWidth() so that it returns the preferred field width for the manager.
public int getPreferredWidth() {
int width = 0;
int numberOfFields = getFieldCount();
for (int i=0; i<numberOfFields; ++i) {
width += getField(i).getPreferredWidth();
}
return width;
}
Organize more than one TextField or
Manager object.
> Override the respective getPreferredWidth() methods for the TextField or Manager
objects.
Organize multiple TextFields
horizontally.
>Override layout().
Return a preferred field height. >Override getPreferredHeight() so that it returns the preferred field height for the
manager.
public int getPreferredHeight() {
int height = 0;
int numberOfFields = getFieldCount();
for (int i=0; i<numberOfFields; ++i) {
height += getField(i).getPreferredHeight();
}
return height;
}
Zobrazit stránku 28
1 2 ... 24 25 26 27 28 29 30 31 32 33 34 ... 285 286

Komentáře k této Příručce

Žádné komentáře