| 1970 | /// |
| 1971 | /// - `title`: the form title |
| 1972 | public void setTitle(String title) { |
| 1973 | if (toolbar != null) { |
| 1974 | toolbar.setTitle(title); |
| 1975 | // in desktop "native" mode the toolbar is hidden; push the title to the OS window title |
| 1976 | // bar instead. In "custom" mode the (visible) toolbar shows the title itself. |
| 1977 | if (isDesktopHideToolbar() && Display.getInstance().getCurrent() == this) { //NOPMD CompareObjectsWithEquals |
| 1978 | Display.getInstance().refreshNativeTitle(); |
| 1979 | } |
| 1980 | return; |
| 1981 | } |
| 1982 | |
| 1983 | this.title.setText(title); |
| 1984 | |
| 1985 | if (!Display.getInstance().isNativeTitle()) { |
| 1986 | updateIcsIconCommandBehavior(); |
| 1987 | if (isInitialized() && this.title.isTickerEnabled()) { |
| 1988 | int b = Display.getInstance().getCommandBehavior(); |
| 1989 | if (b == Display.COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_BACK || b == Display.COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_RIGHT |
| 1990 | || b == Display.COMMAND_BEHAVIOR_ICS || b == Display.COMMAND_BEHAVIOR_SIDE_NAVIGATION) { |
| 1991 | titleArea.revalidateLater(); |
| 1992 | } |
| 1993 | if (this.title.shouldTickerStart()) { |
| 1994 | this.title.startTicker(getUIManager().getLookAndFeel().getTickerSpeed(), true); |
| 1995 | } else { |
| 1996 | if (this.title.isTickerRunning()) { |
| 1997 | this.title.stopTicker(); |
| 1998 | } |
| 1999 | } |
| 2000 | } |
| 2001 | } else { |
| 2002 | if (super.contains(titleArea)) { |
| 2003 | removeComponentFromForm(titleArea); |
| 2004 | } |
| 2005 | //if the Form is already displayed refresh the title |
| 2006 | if (Display.getInstance().getCurrent() == this) { //NOPMD CompareObjectsWithEquals |
| 2007 | Display.getInstance().refreshNativeTitle(); |
| 2008 | } |
| 2009 | } |
| 2010 | } |
| 2011 | |
| 2012 | /// Adds Component to the Form's Content Pane |
| 2013 | /// |