Web hosting reviews - Java Swing - O Reilly public FieldView(Element elem) Creates
Thursday, December 27th, 2007Java Swing - O Reilly public FieldView(Element elem) Creates a new View for the Element. 23.2.7.3 Public Methods The following methods override the implementations provided by PlainView. They all use the PlainView implementations, but first use the protected adjustAllocation() method to modify the given Shape. public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory f ) Calls super.insertUpdate() (modifying the given shape by a call to adjustAllocation()) and updates the horizontal visibility model of the JTextField rendered by this view (if there is one). public void removeUpdate(DocumentEvent changes, Shape a, ViewFactory f ) Calls super.removeUpdate(), modifying the given shape by a call to adjustAllocation(), and updates the horizontal visibility model of the JTextField rendered by this view (if there is one). public void paint(Graphics g, Shape a) public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias) Call the appropriate super method after modifying the given Shape by calling adjustAllocation(). See Figure 23.7. 23.2.7.4 Protected Methods protected Shape adjustAllocation(Shape a) Enables the single line of text to be centered vertically within the bounds of the given Shape. It returns a Rectangle that is centered vertically within the Shape and that has a height equal to the View’s preferred span along y-axis. Horizontal adjustments are made according to the horizontalAlignment property of the JTextField using this view. Figure 23.7 shows what this method does. The larger rectangle represents the full size of the JTextField. In this case, the field’s horizontal alignment is set to SwingConstants.RIGHT, indicating that the text should be right justified. This method returns the inner rectangle, indicating the exact region into which the text should be painted. Figure 23.7. FieldView.adjustAllocation() - 765
In case you need quality webspace to host and run your web applications, try our personal web hosting services.