Java Doc for ButtonCommons.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » x » swing » 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 » Apache Harmony Java SE » org package » org.apache.harmony.x.swing 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.harmony.x.swing.ButtonCommons

ButtonCommons
public class ButtonCommons (Code)
The storage of different utility methods used for buttons drawing.




Method Summary
public static  voiddrawCheck(Graphics g, Color color, int x, int y)
     Draws 'check' icon at the specified location.
public static  IcongetCurrentIcon(AbstractButton button)
     Retrieves 'current' button icon - icon which is set for the current button state (enabled/disabled/pressed).
Parameters:
  button - AbstractButton for which icon should be calculated.
public static  RectanglegetFocusRect(Rectangle rect1, Rectangle rect2, Rectangle rect3)
     Decides which bounds should be used for drawing focus.
public static  StringgetPaintingParameters(AbstractButton button, Rectangle viewR, Rectangle iconR, Rectangle textR, Icon icon, int leftInset, int rightInset)
     Calculate button layout and clipping text.
public static  StringgetPaintingParameters(AbstractButton button, Rectangle viewR, Rectangle iconR, Rectangle textR, Icon icon)
     Calculate button layout and clipping text.
public static  DimensiongetPreferredSize(AbstractButton button, Icon defaultIcon, int textIconGap)
     Calculates the preferred button size.
Parameters:
  button - AbstractButton for which the preferred size to be calculated
Parameters:
  defaultIcon - Icon which is set for the button when calculating its preferred size.Null if no icon is set.
public static  DimensiongetPreferredSize(AbstractButton button, Icon defaultIcon)
     Calculates the preferred button size.
Parameters:
  button - AbstractButton for which the preferred size to be calculated
Parameters:
  defaultIcon - Icon which is set for the button when calculating its preferred size.Null if no icon is set.
public static  voidpaintFocus(Graphics g, Rectangle focusRect, Color color)
     Paints focus border at the specified bounds.
public static  voidpaintPressed(Graphics g, AbstractButton button, Color color)
     Paints button in the pressed state (push buttons and toggle-buttons).
public static  voidpaintText(Graphics g, AbstractButton b, Rectangle textRect, String clippedText, Color color)
     Paints text on a button.
public static  voidpaintText(Graphics g, FontMetrics fm, String text, int displayedMnemonicIndex, Rectangle textRect, String clippedText, Color color)
     Paints text on the specified Graphics in the specified location.
Parameters:
  g - Graphics to paint on
Parameters:
  fm - FontMetrics set for the button
Parameters:
  text - String representing the original (not-trimmed) button text (AbstractButton.getText())
Parameters:
  displayedMnemonicIndex - int value specifing an index of a 'mnemonical char', i.e.



Method Detail
drawCheck
public static void drawCheck(Graphics g, Color color, int x, int y)(Code)
Draws 'check' icon at the specified location. Used for check boxes.
Parameters:
  g - Graphics to draw on
Parameters:
  color - Color of the check
Parameters:
  x - int value representing the icon's x-location
Parameters:
  y - int value representing the icon's y-location



getCurrentIcon
public static Icon getCurrentIcon(AbstractButton button)(Code)
Retrieves 'current' button icon - icon which is set for the current button state (enabled/disabled/pressed).
Parameters:
  button - AbstractButton for which icon should be calculated. Icon or null if there is no icon for the button.



getFocusRect
public static Rectangle getFocusRect(Rectangle rect1, Rectangle rect2, Rectangle rect3)(Code)
Decides which bounds should be used for drawing focus. Usually the choice is done among button bounds (rect1), button text bounds (rect2) and button icon bounds (rect3). The order is the following: if rect1 is apecified (and not empty) rect1 is returned. Otherwise if rect2 is specified and not empty rect2 is returned. Otherwise rect3 is returned.
Parameters:
  rect1 - Rectangle of the most preferrable focus bounds
Parameters:
  rect2 - Rectangle of the next preferrable focus bounds
Parameters:
  rect3 - Rectangle of the least preferrable focus bounds Rectangle of the focus bounds



