View RSS Feed

All Blog Entries

  1. AWT Text Layout

    by , 03-04-2012 at 05:41 PM
    Text characters shall be laid out by using proper glyphs, in a proper position. This is done before the text gets displayed. To manage the text layouts, these Java 2D mechanisms are used.

    Following is managed by the TextLayout:
    1. Text layout
    2. Hit detection
    3. Highlighting

    To handle cases, the TextLayout gives these facilities.

    1. Strings along with mixed fonts
    2. Bidirectional text
    3. Mixed languages

  2. Java AWT Fonts

    by , 03-04-2012 at 05:39 PM
    Glyphs are those shapes which are being used in a font to present string characters. A particular character or combination of characters is presented by the help of glyphs. E.g.

    • á is presented by 2 glyphs
    • The ligature fi is presented by the help of one glyph

    Collection of glyphs makes a font. Different faces are there for one single font, like regular, italic or bold. In font, all faces consist of same typographic features and are known to be the members ...
  3. Java AWT Text

    by , 03-04-2012 at 05:38 PM
    Text rendering capabilities are provided by the Java 2D API. These methods are included:
    • Rendering Strings
    • Text layouts are performed
    • Entire classes to set the font attributes

    Graphic class’s drawstring method is used to draw the static string. To render directly, this would be the direct approach. SetFont method is used for specification.

    Java 2D Layout class is used to do the implementation of text editing routines. Also, it might help you to have the ...
  4. Geometric Primitives

    by , 03-04-2012 at 05:36 PM
    Following set of the standard shapes are provided by the Java 2D API.
    • Points
    • Ellipses
    • Rectangles
    • Lines
    • Arcs
    • Curves

    To define geometric primitives, package java.awt.geom is considered to be the important one. By integration as well as the combination of straight geometric primitives, you can present arbitrary shapes.
    Shape interface which consists of an outline & interior, presents the geometric shape. These set of methods are provided by this interface. ...
  5. Java 2D Rendering

    by , 03-04-2012 at 05:35 PM
    Uniform rendering model is provided by the Java 2D™ API, across number of devices. Rendering process is similar at the application level no matter the targeted rendering devices is printer or screen. Update/ paint method automatically gets invoked (with appropriate graphic context) if component is required to displayed
    Class java.awt.Graphics2D is included in Java 2D API that provides graphic class an extension so that to give rendering feature and enhanced graphic access. Features included ...
  6. Java 2D API

    by , 03-04-2012 at 05:34 PM
    Following capabilities are provided for the Java program by the Java 2D API via Awt extensions.
    • 2D graphics
    • Image capabilities
    • Text capabilities

    Following supports are provided by these comprehensive rendering packages:
    • Text
    • Line art
    • Images
    • Sophisticated drawing program
    • Full featured framework to create a rich user-interface
    • Image editor

    These capabilities are being provided by the Java 2D API:
    • Rendering model (uniform) to
    Tags: java 2d api Add / Edit Tags
  7. Java 2D Graphics

    by , 03-04-2012 at 05:33 PM
    By the help of The Java 2D API, following tasks are performed easily.

    • Lines are drawn. Rectangles and many other geometric shapes are created.
    • Shapes are filled with gradients or solid colors & textures.
    • Text is drawn along with fine control at the font or rendering process
    • Images are drawn by application of the filtering operations.
    • Operations are applied like transformation or composition while doing the mentioned rendering operations.
  8. Java Graphics

    by , 03-04-2012 at 05:32 PM
    For graphic contexts, abstract base call is the Graphic class. Graphic class permits:

    • Applications to draw the components which have been realized at different devices.
    • Applications to draw the screen images off.

    Graphic objects encapsulate the information that has been stated required to do basic rendering. Following properties are included in the state information.

    1. The Component object.
    2. Translation origin to clip & render ...
  9. ComponentEvent

    by , 03-04-2012 at 05:30 PM
    The ComponentEvent is known as a low leveled event which indicates

    1. Changed Size
    2. Component Moved
    3. Change Visibility

    For sake of notifications, the component events are required. Resizing as well as component moves are handled automatically by AWT. Layout of GUI properly works without taking any special care for all events.

    For other events, this is considered to be a base class:

    • InputEvent
    • WindowEvent ...
  10. MouseEvent

    by , 03-04-2012 at 05:29 PM
    Mouse actions that take place in component are indicated by the MouseEvent. In a particular component, mouse action takes place if there is mouse cursor at the unobscured component parts, when such action occurs.

    In case of the lightweight components when mouse event are enabled at component, they are just dispatched to component.

    Appropriate EventListener addition to the mouse event takes place to enable them. If they are not enable at component the correspondent mouse ...
    Tags: mouseevent Add / Edit Tags
  11. Java AWT Events

    by , 03-04-2012 at 05:27 PM
    Various event types are generated by AWT application. Application is made efficient & effective by the help of such events. In Java AWT, twelve event types are used. They are:

    • ActionEvent
    • ComponentEvent
    • InputEvent
    • TextEvent
    • ContainerEvent
    • AdjustmentEvent
    • FocusEvent
    • ItemEvent
    • MouseEvent
    • KeyEvent
    • PaintEvent
    • WindowEvent
  12. Layout Managers and Containers

    by , 03-04-2012 at 05:26 PM
    A container must contain a layout manager to perform its work. If a layout manager is not associated with a container, the container will place the components wherever specified using following methods.
    A layout manager must be present in a container so that work could be performed. If container and layout manager are not associated with each other, the components will be placed by the container wherever specified by using these methods.

    1. setBounds()
    2. setSize()
    3. setLocation()
  13. GridBagLayout

    by , 03-04-2012 at 05:24 PM
    Components are arranged into grid of columns and rows by the GridBag Layout just the way grid layout manager did so. It also lets you to do the proper specification of the settings so that the components are positioned and sized in cells.

    It is not necessary for all components to be of one uniformed size. E.g. component’s position at grid can be changed or can be spanned to various columns & rows.

    Components present in longest row are used by the layout manager. ...
  14. GridLayout

    by , 03-04-2012 at 05:23 PM
    All components are arranged by the Grid layout manager. This arrangement is done in grid of columns and rows. One of the given options may be selected.
    • Number of columns & rows shall be specified.
    • Only rows are specified and no. of columns will be determined by the layout manager.
    • Just columns are specified and no. of rows will be determined by layout manager.

    Objects present in the layout manager grid have equal sizes which are based at the grid’s largest components. ...
    Tags: gridlayout Add / Edit Tags
  15. CardLayout

    by , 03-04-2012 at 12:12 PM
    Among number of component children, one container is displayed by the help of a card layout. This is similar to the flip cards present at your table. In a program, it can be used so that to show out various child component, to number of users.

    E.g. Interface might have different kind of functionality as shown to user in comparison with that interface which is displayed to administrator. Appropriate interfaces are shown by card layout’s help.

    Usage of the choice components ...
    Tags: cardlayout Add / Edit Tags
  16. FlowLayout

    by , 03-04-2012 at 12:09 PM
    Flow layout is considered as the default layout manager for all applets or panel objects. All components are placed by the flow layout in rows, totally in accordance with panel’s width & size or total no. of components.
    Resizing of the windows shall be done to understand fully the flow layout. It will show you that how from one row, components will float to other.

    Flow layout is given as following.

    Name:  1.JPG
