Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Reshmi Rajan
AWT Image
1 Answer(s)      3 years and 4 months ago
Posted in : Java Beginners


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.


Advertisement
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
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
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
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
awt
JDBC in awt  how to display data using JDBC in awt/applet
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
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
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
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 & 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
awt in java
awt in java  using awt in java gui programming how to false the maximization property of a frame
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
Advertisements
 

 

 

DMCA.com