getPaintingParameters
public static String getPaintingParameters(AbstractButton button, Rectangle viewR, Rectangle iconR, Rectangle textR, Icon icon, int leftInset, int rightInset)(Code)
Calculate button layout and clipping text.
Parameters:
  button - AbstractButton for which parameters to be calculated
Parameters:
  viewR - Rectangle which will be initialized as button local bounds
Parameters:
  iconR - Rectangle which will be initialized as icon bounds
Parameters:
  textR - Rectangle which will be initialized as text bounds
Parameters:
  icon - Icon which is set to button (ususally that is AbstractButton.getIcon()) or null
Parameters:
  leftInset - int value representing button left inset (border) if any
Parameters:
  rightInset - int value representing button right inset (border) if any String which represent the text to be displayed in the button (button labelclipped and complemented with "..." if required)



getPaintingParameters
public static String getPaintingParameters(AbstractButton button, Rectangle viewR, Rectangle iconR, Rectangle textR, Icon icon)(Code)
Calculate button layout and clipping text.
Parameters:
  button - AbstractButton for which parameters to be calculated
Parameters:
  viewR - Rectangle which will be initialized as button local bounds
Parameters:
  iconR - Rectangle which will be initialized as icon bounds
Parameters:
  textR - Rectangle which will be initialized as text bounds
Parameters:
  icon - Icon which is set to button (ususally that is AbstractButton.getIcon()) or null String which represent the text to be displayed in the button (button label clipped and complemented with "..." if required)



getPreferredSize
public static Dimension getPreferredSize(AbstractButton button, Icon defaultIcon, int textIconGap)(Code)
Calculates the preferred button size.
Parameters:
  button - AbstractButton for which the preferred size to be calculated
Parameters:
  defaultIcon - Icon which is set for the button when calculating its preferred size.Null if no icon is set. Usually that is AbstractButton.getIcon()
Parameters:
  textIconGap - int value representing the gap between text and icon (ususally AbstractButton.getIconTextGap()) Dimension of the button preferred size



getPreferredSize
public static Dimension getPreferredSize(AbstractButton button, Icon defaultIcon)(Code)
Calculates the preferred button size.
Parameters:
  button - AbstractButton for which the preferred size to be calculated
Parameters:
  defaultIcon - Icon which is set for the button when calculating its preferred size.Null if no icon is set. Usually that is AbstractButton.getIcon() Dimension of the button preferred size



paintFocus
public static void paintFocus(Graphics g, Rectangle focusRect, Color color)(Code)
Paints focus border at the specified bounds.
Parameters:
  g - Graphics to paint on
Parameters:
  focusRect - Rectangle which specifies the focus border location
Parameters:
  color - Color to paint focus



paintPressed
public static void paintPressed(Graphics g, AbstractButton button, Color color)(Code)
Paints button in the pressed state (push buttons and toggle-buttons).
Parameters:
  g - Graphics to paint on
Parameters:
  button - AbstractButton to be painted as pressed
Parameters:
  color - Color of the button in the pressed state



paintText
public static void paintText(Graphics g, AbstractButton b, Rectangle textRect, String clippedText, Color color)(Code)
Paints text on a button.
Parameters:
  g - Graphics to paint on
Parameters:
  b - AbstractButton to be painted
Parameters:
  textRect - Rectangle bounding the text location
Parameters:
  clippedText - String to be displayed on the button surface (should be trimmed by the bouding rectangle)
Parameters:
  color - Color of the text



paintText
public static void paintText(Graphics g, FontMetrics fm, String text, int displayedMnemonicIndex, Rectangle textRect, String clippedText, Color color)(Code)
Paints text on the specified Graphics in the specified location.
Parameters:
  g - Graphics to paint on
Parameters:
  fm - FontMetrics set for the button
Parameters:
  text - String representing the original (not-trimmed) button text (AbstractButton.getText())
Parameters:
  displayedMnemonicIndex - int value specifing an index of a 'mnemonical char', i.e. index in the text to be underscored.-1 if no mnemonic is set
Parameters:
  textRect - Rectangle bounding the text location
Parameters:
  clippedText - String to be displayed on the button surface (should be trimmed by the bouding rectangle)
Parameters:
  color - Color of the text



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.