Views: 376
Size:  22.5 KB
    Tags: flowlayout Add / Edit Tags
  17. BorderLayout

    by , 03-04-2012 at 11:52 AM
    Border Layout is for all objects of window’s default layout. There are 5 fixed areas of it, which are:
    1. North
    2. West
    3. Center
    4. South
    5. East

    For container, this given figure illustrates the border layout that has been implemented.
    • In north area, Border Layout Label is present.
    • In the South area, Ok button is present.
    • In the Center area, FRUIT trees list is present.
    • Empty east area.
    • Empty West area. ...
    Tags: borderlayout Add / Edit Tags
  18. List of Layout Managers

    by , 03-04-2012 at 11:49 AM
    Pre-defined entire layout manager is present in java.awt. Interface java.awt.LayoutManager is implemented by the layout manager.

    Every AWT i.e Abstract Windows Toolkit & swing container consists of a pre-defined default layout manager.
    • container.setLayout can be used for setting or changing the layout manager.
    • Interface java.awt.LayoutManager is implemented for customized layout manager.

    Layout managers that are pre-defined are given here:
    • java.awt.BorderLayout
    • java.awt.FlowLayout
    • java.awt.CardLayout
    • java.awt.GridLayout
    • java.awt.GridBagLayout
  19. What is a Layout Manager?

    by , 03-04-2012 at 11:48 AM
    Layout manager is considered responsible for controlling the size or position of those components which are present in container object. E.g, different components (like buttons & labels) are present in window container. Components present in windows are Positioned and re-sized by layout manager.

    One container may possess other container in it. Like, one container window may contain container panel. Given figure shows the purposes of layout manager.

    1. Resizing ...
  20. Robot class Control functions

    by , 03-04-2012 at 11:46 AM
    Robot class uses these control functions:

    Mouse control functions

    void mouseMove(int x, int y):To coordinate (x,y), mouse cursor is moved by using this function. At screen’s top corner (left), coordinated are shown.
    Java Code:
    void mousePress(int buttons)
    void mouseRelease(int button)
    Button clicks are performed by this function pair. Input arguments are as following:
    java.awt.event.InputEvent.BUTTON1_MASK   // left mouse button 

    Updated 03-04-2012 at 12:07 PM by Java AWT

  21. How to use Robot class in Java?

    by , 03-04-2012 at 11:43 AM
    For controlling the keyboard or mouse, class java.awt.Robot will be used. Any kind of operation regarding mouse or keyboard can be performed once one has the control over mouse & keyboard. Usually such class type is used while doing test automation.

    Robot class which handles the keyboard events will be shown up by using this code. If this code is run, a notepad will be opened to write down “HI MY FRIEND”.
    Java Code:
    import java.awt.AWTException; 
    import java.awt.Robot;
  22. Robot Class

    by , 03-04-2012 at 11:42 AM
    In many applications, like self running demos or test automation, the Robot class is used. It is required in those circumstances where keyboard control as well as mouse is needed. “Native system” input events are generated by the class robot. The basic purpose is to facilitate the Java platform’s automated testing implementations.

    Generation of the input events by the Robot class is totally a separate thing as compared to the posting of the events to AWT components or event queue. ...
    Tags: robot class Add / Edit Tags
  23. System Tray Helpful Features

    by , 03-04-2012 at 11:40 AM
    • Method setImage() is used to show the changed status of an application in your program. Its syntax is as following: trayIcon.setImage(updatedImage);
    • Tooltip can be obtained or set for Traylcon. When mouse is at Traylcon, it will be shown. For an operating system, it gets displayed that is dependent at the time period.
    • trayIcon.setTooltip("I'm busy. Go away.");
    • For Traylcon, auto size property is present. Image is fitted as well as auto sized by it. By default, it’s set to false.
    Tray , Java AWT
  24. Implementing Tray Icons

    by , 03-04-2012 at 11:39 AM
    One or more than one instances could be added of java.awt.TrayIcon to the System Tray. Removal or addition methods are used to add/remove the Traylcons. Presentation of tray icon is basically the Traylcon which can be removed or added, from any SystemTray. The functionality of the Traylcon is more as compared to what has been shown in tray. Following can be present in it.

    1. AWT “popup menu”
    2. Set of listeners associated
    3. Text tooltip

    Many MouseEvenets are generated ...
    Tags: tray icons Add / Edit Tags
    Tray , Java AWT
  25. Accessing the System Tray

    by , 03-04-2012 at 11:37 AM
    System tray could be accessed by the Java. In Java, class java.awt.SystemTray presents the system tray, for desktop. The static method SystemTray.getSystemTray() calls the operating system’s System tray.
    SystemTray.isSupported() is used for checking whether it provides support, before its access. It throws in case if it doesn’t support or is not checked for support.

    1. Just one SystemTray’s instance is present in Java application.
    2. SystemTray’s
    Tags: system tray Add / Edit Tags
    Tray , Java AWT
  26. What Is the System Tray?

    by , 03-04-2012 at 11:35 AM
    At desktop’s bottom, a specific area named as “the system tray” exists. Operating system user always has the access to this area.

    1. Referred as system tray in KDE.
    2. In windows, it is also known as Taskbar Status area.
    3. It is known as notification area in case of a Gnome desktop.

    This area is accessed as well as shared all times in any operating system, by all applications.
    The given figure illustrates the system tray at Linux as well as MS ...
    Tags: system tray Add / Edit Tags
    Tray , Java AWT
  27. Sorting Arrays

    by , 03-04-2012 at 11:26 AM
    To sort arrays, static methods are provided by the class java.util.Arrays. Kinds of arrays that are supported by it are as following:

    i. Arrays of object types
    ii. Arrays of primitive types

    It is possible to apply the sorting method to range of arrays or some particular part. It is also applicable to the whole array.

    For object type array comparators shall be provided so that to define it to such kind of sorting. Few Array methods are explained ...
  28. Multidimensional arrays

    by , 03-04-2012 at 11:24 AM
    Array of arrays also consists of multi dimensional arrays. Multi-dimensional variables could be declared by specifying the every extra index. This is done by using square bracket set.
    Java Code:
    For example: 
    int myArray[ ][ ] = new int[5][6] ;
    In case of a multi-dimensional array, memory is allocated by specifying memory for leftmost (1st) dimension.

    Rest of the dimensions can be allocated separately.

    In multi-dimensional array, every array’s ...
  29. Two-Dimensional Arrays

    by , 03-04-2012 at 11:23 AM
    2 dimensional arrays are known to be the array of arrays. Number of array types is present, for example:

    1. Array of Strings
    2. Array of ints
    3. Array of Objects

    Array of int consists of type int[]. Two dimensional array will have int[][]. It might also be known as array of arrays of the ints. Such type of arrays are known as 2D arrays.

    int[][] array = new int[5][6];
    Array or variable of type int[][] gets declared. Variable ...
  30. arrays are passed by reference

    by , 03-04-2012 at 11:20 AM
    By reference, array is passed to functions. Or it is passed to original as a pointer. This shows that anything which happens to an array in a function would be affecting the original.

    For understanding an array is passed by reference

    Step 1) In editor, code shall be copied

    Java Code:
    class ArrayDemo {
       public static void passByReference(String a[]);
         a[1] = "Changed";
       public static
Page 18 of 48 FirstFirst ... 8161718192028 ... LastLast