📄 display.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Wed Sep 24 14:57:49 PDT 2003 -->
<TITLE>
MID Profile: Class Display
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Display.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<strong>MID Profile</strong></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../javax/microedition/lcdui/DateField.html"><B>PREV CLASS</B></A>
<A HREF="../../../javax/microedition/lcdui/Displayable.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="Display.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.microedition.lcdui</FONT>
<BR>
Class Display</H2>
<PRE>
<A HREF="../../../java/lang/Object.html">java.lang.Object</A>
|
+--<B>javax.microedition.lcdui.Display</B>
</PRE>
<HR>
<DL>
<DT>public class <B>Display</B><DT>extends <A HREF="../../../java/lang/Object.html">Object</A></DL>
<P>
<code>Display</code> represents the manager of the display and input devices of the system. It includes methods for retrieving properties of the device and for requesting that objects be displayed on the device. Other methods that deal with device attributes are primarily used with <A HREF="../../../javax/microedition/lcdui/Canvas.html"><CODE>Canvas</CODE></A> objects and are thus defined there instead of here. <p> There is exactly one instance of Display per <A HREF="../../../javax/microedition/midlet/MIDlet.html"><CODE>MIDlet</CODE></A> and the application can get a reference to that instance by calling the <A HREF="../../../javax/microedition/lcdui/Display.html#getDisplay(javax.microedition.midlet.MIDlet)"><CODE>getDisplay()</CODE></A> method. The application may call the <code>getDisplay()</code> method at any time during course of its execution. The <code>Display</code> object returned by all calls to <code>getDisplay()</code> will remain the same during this time. <p> A typical application will perform the following actions in response to calls to its <code>MIDlet</code> methods: <UL> <LI><STRONG>startApp</STRONG> - the application is moving from the paused state to the active state. Initialization of objects needed while the application is active should be done. The application may call <A HREF="../../../javax/microedition/lcdui/Display.html#setCurrent(javax.microedition.lcdui.Displayable)"><CODE>setCurrent()</CODE></A> for the first screen if that has not already been done. Note that <code>startApp()</code> can be called several times if <code>pauseApp()</code> has been called in between. This means that one-time initialization should not take place here but instead should occur within the <code>MIDlet's</code> constructor. </LI> <LI><STRONG>pauseApp</STRONG> - the application may pause its threads. Also, if it is desirable to start with another screen when the application is re-activated, the new screen should be set with <code>setCurrent()</code>.</LI> <LI><STRONG>destroyApp</STRONG> - the application should free resources, terminate threads, etc. The behavior of method calls on user interface objects after <code>destroyApp()</code> has returned is undefined. </li> </UL> <p> <P>The user interface objects that are shown on the display device are contained within a <A HREF="../../../javax/microedition/lcdui/Displayable.html"><CODE>Displayable</CODE></A> object. At any time the application may have at most one <code>Displayable</code> object that it intends to be shown on the display device and through which user interaction occurs. This <code>Displayable</code> is referred to as the <em>current</em> <code>Displayable</code>. </p> <P>The <code>Display</code> class has a <A HREF="../../../javax/microedition/lcdui/Display.html#setCurrent(javax.microedition.lcdui.Displayable)"><CODE>setCurrent()</CODE></A> method for setting the current <code>Displayable</code> and a <A HREF="../../../javax/microedition/lcdui/Display.html#getCurrent()"><CODE>getCurrent()</CODE></A> method for retrieving the current <code>Displayable</code>. The application has control over its current <code>Displayable</code> and may call <code>setCurrent()</code> at any time. Typically, the application will change the current <code>Displayable</code> in response to some user action. This is not always the case, however. Another thread may change the current <code>Displayable</code> in response to some other stimulus. The current <code>Displayable</code> will also be changed when the timer for an <A HREF="../../../javax/microedition/lcdui/Alert.html"><CODE>Alert</CODE></A> elapses. </P> <p> The application's current <code>Displayable</code> may not physically be drawn on the screen, nor will user events (such as keystrokes) that occur necessarily be directed to the current <code>Displayable</code>. This may occur because of the presence of other <code>MIDlet</code> applications running simultaneously on the same device. </p> <P>An application is said to be in the <em>foreground</em> if its current <code>Displayable</code> is actually visible on the display device and if user input device events will be delivered to it. If the application is not in the foreground, it lacks access to both the display and input devices, and it is said to be in the <em>background</em>. The policy for allocation of these devices to different <code>MIDlet</code> applications is outside the scope of this specification and is under the control of an external agent referred to as the <em>application management software</em>. </p> <P>As mentioned above, the application still has a notion of its current <code>Displayable</code> even if it is in the background. The current <code>Displayable</code> is significant, even for background applications, because the current <code>Displayable</code> is always the one that will be shown the next time the application is brought into the foreground. The application can determine whether a <code>Displayable</code> is actually visible on the display by calling <A HREF="../../../javax/microedition/lcdui/Displayable.html#isShown()"><CODE>isShown()</CODE></A>. In the case of <code>Canvas</code>, the <A HREF="../../../javax/microedition/lcdui/Canvas.html#showNotify()"><CODE>showNotify()</CODE></A> and <A HREF="../../../javax/microedition/lcdui/Canvas.html#hideNotify()"><CODE>hideNotify()</CODE></A> methods are called when the <code>Canvas</code> is made visible and is hidden, respectively.</P> <P> Each <code>MIDlet</code> application has its own current <code>Displayable</code>. This means that the <A HREF="../../../javax/microedition/lcdui/Display.html#getCurrent()"><CODE>getCurrent()</CODE></A> method returns the <code>MIDlet's</code> current <code>Displayable</code>, regardless of the <code>MIDlet's</code> foreground/background state. For example, suppose a <code>MIDlet</code> running in the foreground has current <code>Displayable</code> <em>F</em>, and a <code>MIDlet</code> running in the background has current <code>Displayable</code> <em>B</em>. When the foreground <code>MIDlet</code> calls <code>getCurrent()</code>, it will return <em>F</em>, and when the background <code>MIDlet</code> calls <code>getCurrent()</code>, it will return <em>B</em>. Furthermore, if either <code>MIDlet</code> changes its current <code>Displayable</code> by calling <code>setCurrent()</code>, this will not affect the any other <code>MIDlet's</code> current <code>Displayable</code>. </p> <P>It is possible for <code>getCurrent()</code> to return <code>null</code>. This may occur at startup time, before the <code>MIDlet</code> application has called <code>setCurrent()</code> on its first screen. The <code>getCurrent(</code>) method will never return a reference to a <code>Displayable</code> object that was not passed in a prior call to <code>setCurrent()</code> call by this <code>MIDlet</code>. </p> <a name="systemscreens"></a> <h3>System Screens</h3> <P> Typically, the current screen of the foreground <code>MIDlet</code> will be visible on the display. However, under certain circumstances, the system may create a screen that temporarily obscures the application's current screen. These screens are referred to as <em>system screens.</em> This may occur if the system needs to show a menu of commands or if the system requires the user to edit text on a separate screen instead of within a text field inside a <code>Form</code>. Even though the system screen obscures the application's screen, the notion of the current screen does not change. In particular, while a system screen is visible, a call to <code>getCurrent()</code> will return the application's current screen, not the system screen. The value returned by <code>isShown()</code> is <code>false</code> while the current <code>Displayable</code> is obscured by a system screen. </p> <p> If system screen obscures a canvas, its <code>hideNotify()</code> method is called. When the system screen is removed, restoring the canvas, its <code>showNotify()</code> method and then its <code>paint()</code> method are called. If the system screen was used by the user to issue a command, the <code>commandAction()</code> method is called after <code>showNotify()</code> is called. </p> <p>This class contains methods to retrieve the prevailing foreground and background colors of the high-level user interface. These methods are useful for creating <CODE>CustomItem</CODE> objects that match the user interface of other items and for creating user interfaces within <CODE>Canvas</CODE> that match the user interface of the rest of the system. Implementations are not restricted to using foreground and background colors in their user interfaces (for example, they might use highlight and shadow colors for a beveling effect) but the colors returned are those that match reasonably well with the implementation's color scheme. An application implementing a custom item should use the background color to clear its region and then paint text and geometric graphics (lines, arcs, rectangles) in the foreground color.</p>
<P>
<DL>
<DT><B>Since: </B><DD>MIDP 1.0</DD>
</DL>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Display.html#ALERT">ALERT</A></B></CODE>
<BR>
Image type for <code>Alert</code> image.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Display.html#CHOICE_GROUP_ELEMENT">CHOICE_GROUP_ELEMENT</A></B></CODE>
<BR>
Image type for <code>ChoiceGroup</code> element image.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Display.html#COLOR_BACKGROUND">COLOR_BACKGROUND</A></B></CODE>
<BR>
A color specifier for use with <code>getColor</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Display.html#COLOR_BORDER">COLOR_BORDER</A></B></CODE>
<BR>
A color specifier for use with <code>getColor</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Display.html#COLOR_FOREGROUND">COLOR_FOREGROUND</A></B></CODE>
<BR>
A color specifier for use with <code>getColor</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Display.html#COLOR_HIGHLIGHTED_BACKGROUND">COLOR_HIGHLIGHTED_BACKGROUND</A></B></CODE>
<BR>
A color specifier for use with <code>getColor</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Display.html#COLOR_HIGHLIGHTED_BORDER">COLOR_HIGHLIGHTED_BORDER</A></B></CODE>
<BR>
A color specifier for use with <code>getColor</code>.</TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -