Java Doc for MultiLineLabel.java in  » Installer » IzPack » com » izforge » izpack » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Installer » IzPack » com.izforge.izpack.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.swing.JComponent
   com.izforge.izpack.util.MultiLineLabel

MultiLineLabel
public class MultiLineLabel extends JComponent (Code)

MultiLineLabel may be used in place of javax.swing.JLabel.

This class implements a component that is capable of displaying multiple lines of text. Line breaks are inserted automatically whenever a line of text extends beyond the predefined maximum line length. Line breaks will only be inserted between words, except where a single word is longer than the maximum line length. Line breaks may be forced at any location in the text by inserting a newline (\n). White space that is not valuable (i.e. is placed at the beginning of a new line or at the very beginning or end of the text) is removed.

Note: you can set the maximum width of the label either through one of the constructors or you can call setMaxWidth() explicitly. If this is not set, MultiLineLabel will derive its width from the parent component.
version:
   0.0.1 / 05-15-97
version:
   1.0 / 04-13-02
author:
   Elmar Grom


Field Summary
final public static  intCENTER
    
final public static  intDEFAULT_ALIGN
    
final public static  intDEFAULT_MARGIN
    
final public static  intLEAST_ALLOWED
    
final public static  intLEFT
    
final public static  intRIGHT
    
protected  intalignment
    
protected  StringlabelText
    
protected  Vector<String>line
    
protected  intlineAscent
    
protected  intlineDescent
    
protected  intlineHeight
    
protected  int[]lineWidth
    
protected  intmarginHeight
    
protected  intmarginWidth
    
protected  intmaxWidth
    
protected  intnumLines
    

Constructor Summary
public  MultiLineLabel(String text, int horMargin, int vertMargin, int maxWidth, int justify)
    
public  MultiLineLabel(String label, int marginWidth, int marginHeight)
     Constructor using default max-width and alignment.
public  MultiLineLabel(String label, int alignment)
     Constructor using default max-width, and margin.
public  MultiLineLabel(String label)
     Constructor using default max-width, alignment, and margin.

Method Summary
public  voidaddNotify()
     This method is called by the system after this object is first created.
 intbreakWord(String word, FontMetrics fm)
     This method scans the input string until the max allowed width is reached.
public  intgetAlignment()
    
public  intgetMarginHeight()
    
public  intgetMarginWidth()
    
public  DimensiongetMinimumSize()
     This method is typically used by the layout manager, it reports the absolute minimum space required to display the entire label.
 intgetPosition(String target, int start, char[] source, int mode)
     This method searches the target string for occurences of any of the characters in the source string.
public  DimensiongetPreferredSize()
     This method is typically used by the layout manager, it reports the necessary space to display the label comfortably.
protected  voidmeasure()
     This method finds the font size, each line width and the widest line.
public  voidpaint(Graphics graphics)
     This method draws the label.
public  voidsetBounds(int x, int y, int width, int height)
     Moves and resizes this component.
public  voidsetColor(Color color)
    
public  voidsetFont(Font font)
    
public  voidsetJustify(int alignment)
    
public  voidsetMarginHeight(int margin)
    
public  voidsetMarginWidth(int margin)
    
public  voidsetMaxWidth(int width)
    
public  voidsetText(String labelText)
    

Field Detail
CENTER
final public static int CENTER(Code)



DEFAULT_ALIGN
final public static int DEFAULT_ALIGN(Code)



DEFAULT_MARGIN
final public static int DEFAULT_MARGIN(Code)



LEAST_ALLOWED
final public static int LEAST_ALLOWED(Code)



LEFT
final public static int LEFT(Code)



RIGHT
final public static int RIGHT(Code)



alignment
protected int alignment(Code)



labelText
protected String labelText(Code)



line
protected Vector<String> line(Code)



lineAscent
protected int lineAscent(Code)



lineDescent
protected int lineDescent(Code)



lineHeight
protected int lineHeight(Code)



lineWidth
protected int[] lineWidth(Code)



marginHeight
protected int marginHeight(Code)



marginWidth
protected int marginWidth(Code)



maxWidth
protected int maxWidth(Code)



numLines
protected int numLines(Code)




Constructor Detail
MultiLineLabel
public MultiLineLabel(String text, int horMargin, int vertMargin, int maxWidth, int justify)(Code)
Constructor
Parameters:
  text - the text to be displayed
Parameters:
  horMargin - the horizontal margin for the label
Parameters:
  vertMargin - the vertical margin for the label
