AWT Image

AWT Image

I have loaded two images using toolkit in java.one is concentric rectangle and other is concentric circle.kindly someone send me the source code of interchanging the inner most rectangle with the inner most circle and inner circle with inner rectangle.

View Answers

June 28, 2011 at 5:27 PM

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

class DrawRectAndCir extends JPanel{
    public void paint( Graphics g ) {
g.drawOval (50, 10, 220, 220);
g.drawOval (70, 30, 180, 180);
g.drawOval (90, 50, 140, 140);
g.drawOval (110, 70, 100, 100);
g.drawOval (130, 90, 60, 60);
g.drawRect (150, 110, 20, 20);

g.drawRect (300, 10, 300, 220);
g.drawRect (320, 30, 260, 180);
g.drawRect (340, 50, 220, 140);
g.drawRect (360, 70, 180, 100);
g.drawRect (380, 90, 140, 60);
g.drawOval (400, 110, 100, 20);

   }
}

public class DrawConcentricRectangleAndCircles extends JPanel {

  public void paint(Graphics g) {
g.drawOval (50, 10, 220, 220);
g.drawOval (70, 30, 180, 180);
g.drawOval (90, 50, 140, 140);
g.drawOval (110, 70, 100, 100);
g.drawOval (130, 90, 60, 60);
g.drawOval (150, 110, 20, 20);

g.drawRect (300, 10, 300, 220);
g.drawRect (320, 30, 260, 180);
g.drawRect (340, 50, 220, 140);
g.drawRect (360, 70, 180, 100);
g.drawRect (380, 90, 140, 60);
g.drawRect (400, 110, 100, 20);
  }


  public static void main(String s[]) {
  final JFrame frame = new JFrame("Show Triangle");
  final JPanel p = new DrawConcentricRectangleAndCircles();
  final JPanel p1=new DrawRectAndCir();
  JButton b=new JButton("Convert");
  b.setSize(100,20);
  b.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
         p.setVisible(false);
         frame.getContentPane().add("Center", p1);
          p1.setVisible(true);
      }
  });
  p1.setVisible(false);
  frame.getContentPane().add("Center", p);
   frame.getContentPane().add("South", b);

  frame.setSize(650,320);
  frame.show();
  }
}









