createDefaultModel
protected Document createDefaultModel()
Creates the default model for this text field.
This implementation returns an instance of PlainDocument
.
- a new instance of the default model
fireActionPerformed
protected void fireActionPerformed()
Sends an action event to all registered
ActionListener
objects.
getActions
public Action[] getActions()
Returns the set of Actions that are commands for the editor.
This is the actions supported by this editor plus the actions
of the UI (returned by JTextComponent.getActions()).
- getActions in interface JTextComponent
getColumnWidth
protected int getColumnWidth()
Returns the column width, which is the width of the character m
for the font in use.
- the width of the character m for the font in use.
getColumns
public int getColumns()
Returns the number of columns of this text field.
getHorizontalAlignment
public int getHorizontalAlignment()
Returns the horizontal alignment, which is one of: JTextField.LEFT,
JTextField.CENTER, JTextField.RIGHT, JTextField.LEADING,
JTextField.TRAILING.
getHorizontalVisibility
public BoundedRangeModel getHorizontalVisibility()
Returns the bounded range model that describes the horizontal visibility
of the text field in the case when the text does not fit into the
available space. The actual values of this model are managed by the look
and feel implementation.
- the bounded range model that describes the horizontal visibility
getPreferredSize
public Dimension getPreferredSize()
Returns the preferred size. If there is a non-zero number of columns,
this is the number of columns multiplied by the column width, otherwise
it returns super.getPreferredSize().
- getPreferredSize in interface JComponent
getScrollOffset
public int getScrollOffset()
Returns the scroll offset in pixels.
isValidateRoot
public boolean isValidateRoot()
Returns true
, unless this is embedded in a
JViewport
in which case the viewport takes responsibility of
validating.
- isValidateRoot in interface JComponent
true
, unless this is embedded in a
JViewport
in which case the viewport takes
responsibility of validating
setColumns
public void setColumns(int columns)
Sets the number of columns and then invalidates the layout.
columns
- the number of columns
setDocument
public void setDocument(Document doc)
Sets the document to be used for this JTextField.
This sets the document property filterNewlines
to
true
and then calls the super behaviour to setup a view and
revalidate the text field.
- setDocument in interface JTextComponent
doc
- the document to set
setFont
public void setFont(Font newFont)
Sets the current font and revalidates so the font will take effect.
- setFont in interface JComponent
setHorizontalAlignment
public void setHorizontalAlignment(int newAlign)
Sets the horizontal alignment of the text. Calls invalidate and repaint
and fires a property change event.
newAlign
- must be one of: JTextField.LEFT, JTextField.CENTER,
JTextField.RIGHT, JTextField.LEADING, JTextField.TRAILING.
setScrollOffset
public void setScrollOffset(int offset)
Sets the scroll offset in pixels.
offset
- the scroll offset
JTextField.java --
Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.