Parameters:
  maxWidth - the maximum allowed width of the text
Parameters:
  justify - the text alignment for the label



MultiLineLabel
public MultiLineLabel(String label, int marginWidth, int marginHeight)(Code)
Constructor using default max-width and alignment.
Parameters:
  label - the text to be displayed
Parameters:
  marginWidth - the horizontal margin for the label
Parameters:
  marginHeight - the vertical margin for the label



MultiLineLabel
public MultiLineLabel(String label, int alignment)(Code)
Constructor using default max-width, and margin.
Parameters:
  label - the text to be displayed
Parameters:
  alignment - the text alignment for the label



MultiLineLabel
public MultiLineLabel(String label)(Code)
Constructor using default max-width, alignment, and margin.
Parameters:
  label - the text to be displayed




Method Detail
addNotify
public void addNotify()(Code)
This method is called by the system after this object is first created.



breakWord
int breakWord(String word, FontMetrics fm)(Code)
This method scans the input string until the max allowed width is reached. The return value indicates the position just before this happens. position character position just before the string is too long
Parameters:
  word - word to break



getAlignment
public int getAlignment()(Code)
This method may be used to retrieve the text alignment for the label alignment the text alignment currently in use for the label



getMarginHeight
public int getMarginHeight()(Code)
This method may be used to retrieve the vertical margin for the label marginHeight the margin currently in use on the top and bottom of the label



getMarginWidth
public int getMarginWidth()(Code)
This method may be used to retrieve the horizontal margin for the label marginWidth the margin currently in use to the left and right of the label



getMinimumSize
public Dimension getMinimumSize()(Code)
This method is typically used by the layout manager, it reports the absolute minimum space required to display the entire label.



getPosition
int getPosition(String target, int start, char[] source, int mode)(Code)
This method searches the target string for occurences of any of the characters in the source string. The return value is the position of the first hit. Based on the mode parameter the hit position is either the position where any of the source characters first was found or the first position where none of the source characters where found. position of the first occurence
Parameters:
  target - the text to be searched
Parameters:
  start - the start position for the search
Parameters:
  source - the list of characters to be searched for
Parameters:
  mode - the search mode FOUND = reports first found NOT_FOUND = reports first not found



getPreferredSize
public Dimension getPreferredSize()(Code)
This method is typically used by the layout manager, it reports the necessary space to display the label comfortably.



measure
protected void measure()(Code)
This method finds the font size, each line width and the widest line.



paint
public void paint(Graphics graphics)(Code)
This method draws the label.
Parameters:
  graphics - the device context



setBounds
public void setBounds(int x, int y, int width, int height)(Code)
Moves and resizes this component. The new location of the top-left corner is specified by x and y, and the new size is specified by width and height.
Parameters:
  x - The new x-coordinate of this component.
Parameters:
  y - The new y-coordinate of this component.
Parameters:
  width - The new width of this component.
Parameters:
  height - The new height of this component.



setColor
public void setColor(Color color)(Code)
This method may be used to set the color in which the text should be drawn
Parameters:
  color - the text color



setFont
public void setFont(Font font)(Code)
This method may be used to set the font that should be used to draw the label
Parameters:
  font - font to be used within the label



setJustify
public void setJustify(int alignment)(Code)
This method may be used to set the text alignment for the label
Parameters:
  alignment - the alignment, possible values are LEFT, CENTER, RIGHT



setMarginHeight
public void setMarginHeight(int margin)(Code)
This method may be used to set the vertical margin for the label
Parameters:
  margin - the margin on the top and bottom of the label



setMarginWidth
public void setMarginWidth(int margin)(Code)
This method may be used to set the horizontal margin
Parameters:
  margin - the margin to the left and to the right of the label



setMaxWidth
public void setMaxWidth(int width)(Code)
This method may be used to set the max allowed line width
Parameters:
  width - the max allowed line width in pixels



setText
public void setText(String labelText)(Code)
This method may be used to set the label text
Parameters:
  labelText - the text to be displayed



Fields inherited from javax.swing.JComponent
final public static String TOOL_TIP_TEXT_KEY(Code)(Java Doc)
final public static int UNDEFINED_CONDITION(Code)(Java Doc)
final public static int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT(Code)(Java Doc)
final public static int WHEN_FOCUSED(Code)(Java Doc)
final public static int WHEN_IN_FOCUSED_WINDOW(Code)(Java Doc)
protected AccessibleContext accessibleContext(Code)(Java Doc)
protected EventListenerList listenerList(Code)(Java Doc)
protected transient ComponentUI ui(Code)(Java Doc)

