Skip to main content

Posts

Swing progarm in java

                      Swing java program Eg 01  package PRACTICEPROGRAM; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; class DrawPanel extends JPanel {     public void paintComponent(Graphics g) {         super.paintComponent(g);         Graphics2D g2d = (Graphics2D) g;         g2d.setColor(Color.blue);         for (int i = 0; i <= 1000; i++) {             Dim...

Painting in swing in java

                            Painting in swing                                                         Painting is used, when we want to change or enhance an existing widget. Or if we are creating a custom widget from scratch. To do the painting, we use the painting API provided by the Swing toolkit. The painting is done within the paintComponent() method. In the painting process, we use the Graphics2D object. 2D Vector Graphics There are two different computer graphics. ·          Vector graphics ·           raster graphics Raster graphics represents images a...

Swing's in java

                                   Swing   in java   Swing is the Java platform's UI -- it acts as the software to handle all the interaction between a user and the computer. It essentially serves as the middleman between the user and the guts of the computer. How exactly does Swing do this? It provides mechanisms to handle the UI aspects described in the previous panel: • Keyboard: Swing provides a way to capture user input. • Colors: Swing provides a way to change the colors you see on the screen. • The address bar you type into: Swing provides text components that handle all the   mundane tasks. • The volume of the music: Well ... Swing's not perfect. In any case, Swing gives you all the tools you need to create your own UI. Swing library is an official Java GUI tool...

Use of font class in awt Java

                        Use of font class import java.applet.*; import java.awt.*; /*             <applet code="FontDemo" height=400 width=400>             </applet> */ public class FontDemo extends Applet {             public void paint(Graphics g)             {                         String fname="Roman";                         int type=Font.PLA...