52 private Command cmd07 = new Command("Text with 1 newline, normal label", Command.SCREEN, 1); |
52 private Command cmd07 = new Command("Text with 1 newline, normal label", Command.SCREEN, 1); |
53 private Command cmd08 = new Command("Text with 2 newline, normal label", Command.SCREEN, 1); |
53 private Command cmd08 = new Command("Text with 2 newline, normal label", Command.SCREEN, 1); |
54 // Commands for the StringItems |
54 // Commands for the StringItems |
55 private Command cmdItem1 = new Command("Itemcommand1", Command.ITEM, 1); |
55 private Command cmdItem1 = new Command("Itemcommand1", Command.ITEM, 1); |
56 private Command cmdItem2 = new Command("Itemcommand2", Command.ITEM, 1); |
56 private Command cmdItem2 = new Command("Itemcommand2", Command.ITEM, 1); |
|
57 // Command to exit the MIDlet |
|
58 private Command cmdExit = new Command("Exit", Command.EXIT, 1); |
57 |
59 |
58 /** |
60 /** |
59 * Signals the MIDlet to start and enter the Active state. |
61 * Signals the MIDlet to start and enter the Active state. |
60 */ |
62 */ |
61 protected void startApp() |
63 protected void startApp() |
101 *@param c This is the command responsible for the event. |
104 *@param c This is the command responsible for the event. |
102 *@param s Should be equal to this. |
105 *@param s Should be equal to this. |
103 */ |
106 */ |
104 public void commandAction(Command c, Displayable s) |
107 public void commandAction(Command c, Displayable s) |
105 { |
108 { |
106 if (c == cmdSI1) |
109 if(c == cmdSI1) |
107 { |
110 { |
108 // Plain type |
111 // Plain type |
109 stringItemForm.deleteAll(); |
112 stringItemForm.deleteAll(); |
110 si = new StringItem("Label", "Text"); |
113 si = new StringItem("Label", "Text"); |
111 stringItemForm.append(si); |
114 stringItemForm.append(si); |
112 } |
115 } |
113 else if (c == cmdSI2) |
116 else if(c == cmdSI2) |
114 { |
117 { |
115 // Hyperlink type |
118 // Hyperlink type |
116 stringItemForm.deleteAll(); |
119 stringItemForm.deleteAll(); |
117 si = new StringItem("Label", "Text", Item.HYPERLINK); |
120 si = new StringItem("Label", "Text", Item.HYPERLINK); |
118 stringItemForm.append(si); |
121 stringItemForm.append(si); |
119 si.addCommand(cmdItem1); |
122 si.addCommand(cmdItem1); |
120 si.addCommand(cmdItem2); |
123 si.addCommand(cmdItem2); |
121 si.setItemCommandListener(this); |
124 si.setItemCommandListener(this); |
122 } |
125 } |
123 else if (c == cmdSI3) |
126 else if(c == cmdSI3) |
124 { |
127 { |
125 // Button type |
128 // Button type |
126 stringItemForm.deleteAll(); |
129 stringItemForm.deleteAll(); |
127 si = new StringItem("Label", "Text", Item.BUTTON); |
130 si = new StringItem("Label", "Text", Item.BUTTON); |
128 stringItemForm.append(si); |
131 stringItemForm.append(si); |
129 si.addCommand(cmdItem1); |
132 si.addCommand(cmdItem1); |
130 si.addCommand(cmdItem2); |
133 si.addCommand(cmdItem2); |
131 si.setItemCommandListener(this); |
134 si.setItemCommandListener(this); |
132 } |
135 } |
133 else if (c == cmd01) |
136 else if(c == cmd01) |
134 { |
137 { |
135 si.setLabel("This is the label"); |
138 si.setLabel("This is the label"); |
136 si.setText("This is the text."); |
139 si.setText("This is the text."); |
137 } |
140 } |
138 else if (c == cmd02) |
141 else if(c == cmd02) |
139 { |
142 { |
140 si.setLabel(""); |
143 si.setLabel(""); |
141 si.setText("This is the text."); |
144 si.setText("This is the text."); |
142 } |
145 } |
143 else if (c == cmd03) |
146 else if(c == cmd03) |
144 { |
147 { |
145 si.setLabel(" "); |
148 si.setLabel(" "); |
146 si.setText("This is the text."); |
149 si.setText("This is the text."); |
147 } |
150 } |
148 else if (c == cmd04) |
151 else if(c == cmd04) |
149 { |
152 { |
150 si.setLabel("This is the label"); |
153 si.setLabel("This is the label"); |
151 si.setText("This is a very long text. " + |
154 si.setText("This is a very long text. " + |
152 "This is a very long text. " + |
155 "This is a very long text. " + |
153 "This is a very long text. " + |
156 "This is a very long text. " + |
154 "This is a very long text. " + |
157 "This is a very long text. " + |
155 "This is a very long text. " + |
158 "This is a very long text. " + |
156 "This is a very long text. " + |
159 "This is a very long text. " + |
157 "This is a very long text."); |
160 "This is a very long text."); |
158 } |
161 } |
159 else if (c == cmd05) |
162 else if(c == cmd05) |
160 { |
163 { |
161 si.setLabel("Label with 1\nnewline char"); |
164 si.setLabel("Label with 1\nnewline char"); |
162 si.setText("This is the text."); |
165 si.setText("This is the text."); |
163 } |
166 } |
164 else if (c == cmd06) |
167 else if(c == cmd06) |
165 { |
168 { |
166 si.setLabel("Label with 2\n\nnewline chars"); |
169 si.setLabel("Label with 2\n\nnewline chars"); |
167 si.setText("This is the text."); |
170 si.setText("This is the text."); |
168 } |
171 } |
169 else if (c == cmd07) |
172 else if(c == cmd07) |
170 { |
173 { |
171 si.setLabel("This is the label"); |
174 si.setLabel("This is the label"); |
172 si.setText("Text with 1\nnewline char."); |
175 si.setText("Text with 1\nnewline char."); |
173 } |
176 } |
174 else if (c == cmd08) |
177 else if(c == cmd08) |
175 { |
178 { |
176 si.setLabel("This is the label"); |
179 si.setLabel("This is the label"); |
177 si.setText("Text with 2\n\nnewline chars."); |
180 si.setText("Text with 2\n\nnewline chars."); |
178 } |
181 } |
179 else if (c == cmd09) |
182 else if(c == cmd09) |
180 { |
183 { |
181 si.setText("This is the text."); |
184 si.setText("This is the text."); |
182 si.setLabel("This is a very long label. " + |
185 si.setLabel("This is a very long label. " + |
183 "This is a very long label. " + |
186 "This is a very long label. " + |
184 "This is a very long label. " + |
187 "This is a very long label. " + |
185 "This is a very long label. " + |
188 "This is a very long label. " + |
186 "This is a very long label. " + |
189 "This is a very long label. " + |
187 "This is a very long label. " + |
190 "This is a very long label. " + |
188 "This is a very long label."); |
191 "This is a very long label."); |
|
192 } |
|
193 else if(c == cmdExit) |
|
194 { |
|
195 this.notifyDestroyed(); |
189 } |
196 } |
190 } |
197 } |
191 |
198 |
192 public void commandAction(Command c, Item i) |
199 public void commandAction(Command c, Item i) |
193 { |
200 { |