Help Center
Local Navigation
- Creating user interfaces
- Screens
- Touch screen orientation and direction
- Working with the accelerometer of a BlackBerry device
- Types of accelerometer data
- Accelerometer
- Retrieve accelerometer data at specific intervals
- Query the accelerometer when the application is in the foreground
- Query the accelerometer when the application is in the background
- Store accelerometer readings in a buffer
- Retrieve accelerometer readings from a buffer
- Get the time a reading was taken from the accelerometer
- UI components
- Add a UI component to a screen
- Create a dialog box
- Create a bitmap
- Create a button
- Create a list
- Create a drop-down list
- Create a search field
- Create a check box
- Create an option button
- Create a date field
- Creating a text field
- Create a progress indicator
- Create a text label
- Create a list box
- Create a field to display a tree view
- Add a UI component to a screen
- Create a custom field
- Add a menu item to a BlackBerry Device Software application
- Adding a menu item to a BlackBerry Device Software application
- Register a menu item
- Arrange UI components
- Events
- Touch screen events
- Types of touch screen events
- Respond to touch screen events
- Respond to system events while the user touches the screen
- Respond to a user sliding a finger up quickly on the screen
- Respond to a user sliding a finger down quickly on the screen
- Respond to a user sliding a finger to the left quickly on the screen
- Respond to a user sliding a finger to the right quickly on the screen
- Respond to a user clicking the screen
- Respond to a user touching the screen twice quickly
- Respond to a user touching and dragging an item on the screen
- Respond to a user touching the screen lightly
- Respond to a scroll action
- Respond to a user touching the screen in two locations at the same time
- Keyboard on a BlackBerry device with a touch screen
- Spell check
- Accessibility
- Integrating with assistive technology software
- Notifying an assistive technology application when the UI changes
- UI changes that trigger a notification to an assistive technology application
- UI component states and properties
- Provide an assistive technology application with information about a UI change
- Provide an assistive technology application with information about text changes
- Provide an assistive technology application with access to information from a table
- Provide an assistive technology application with access to numeric values
- Enable an assistive technology application to receive notification of UI events
- Storing data
- Creating connections
- Managing applications
- Using custom messages and folders in the message list
- Applications for push content
- Localizing BlackBerry device applications
- Controlling access to APIs and application data
- Testing a BlackBerry device application
- Packaging and distributing a BlackBerry Java Application
- Glossary
- Provide feedback
- Legal notice
BlackBerry Manuals & Help
>
Documentation for Developers
>
Java Development Guides and API Reference
>
Development Guide - BlackBerry Java Development Environment - 4.7.0
Manage a drawing area
The Graphics object represents the entire drawing surface that is available to the BlackBerry® device application. To limit this area, divide it into XYRect objects. Each XYPoint represents a point on the screen, which is composed of an X co-ordinate and a Y co-ordinate.
- Import the following classes:
- Create XYPoint objects, to represent the top left and bottom right points of a rectangle. Create
an XYRect object using the XYPoint objects, to create a rectangular clipping region.
XYPoint bottomRight = new XYPoint(50, 50); XYPoint topLeft = new XYPoint(10, 10); XYRect rectangle = new XYRect(topLeft, bottomRight);
- Invoke Graphics.pushContext() to make drawing calls that specify that the region origin should not adjust the drawing offset.
Invoke Graphics.pushContext() to push the rectangular clipping region
to the context stack. Invoke Graphics.drawRect()
to draw a rectangle,
and invoke Graphics.fillRect() to fill the rectangle. Invoke Graphics.popContext() to pop the current context off of the context stack.
graphics.pushContext(rectangle, 0, 0); graphics.fillRect(10, 10, 30, 30); graphics.drawRect(15, 15, 30, 30); graphics.popContext(); graphics.drawRect(15, 15, 30, 30); graphics.pushContext(rectangle, 0, 0); graphics.fillRect(10, 10, 30, 30); graphics.drawRect(15, 15, 30, 30); graphics.popContext(); graphics.drawRect(15, 15, 30, 30);
- Invoke pushRegion()
and specify that the region origin should adjust the drawing offset.
Invoke Graphics.drawRect()
to draw a rectangle and invoke Graphics.fillRect() to fill a rectangle. Invoke Graphics.popContext()
to pop the current context off of the context stack.
graphics.pushRegion(rectangle); graphics.fillRect(10, 10, 30, 30); graphics.drawRect(15, 15, 30, 30); graphics.popContext();
- Specify the portion of the Graphics object to push onto the stack.
- After you invoke pushContext() (or pushRegion()), provide the portion of the Graphics object to invert.
graphics.pushContext(rectangle); graphics.invert(rectangle); graphics.popContext();
- Invoke translate(). The XYRect is translated from its origin of (1, 1) to an origin of (20, 20). After translation, the bottom portion of the XYRect object extends past the bounds of the graphics context and clips it.
XYRect rectangle = new XYRect(1, 1, 100, 100); XYPoint newLocation = new XYPoint(20, 20); rectangle.translate(newLocation);
Parent topic: Screens