Wiki :
XViewBoxListener
Sitemap
Contact Us
RSS
HomePage
::
Categories
::
PageIndex
::
RecentChanges
::
RecentlyCommented
::
Login/Register
XViewBoxListener
class com.xoetrope.svg.
XViewBoxListener
A component which listens for events on an SVG viewBox and repositions registered components within the glass pane accordingly.
1. Example
public
static
void
main
(
String
[
]
args
)
{
JFrame
frame =
new
JFrame
(
)
;
frame.
setSize
(
800
,
600
)
;
JComponent
glassPane =
(
JComponent
)
frame.
getGlassPane
(
)
;
glassPane.
setSize
(
800
,
600
)
;
glassPane.
setOpaque
(
false
)
;
glassPane.
setLayout
(
null
)
XSvgImageMap imageMap =
new
XSvgImageMap
(
)
;
imageMap.
setURL
(
getClass
(
)
.
getResource
(
"Floor5.svg"
)
)
;
imageMap.
display
(
)
;
JButton
button =
new
JButton
(
)
;
button.
setBounds
(
150
,
100
,
10
,
10
)
;
glassPane.
add
(
button
)
;
ViewBoxListener listener =
new
ViewBoxListener
(
imageMap
)
;
listener.
registerComponent
(
button
)
;
glassPane.
setVisible
(
true
)
;
frame.
getContentPane
(
)
.
add
(
imageMap
)
;
frame.
setVisible
(
true
)
;
}
2. Constructor
public
XViewBoxListener
(
final
XSvgImageMap imageMap
)
Constructor which takes an
XSvgImageMap
instance which will provide the viewBox.
3. Methods
1. setImageMap
public
void
registerComponent
(
Component
component
)
Register a component to be repositioned if a viewBox event occurs.
2. removeComponent
public
void
removeComponent
(
Component
component
)
Removes a previously registered component from the list of registered components.
3. Inner Class
1. Constructor
public
ViewBoxComponent
(
Component
component
)
An inner class which stores location information for each registered component. Each registered component is stored within an instance of this class.
2. Inner Class Methods
1. getComponent
public
Component
getComponent
(
)
Returns the component instance stored in this class.
2. getViewBoxLocation
public
Point2D
getViewBoxLocation
(
)
Returns the components initial location in SVG coordinates.
There are no comments on this page. [
Add comment
]
Page was generated in 0.4322 seconds
There are no comments on this page. [Add comment]