Skip to main content

Posts

Showing posts from January, 2018

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...