Related Tutorials/Questions & Answers:
AWT Image
AWT Image  I have loaded two images using toolkit in java.one is concentric rectangle and other is concentric circle.kindly someone send me the source code of interchanging the inner most rectangle with the inner most circle
Image Manipulation in Swing AWT
Image Manipulation in Swing AWT  Sir, I'am new to Swing Programming. I have to create an application where an image is displayed on one Label. The same image has to be split in parts and stored in database pert wise. Later
Advertisements
loading image - Swing AWT
loading image  give me a source code to add any wallpaer of my PC as a background image to jpanel on a jframe
Image Selection - Swing AWT
Image Selection  Hi, I need to provide the image selection facility... click on any item, the image of that item should be selected as done in windows...; JButton saveButton; public DisplayImage() { super("Image Selection program
displaying image in awt - Java Beginners
displaying image in awt  Hi All, I have downloaded the code to display image using awt from here and when I execute the code I am getting... ActionListener{ JFrame fr = new JFrame ("Image loading program Using awt"); Label
how to set a image in frame? - Swing AWT
how to set a image in frame?  how to set a image in frame using swing
Error in laodin and saving the image . - Swing AWT
Error in laodin and saving the image .  I am a student who had... facing problem while laoding and saving the image with help of JFileChooser class... class UploadImage extends JPanel { static BufferedImage image; static File
how to retrive other details with an image - Swing AWT
to retrive an image as well as some other values from database.. but only image..... followingis my code..plz advice me how to get both values as well as image at a same...("Select visitor_firstname,Type_code, image_data from visiting_details where Ticket
java image loadin and saving problem - Swing AWT
java image loadin and saving problem  hey in this code i am trying to load a picture and save it.........but image is only visible whn we maximize... extends JPanel { static BufferedImage image; static File file=null; Image img
AWT
AWT  How to set size of button in awt
awt
Java AWT Applet example  how to display data using JDBC in awt/applet
awt
JDBC and AWT to display data  how to display data using JDBC in awt/applet
awt
JDBC in awt applet  how to display data using JDBC in awt/applet
put image on form creating in swing-swing code - Swing AWT
put image on form creating in swing-swing code  i want to display image on swing panel and get the image co ordinate by mouse clicking.and also zoom the image at particular area of image. please give solution on my email id
awt
JDBC in awt  how to display data using JDBC in awt/applet
Image is in same folder where the java file is located - Swing AWT
Image is in same folder where the java file is located  dear sir It is there in the same folder..means the photograph.jpg file is created in the same folder where my java file is present... wat I should do sir
how to set image in button using swing? - Swing AWT
how to set image in button using swing?  how to set the image in button using swing?  Hi friend, import java.awt.*; import... FlowLayout()); getContentPane().add(myJButton); setTitle("Image on Button
hybrid digital image embedding process using invisible watermarking - Swing AWT
hybrid digital image embedding process using invisible watermarking   sir/madam, I am subramanian from chennai.i did not create this project using rsa algorithm and i did not understand.please help me with source
Image on Frame in Java AWT
Image on Frame in Java AWT       Introduction In this section, you will learn how to display image on the frame. This program shows you how to display image in your application
AWT programmes - Swing AWT
AWT programmes  I need few programs for menus in AWT. how to open a filed dialog window, and how to save a image in the save window when we press... has all AWT programms which must open,save and make changes to a particular
AWT & SWING
AWT & SWING  What is diffennce between AWT & SWING
awt swings - Swing AWT
awt swings  hello sir, My requirement is to insert captured image......  Hi friend, This code will be captured your image. Please...(); BufferedImage image = robot.createScreenCapture(new Rectangle
image
image  how to add the image in servlet code
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
awt in java
awt in java  using awt in java gui programming how to false the maximization property of a frame
image
image   Dear every body please help me how to add and retrive image and video into oracle 11g using jsp
Java AWT
Java AWT  What interface is extended by AWT event listeners
awt jdbc
awt jdbc  programm in java to accept the details of doctor (dno,dname,salary)user & insert it into the database(use prerparedstatement class&awt
awt - Swing AWT
awt  dear sir my proble is , i have applet code which is stock market chart this code made using "AWT" . in this chart one textbox when user.../java/awt/ Thanks
Java AWT
Java AWT  What is meant by controls and what are different types of controls in AWT
Image Size
Image Size       This Java awt (Abstract Windowing Toolkit) tutorial describes about the image size...;ADS_TO_REPLACE_1 This program helps you in setting an image and getting
AWT-swings tutorial - Swing AWT
AWT-swings tutorial  hello sir, i am learnings swings and applets.. i want some tutorials and some examples related to swings.. thank you sir..waiting for your answer.  Hi friend, I am sending you a link
AWT Tutorials
AWT Tutorials  How can i create multiple labels using AWT????   Java Applet Example multiple labels 1)AppletExample.java: import javax.swing.*; import java.applet.*; import java.awt.*; import
JAVA AWT BASE PROJECT
JAVA AWT BASE PROJECT  suggest meaningful java AWT-base project
java awt calender
java awt calender  java awt code for calender to include beside a textfield
awt list item* - Swing AWT
awt list item*  how do i make an item inside my listitem not visible  Hi friend, import java.awt.*; import java.awt.event.... information. http://www.roseindia.net/java/example/java/awt/ Thanks
AWT
Java AWT event hierarchy
Java AWT event hierarchy  What class is the top of the AWT event hierarchy?  The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy
AWT code for popUpmenu - Swing AWT
AWT code for popUpmenu  Respected Sir/Madam, I am writing a program in JAVA/AWT.My requirement is, a Form consists of a "TextBox" and a "Button... for more information. http://www.roseindia.net/java/example/java/awt/pop
java - Swing AWT
What is Java Swing AWT  What is Java Swing AWT
Basic Diffence between Swing-AWT - Swing AWT
Basic Diffence between Swing-AWT  What is Basic Diffence between Swing-AWT
awt - Java Interview Questions
awt  what is the difference between awt and swings  Hi friend, These are basically the main differences between awt and swing. 1.swing components sits on the top of AWT components and do the wiork. 2.AWT
Swing and AWT Problem - Swing AWT
Swing and AWT Problem  hi sir i have a problem i know from one Jframe we can send values to another Jframe. so in my project i have one fame containing three textfields CODE: String a=TNa.getText().toString(); String b
Java AWT Package Example
.   Image Size This Java awt (Abstract Windowing... Java AWT Package Example       In this section you will learn about the AWT package of the Java
What is AWT in java
What is AWT in java In this Example we will describe awt in java. The awt in java stands for Abstract Windowing Toolkit and is a package available with JDK. awt contains all classes and develops user interface objects like
query - Swing AWT
java swing awt thread query  Hi, I am just looking for a simple example of Java Swing
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException  ... is clicking I getting the error : Exception in thread "AWT-EventQueue-0... { Image m; Thread t; NextPage(final String uname
AWT basics
AWT basics Are you looking for the AWT Basics to help you learn AWT quickly? Here we have provided you the links to our AWT tutorials. AWT stands.... Now a day?s developers are using Swing components instead of AWT to develop

Ads