1 /*
2 * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
255 * Setting <code>echoChar</code> = <code>0</code> allows
256 * user input to be echoed to the screen again.
257 * <p>
258 * A Java platform implementation may support only a limited,
259 * non-empty set of echo characters. Attempts to set an
260 * unsupported echo character will cause the default echo
261 * character to be used instead. Subsequent calls to getEchoChar()
262 * will return the echo character originally requested. This might
263 * or might not be identical to the echo character actually
264 * used by the TextField implementation.
265 * @param c the echo character for this text field.
266 * @see java.awt.TextField#echoCharIsSet
267 * @see java.awt.TextField#getEchoChar
268 * @since JDK1.1
269 */
270 public void setEchoChar(char c) {
271 setEchoCharacter(c);
272 }
273
274 /**
275 * @deprecated As of JDK version 1.1,
276 * replaced by <code>setEchoChar(char)</code>.
277 */
278 @Deprecated
279 public synchronized void setEchoCharacter(char c) {
280 if (echoChar != c) {
281 echoChar = c;
282 TextFieldPeer peer = (TextFieldPeer)this.peer;
283 if (peer != null) {
284 peer.setEchoChar(c);
285 }
286 }
287 }
288
289 /**
290 * Sets the text that is presented by this
291 * text component to be the specified text.
292 * @param t the new text.
293 * @see java.awt.TextComponent#getText
294 */
351
352 if (columns != oldVal) {
353 invalidate();
354 }
355 }
356
357 /**
358 * Gets the preferred size of this text field
359 * with the specified number of columns.
360 * @param columns the number of columns
361 * in this text field.
362 * @return the preferred dimensions for
363 * displaying this text field.
364 * @since JDK1.1
365 */
366 public Dimension getPreferredSize(int columns) {
367 return preferredSize(columns);
368 }
369
370 /**
371 * @deprecated As of JDK version 1.1,
372 * replaced by <code>getPreferredSize(int)</code>.
373 */
374 @Deprecated
375 public Dimension preferredSize(int columns) {
376 synchronized (getTreeLock()) {
377 TextFieldPeer peer = (TextFieldPeer)this.peer;
378 return (peer != null) ?
379 peer.getPreferredSize(columns) :
380 super.preferredSize();
381 }
382 }
383
384 /**
385 * Gets the preferred size of this text field.
386 * @return the preferred dimensions for
387 * displaying this text field.
388 * @since JDK1.1
389 */
390 public Dimension getPreferredSize() {
392 }
393
394 /**
395 * @deprecated As of JDK version 1.1,
396 * replaced by <code>getPreferredSize()</code>.
397 */
398 @Deprecated
399 public Dimension preferredSize() {
400 synchronized (getTreeLock()) {
401 return (columns > 0) ?
402 preferredSize(columns) :
403 super.preferredSize();
404 }
405 }
406
407 /**
408 * Gets the minimum dimensions for a text field with
409 * the specified number of columns.
410 * @param columns the number of columns in
411 * this text field.
412 * @since JDK1.1
413 */
414 public Dimension getMinimumSize(int columns) {
415 return minimumSize(columns);
416 }
417
418 /**
419 * @deprecated As of JDK version 1.1,
420 * replaced by <code>getMinimumSize(int)</code>.
421 */
422 @Deprecated
423 public Dimension minimumSize(int columns) {
424 synchronized (getTreeLock()) {
425 TextFieldPeer peer = (TextFieldPeer)this.peer;
426 return (peer != null) ?
427 peer.getMinimumSize(columns) :
428 super.minimumSize();
429 }
430 }
431
432 /**
433 * Gets the minimum dimensions for this text field.
434 * @return the minimum dimensions for
435 * displaying this text field.
436 * @since JDK1.1
437 */
438 public Dimension getMinimumSize() {
|
1 /*
2 * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
255 * Setting <code>echoChar</code> = <code>0</code> allows
256 * user input to be echoed to the screen again.
257 * <p>
258 * A Java platform implementation may support only a limited,
259 * non-empty set of echo characters. Attempts to set an
260 * unsupported echo character will cause the default echo
261 * character to be used instead. Subsequent calls to getEchoChar()
262 * will return the echo character originally requested. This might
263 * or might not be identical to the echo character actually
264 * used by the TextField implementation.
265 * @param c the echo character for this text field.
266 * @see java.awt.TextField#echoCharIsSet
267 * @see java.awt.TextField#getEchoChar
268 * @since JDK1.1
269 */
270 public void setEchoChar(char c) {
271 setEchoCharacter(c);
272 }
273
274 /**
275 * Sets the character to be echoed when protected input is displayed.
276 * @param c the echo character for this text field
277 *
278 * @deprecated As of JDK version 1.1,
279 * replaced by <code>setEchoChar(char)</code>.
280 */
281 @Deprecated
282 public synchronized void setEchoCharacter(char c) {
283 if (echoChar != c) {
284 echoChar = c;
285 TextFieldPeer peer = (TextFieldPeer)this.peer;
286 if (peer != null) {
287 peer.setEchoChar(c);
288 }
289 }
290 }
291
292 /**
293 * Sets the text that is presented by this
294 * text component to be the specified text.
295 * @param t the new text.
296 * @see java.awt.TextComponent#getText
297 */
354
355 if (columns != oldVal) {
356 invalidate();
357 }
358 }
359
360 /**
361 * Gets the preferred size of this text field
362 * with the specified number of columns.
363 * @param columns the number of columns
364 * in this text field.
365 * @return the preferred dimensions for
366 * displaying this text field.
367 * @since JDK1.1
368 */
369 public Dimension getPreferredSize(int columns) {
370 return preferredSize(columns);
371 }
372
373 /**
374 * Returns the preferred size for this text field
375 * with the specified number of columns.
376 * @param columns the number of columns
377 * @return the preferred size for the text field
378 *
379 * @deprecated As of JDK version 1.1,
380 * replaced by <code>getPreferredSize(int)</code>.
381 */
382 @Deprecated
383 public Dimension preferredSize(int columns) {
384 synchronized (getTreeLock()) {
385 TextFieldPeer peer = (TextFieldPeer)this.peer;
386 return (peer != null) ?
387 peer.getPreferredSize(columns) :
388 super.preferredSize();
389 }
390 }
391
392 /**
393 * Gets the preferred size of this text field.
394 * @return the preferred dimensions for
395 * displaying this text field.
396 * @since JDK1.1
397 */
398 public Dimension getPreferredSize() {
400 }
401
402 /**
403 * @deprecated As of JDK version 1.1,
404 * replaced by <code>getPreferredSize()</code>.
405 */
406 @Deprecated
407 public Dimension preferredSize() {
408 synchronized (getTreeLock()) {
409 return (columns > 0) ?
410 preferredSize(columns) :
411 super.preferredSize();
412 }
413 }
414
415 /**
416 * Gets the minimum dimensions for a text field with
417 * the specified number of columns.
418 * @param columns the number of columns in
419 * this text field.
420 * @return the minimum size for this text field
421 * @since JDK1.1
422 */
423 public Dimension getMinimumSize(int columns) {
424 return minimumSize(columns);
425 }
426
427 /**
428 * Returns the minimum dimensions for a text field with
429 * the specified number of columns.
430 * @param columns the number of columns
431 * @return the minimum size for this text field
432 * @deprecated As of JDK version 1.1,
433 * replaced by <code>getMinimumSize(int)</code>.
434 */
435 @Deprecated
436 public Dimension minimumSize(int columns) {
437 synchronized (getTreeLock()) {
438 TextFieldPeer peer = (TextFieldPeer)this.peer;
439 return (peer != null) ?
440 peer.getMinimumSize(columns) :
441 super.minimumSize();
442 }
443 }
444
445 /**
446 * Gets the minimum dimensions for this text field.
447 * @return the minimum dimensions for
448 * displaying this text field.
449 * @since JDK1.1
450 */
451 public Dimension getMinimumSize() {
|