Methods inherited from javax.swing.JComponent
public void addAncestorListener(AncestorListener listener)(Code)(Java Doc)
public void addNotify()(Code)(Java Doc)
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc)
public void computeVisibleRect(Rectangle visibleRect)(Code)(Java Doc)
public boolean contains(int x, int y)(Code)(Java Doc)
public JToolTip createToolTip()(Code)(Java Doc)
public void disable()(Code)(Java Doc)
public void enable()(Code)(Java Doc)
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)(Code)(Java Doc)
public void firePropertyChange(String propertyName, int oldValue, int newValue)(Code)(Java Doc)
public void firePropertyChange(String propertyName, char oldValue, char newValue)(Code)(Java Doc)
protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws java.beans.PropertyVetoException(Code)(Java Doc)
public AccessibleContext getAccessibleContext()(Code)(Java Doc)
public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc)
final public ActionMap getActionMap()(Code)(Java Doc)
public float getAlignmentX()(Code)(Java Doc)
public float getAlignmentY()(Code)(Java Doc)
public AncestorListener[] getAncestorListeners()(Code)(Java Doc)
public boolean getAutoscrolls()(Code)(Java Doc)
public int getBaseline(int width, int height)(Code)(Java Doc)
public BaselineResizeBehavior getBaselineResizeBehavior()(Code)(Java Doc)
public Border getBorder()(Code)(Java Doc)
public Rectangle getBounds(Rectangle rv)(Code)(Java Doc)
final public Object getClientProperty(Object key)(Code)(Java Doc)
protected Graphics getComponentGraphics(Graphics g)(Code)(Java Doc)
public JPopupMenu getComponentPopupMenu()(Code)(Java Doc)
public int getConditionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc)
public int getDebugGraphicsOptions()(Code)(Java Doc)
public static Locale getDefaultLocale()(Code)(Java Doc)
public FontMetrics getFontMetrics(Font font)(Code)(Java Doc)
public Graphics getGraphics()(Code)(Java Doc)
public int getHeight()(Code)(Java Doc)
public boolean getInheritsPopupMenu()(Code)(Java Doc)
final public InputMap getInputMap(int condition)(Code)(Java Doc)
final public InputMap getInputMap()(Code)(Java Doc)
public InputVerifier getInputVerifier()(Code)(Java Doc)
public Insets getInsets()(Code)(Java Doc)
public Insets getInsets(Insets insets)(Code)(Java Doc)
public T[] getListeners(Class<T> listenerType)(Code)(Java Doc)
public Point getLocation(Point rv)(Code)(Java Doc)
public Dimension getMaximumSize()(Code)(Java Doc)
public Dimension getMinimumSize()(Code)(Java Doc)
public Component getNextFocusableComponent()(Code)(Java Doc)
public Point getPopupLocation(MouseEvent event)(Code)(Java Doc)
public Dimension getPreferredSize()(Code)(Java Doc)
public KeyStroke[] getRegisteredKeyStrokes()(Code)(Java Doc)
public JRootPane getRootPane()(Code)(Java Doc)
public Dimension getSize(Dimension rv)(Code)(Java Doc)
public Point getToolTipLocation(MouseEvent event)(Code)(Java Doc)
public String getToolTipText()(Code)(Java Doc)
public String getToolTipText(MouseEvent event)(Code)(Java Doc)
public Container getTopLevelAncestor()(Code)(Java Doc)
public TransferHandler getTransferHandler()(Code)(Java Doc)
public String getUIClassID()(Code)(Java Doc)
public boolean getVerifyInputWhenFocusTarget()(Code)(Java Doc)
public synchronized VetoableChangeListener[] getVetoableChangeListeners()(Code)(Java Doc)
public Rectangle getVisibleRect()(Code)(Java Doc)
public int getWidth()(Code)(Java Doc)
public int getX()(Code)(Java Doc)
public int getY()(Code)(Java Doc)
public void grabFocus()(Code)(Java Doc)
public boolean isDoubleBuffered()(Code)(Java Doc)
public static boolean isLightweightComponent(Component c)(Code)(Java Doc)
public boolean isManagingFocus()(Code)(Java Doc)
public boolean isOpaque()(Code)(Java Doc)
public boolean isOptimizedDrawingEnabled()(Code)(Java Doc)
final public boolean isPaintingForPrint()(Code)(Java Doc)
public boolean isPaintingTile()(Code)(Java Doc)
public boolean isRequestFocusEnabled()(Code)(Java Doc)
public boolean isValidateRoot()(Code)(Java Doc)
public void paint(Graphics g)(Code)(Java Doc)
protected void paintBorder(Graphics g)(Code)(Java Doc)
protected void paintChildren(Graphics g)(Code)(Java Doc)
protected void paintComponent(Graphics g)(Code)(Java Doc)
public void paintImmediately(int x, int y, int w, int h)(Code)(Java Doc)
public void paintImmediately(Rectangle r)(Code)(Java Doc)
protected String paramString()(Code)(Java Doc)
public void print(Graphics g)(Code)(Java Doc)
public void printAll(Graphics g)(Code)(Java Doc)
protected void printBorder(Graphics g)(Code)(Java Doc)
protected void printChildren(Graphics g)(Code)(Java Doc)
protected void printComponent(Graphics g)(Code)(Java Doc)
protected void processComponentKeyEvent(KeyEvent e)(Code)(Java Doc)
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)(Code)(Java Doc)
protected void processKeyEvent(KeyEvent e)(Code)(Java Doc)
protected void processMouseEvent(MouseEvent e)(Code)(Java Doc)
protected void processMouseMotionEvent(MouseEvent e)(Code)(Java Doc)
final public void putClientProperty(Object key, Object value)(Code)(Java Doc)
public void registerKeyboardAction(ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc)
public void registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc)
public void removeAncestorListener(AncestorListener listener)(Code)(Java Doc)
public void removeNotify()(Code)(Java Doc)
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc)
public void repaint(long tm, int x, int y, int width, int height)(Code)(Java Doc)
public void repaint(Rectangle r)(Code)(Java Doc)
public boolean requestDefaultFocus()(Code)(Java Doc)
public void requestFocus()(Code)(Java Doc)
public boolean requestFocus(boolean temporary)(Code)(Java Doc)
public boolean requestFocusInWindow()(Code)(Java Doc)
protected boolean requestFocusInWindow(boolean temporary)(Code)(Java Doc)
public void resetKeyboardActions()(Code)(Java Doc)
public void reshape(int x, int y, int w, int h)(Code)(Java Doc)
public void revalidate()(Code)(Java Doc)
public void scrollRectToVisible(Rectangle aRect)(Code)(Java Doc)
final public void setActionMap(ActionMap am)(Code)(Java Doc)
public void setAlignmentX(float alignmentX)(Code)(Java Doc)
public void setAlignmentY(float alignmentY)(Code)(Java Doc)
public void setAutoscrolls(boolean autoscrolls)(Code)(Java Doc)
public void setBackground(Color bg)(Code)(Java Doc)
public void setBorder(Border border)(Code)(Java Doc)
public void setComponentPopupMenu(JPopupMenu popup)(Code)(Java Doc)
public void setDebugGraphicsOptions(int debugOptions)(Code)(Java Doc)
public static void setDefaultLocale(Locale l)(Code)(Java Doc)
public void setDoubleBuffered(boolean aFlag)(Code)(Java Doc)
public void setEnabled(boolean enabled)(Code)(Java Doc)
public void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)(Code)(Java Doc)
public void setFont(Font font)(Code)(Java Doc)
public void setForeground(Color fg)(Code)(Java Doc)
public void setInheritsPopupMenu(boolean value)(Code)(Java Doc)
final public void setInputMap(int condition, InputMap map)(Code)(Java Doc)
public void setInputVerifier(InputVerifier inputVerifier)(Code)(Java Doc)
public void setMaximumSize(Dimension maximumSize)(Code)(Java Doc)
public void setMinimumSize(Dimension minimumSize)(Code)(Java Doc)
public void setNextFocusableComponent(Component aComponent)(Code)(Java Doc)
public void setOpaque(boolean isOpaque)(Code)(Java Doc)
public void setPreferredSize(Dimension preferredSize)(Code)(Java Doc)
public void setRequestFocusEnabled(boolean requestFocusEnabled)(Code)(Java Doc)
public void setToolTipText(String text)(Code)(Java Doc)
public void setTransferHandler(TransferHandler newHandler)(Code)(Java Doc)
protected void setUI(ComponentUI newUI)(Code)(Java Doc)
public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget)(Code)(Java Doc)
public void setVisible(boolean aFlag)(Code)(Java Doc)
public void unregisterKeyboardAction(KeyStroke aKeyStroke)(Code)(Java Doc)
public void update(Graphics g)(Code)(Java Doc)
public void updateUI()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.