Top Description Inners Fields Constructors Methods
com.sun.jna.examples

public Class ShapedWindowDemo

extends Object
Class Inheritance
Imports
java.awt.AlphaComposite, .BasicStroke, .Color, .Composite, .Cursor, .Dimension, .Font, .Frame, .Graphics, .Graphics2D, .Image, .Point, .RenderingHints, .Shape, .Stroke, .Window, java.awt.event.ActionEvent, .ActionListener, .MouseEvent, java.awt.geom.Area, .Ellipse2D, .Rectangle2D, java.awt.image.BufferedImage, java.util.Calendar, javax.swing.AbstractAction, .JComponent, .JFrame, .JOptionPane, .JPopupMenu, .JScrollPane, .JTextArea, .SwingUtilities, .Timer, .UIManager, javax.swing.event.MouseInputAdapter

Example which uses the WindowUtils class. Demonstrates the definition of a cross-platform library with several platform-specific implementations based on JNA native library definitions.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
public static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
main(String[] args)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ICON_SIZEback to summary
public static final int ICON_SIZE

Constructor Detail

ShapedWindowDemoback to summary
public ShapedWindowDemo()

Method Detail

mainback to summary
public static void main(String[] args)
com.sun.jna.examples back to summary

private Class ShapedWindowDemo.ClockFace

extends JComponent
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Stroke
private Stroke
private Stroke
private Stroke
private Stroke
Inherited from javax.swing.JComponent:
listenerListTOOL_TIP_TEXT_KEYuiUNDEFINED_CONDITIONWHEN_ANCESTOR_OF_FOCUSED_COMPONENTWHEN_FOCUSEDWHEN_IN_FOCUSED_WINDOW

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Image
private String
getRomanNumeral(int number)

protected void
paintComponent(Graphics
the Graphics object to protect
graphics
)

Overrides javax.swing.JComponent.paintComponent.

Calls the UI delegate's paint method, if the UI delegate is non-null.
protected void
paintFace(Graphics graphics, int size)

Inherited from javax.swing.JComponent:
addAncestorListeneraddNotifyaddVetoableChangeListenercomputeVisibleRectcontainscreateToolTipdisableenablefirePropertyChangefirePropertyChangefirePropertyChangefireVetoableChangegetActionForKeyStrokegetActionMapgetAlignmentXgetAlignmentYgetAncestorListenersgetAutoscrollsgetBaselinegetBaselineResizeBehaviorgetBordergetBoundsgetClientPropertygetComponentGraphicsgetComponentPopupMenugetConditionForKeyStrokegetDebugGraphicsOptionsgetDefaultLocalegetFontMetricsgetGraphicsgetHeightgetInheritsPopupMenugetInputMapgetInputMapgetInputVerifiergetInsetsgetInsetsgetListenersgetLocationgetMaximumSizegetMinimumSizegetNextFocusableComponentgetPopupLocationgetPreferredSizegetRegisteredKeyStrokesgetRootPanegetSizegetToolTipLocationgetToolTipTextgetToolTipTextgetTopLevelAncestorgetTransferHandlergetUIgetUIClassIDgetVerifyInputWhenFocusTargetgetVetoableChangeListenersgetVisibleRectgetWidthgetXgetYgrabFocushideisDoubleBufferedisLightweightComponentisManagingFocusisOpaqueisOptimizedDrawingEnabledisPaintingForPrintisPaintingOriginisPaintingTileisRequestFocusEnabledisValidateRootpaintpaintBorderpaintChildrenpaintImmediatelypaintImmediatelyparamStringprintprintAllprintBorderprintChildrenprintComponentprocessComponentKeyEventprocessKeyBindingprocessKeyEventprocessMouseEventprocessMouseMotionEventputClientPropertyregisterKeyboardActionregisterKeyboardActionremoveAncestorListenerremoveNotifyremoveVetoableChangeListenerrepaintrepaintrequestDefaultFocusrequestFocusrequestFocusrequestFocusInWindowrequestFocusInWindowresetKeyboardActionsreshaperevalidatescrollRectToVisiblesetActionMapsetAlignmentXsetAlignmentYsetAutoscrollssetBackgroundsetBordersetComponentPopupMenusetDebugGraphicsOptionssetDefaultLocalesetDoubleBufferedsetEnabledsetFocusTraversalKeyssetFontsetForegroundsetInheritsPopupMenusetInputMapsetInputVerifiersetMaximumSizesetMinimumSizesetNextFocusableComponentsetOpaquesetPreferredSizesetRequestFocusEnabledsetToolTipTextsetTransferHandlersetUIsetVerifyInputWhenFocusTargetsetVisibleunregisterKeyboardActionupdateupdateUI

Field Detail

borderback to summary
private Stroke border

Hides javax.swing.JComponent.border.

hourHandback to summary
private Stroke hourHand
minuteHandback to summary
private Stroke minuteHand
secondHandback to summary
private Stroke secondHand
ticksback to summary
private Stroke ticks

Constructor Detail

ClockFaceback to summary
public ClockFace(Dimension size)

Method Detail

getIconImageback to summary
public Image getIconImage()
getRomanNumeralback to summary
private String getRomanNumeral(int number)
paintComponentback to summary
protected void paintComponent(Graphics graphics)

Overrides javax.swing.JComponent.paintComponent.

Doc from javax.swing.JComponent.paintComponent.

Calls the UI delegate's paint method, if the UI delegate is non-null. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (for example, Graphics.translate).

If you override this in a subclass you should not make permanent changes to the passed in Graphics. For example, you should not alter the clip Rectangle or modify the transform. If you need to do these operations you may find it easier to create a new Graphics from the passed in Graphics and manipulate it. Further, if you do not invoke super's implementation you must honor the opaque property, that is if this component is opaque, you must completely fill in the background in an opaque color. If you do not honor the opaque property you will likely see visual artifacts.

The passed in Graphics object might have a transform other than the identify transform installed on it. In this case, you might get unexpected results if you cumulatively apply another transform.

Parameters
graphics:Graphics

the Graphics object to protect

paintFaceback to summary
protected void paintFace(Graphics graphics, int size)