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



Home Answers Viewqa Java-Beginners how to make multiple rectangles

Have Programming Question? Ask it here!
 
 
 


Vaishnavi Mukundhan
how to make multiple rectangles
0 Answer(s)      a year ago
Posted in : Java Beginners


I,m a beginner , m sorry if the question is really simple
i have an array list.I want to print the contents of the array list in rectangles. as in each element should be in different rectangles. please help my code as of now:(but this doesn't work)

import java.awt.Color;  
import java.awt.Graphics;
import java.util.ArrayList;
import javax.swing.JFrame;

public class Output extends JFrame  
{ 

    /**
     *
     */
    public Output()  
{  
 //Set JFrame title  
 setTitle("Draw A Rectangle In JFrame");  

 //Set default close operation for JFrame  
 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  

 //Set JFrame size  
 setSize(400,400);  

 //Make JFrame visible   
 setVisible(true);  
}  

public void paint(Graphics g)  
{  
    ArrayList <String> classlist=new ArrayList<String>();
   classlist.add("library");
   classlist.add("customer");
   classlist.add("member");
   classlist.add("card");
   classlist.add("yes");


  for(int i=0;i<=classlist.size();i++)
  {    
      super.paint(g);
      int x=i+100;
      int y=i+500;
      int w=x+25;
      int z=y+25;
     String thisCity= classlist.get(i);
 //draw rectangle outline
      super.paint(g) ;
 g.drawRect(x,y,100,100);  
 g.drawString(thisCity,w ,z);
  }
}  

public static void main(String[]args)  
{  

 Output dlijf;  
        dlijf = new Output();
}

}


Advertisement
View Answers

Related Tutorials/Questions & Answers:
how to make multiple rectangles
how to make multiple rectangles  I,m a beginner , m sorry... of the array list in rectangles. as in each element should be in different rectangles...(JFrame.EXIT_ON_CLOSE); //Set JFrame size setSize(400,400); //Make JFrame
how to make multiple choice questions
how to make multiple choice questions  I have to make a multiple choice choice using JSP/Servlets. I created a a session bean for the questions and answers. how to associate group of questions to a user? so each user will have
Advertisements
how to draw lines,circles, rectangles on JSP.
how to draw lines,circles, rectangles on JSP.  how to draw lines,circles, rectangles on JSP. Kindly provide solutions asap
how to draw lines,circles, rectangles on JSP (using Java Graphics)
how to draw lines,circles, rectangles on JSP (using Java Graphics)  how to draw lines,circles, rectangles on JSP (using Java Graphics)   Hello Anuj Try the Following Code : image.jsp <%@ page contentType="image
how make ID - Ajax
how make ID  how make a ID in eyeball chat
How to make elements invisible ?
How to make elements invisible ?   How to make elements invisible
how to make this pattern???
how to make this pattern???  how to make following pattern in javascript
how to make exampage in jsp ?
how to make exampage in jsp ?  how to make a online exam page in jsp and servelet
how to display multiple images on browser
how to display multiple images on browser  i want to display multiple images on brower including string values from sql database using jsp
how to display multiple images on browser
how to display multiple images on browser  i want to display multiple images on brower including string values from sql database using jsp
how to make a program on array
how to make a program on array  When you make a program on array that the element will move downward and upward and when you input twice 0 then thats the time that it will not move. pls. give me a formula...tnx
How to make selectOneMenu scrollable
How to make selectOneMenu scrollable  how to make the selectOneMenu scrollable? I have around 20 values in drop down and i want the scrollable functionality after 5 values. Kindly reply as soon as possible. Thanks Shikha
how make excel
how make excel  how make excel spreadsheet IN JAVA. please send this code argently   Hello Friend, Try the following code: import java.io.*; import org.apache.poi.hssf.usermodel.HSSFSheet; import
how to make paging with function ?
how to make paging with function ?  how to make paging with function ?   //this page is display.php <?php</p> $con=mysql_connect("localhost","root",""); if(!$con) { die("you can connect please check". mysql
how to make a field left justification
how to make a field left justification  how to make a field left justification.need code.thanks in advance
how to make a label left alignment?
how to make a label left alignment?  how to make a label left alignment
How to display multiple images in jsp
How to display multiple images in jsp  <%@ page import="java.io.*"%> <%@page import="book.Databasecon"%> <%@ page import="java.sql.*,java.util.*"%> <%!OutputStream o; %> <%!ArrayList<Blob> bl
How to make a chain, make a chain, chain
How to make a chain       To learn how to design a chain in the photoshop has become so easy by this example, it has some important instruction to make it so follow
how to send mail with multiple attachments in jsp
how to send mail with multiple attachments in jsp  how to send mail with multiple attachments in java script
how to make paging with class and ajax
how to make paging with class and ajax  paging with class and ajax
How to make bubbles, make bubbles, bubbles
How to make bubbles      ... to make it easily to draw. New File: First take colored background file. Draw... Overlay, use same both settings as given below. Duplicate: Now make
How to make directory in java
Description: This example demonstrate how to create a directory at specified path. Code: import java.io.File; public ... is that it will make a dir at root directory of C drive
How to make a transparent text
How to make a transparent text Learn how to make a transparent...) and make formatting as looking here. Write Text: Now write your text as you like. I have written here "Text". After writing text make copy (Ctr
How to make halo effect
How to make halo effect       Now get ready to learn a simple way to make a halo effect on the picture, follow to make it. Take a picture: Capture any picture to give
How to make a bone, make a bone, a bone
How to make a bone       This example bone design example, It is very easy. If you are looking for, please follow now. New File: Create a new file. Rounded rectangle
How to pass multiple values from a servlet to JSP?
How to pass multiple values from a servlet to JSP?  hi, I want to pass multiple values form a servlet to JSP. Hw do i do that? I am able to send one value at a time without any prb, but I am unable to carry multiple (from two
How to Make iPhone Window Application
How to Make iPhone Window Application  Hi, For Making iphone window application, what parameters i have to follow or provide example related to iphone window application. Thanks
How to make query and abstraction in Java
How to make query and abstraction in Java  Hi, I read the lessons you have in the sites. They are really useful. However, I could not write codes... PostgreSQL database, and I want to make a query and abstraction for a table. Could
How to carry multiple values from a Servlet to a JSP?
How to carry multiple values from a Servlet to a JSP?  By using...). ----response.sendRedirect("index.jsp?uname="+username);---- But I want multiple values needs to be carried from my servlet to a JSP. How do I do
How to make a button of different behaviour?
How to make a button of different behaviour?  Suppose In a jsp page I have a button SAVE with id="btnSave" value="SAVE" and a javascript function... ajaxInsertUpdateData(document.getElementByID("btnSave1").value,......); How to do
how to scroll multiple images using on Click in Android
how to scroll multiple images using on Click in Android  I am new... there is requirement like multiple image scrolling dynamically. But unfortunately i am unable to scroll multiple images. But i am able to scroll single image. plz let me know
How servlet Handles Multiple Request - Java Beginners
How servlet Handles Multiple Request  In servlet life cycle,consider two requests are waiting for service(). I know all request will be assigned to thread, which request gets excecuted first. 1
How To Make This Program - Java Beginners
How To Make This Program  How To Make Java Calculation program I want to Write a program in Java that calculates the sum of digits of an input number, prints it, then calculates the sum... output: 59 14 5 please help to make
how to make employee i card
how to make employee i card  hello friends can anyone help me.. I have to make a project to make Identity card for employees...but i am facing problems with database and jsp connection ... also tell me how to retrive data
How to convert multiple files in java to .zip format
How to convert multiple files in java to .zip format  i receive multiple files from a remote URL as for (String reportid : reportList... as to make it available for download.   import java.io.*; import
how to make combinations - Development process
how to make combinations  import java.util.*; interface Expression { public void interpret(ArrayList exp); } class OrExpression implements Expression { public void interpret(ArrayList exp) { //wats the logic
how to use a single web page multiple functionaliteies
how to use a single web page multiple functionaliteies  i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to use a single web page multiple functionaliteies
how to use a single web page multiple functionaliteies  i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to use a single web page multiple functionaliteies
how to use a single web page multiple functionaliteies  i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to use a single web page multiple functionaliteies
how to use a single web page multiple functionaliteies  i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to use a single web page multiple functionaliteies
how to use a single web page multiple functionaliteies  i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to use a single web page multiple functionaliteies
how to use a single web page multiple functionaliteies  i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to make paging with class and ajax
how to make paging with class and ajax  paging with class and ajax... displayLinks($show){ $this->show = $show; // How many links to show... displayLinks($show){ $this->show = $show; // How many links
How to make a design document for exception handling in java
How to make a design document for exception handling in java  How to make a design document for exception handling
How to change focus among multiple select boxes?
How to change focus among multiple select boxes?  Hello, I have three select boxes in three divs. All of the select boxes are focused when I click them one after the other. I want only one select box to be focused at a time
how can i make monthly register ?
how can i make monthly register ?  how can i make monthly register ? iam using jdeveloper
Multiple Namespace
Defining multiple namespace in a single file: In a single PHP file we can declare more than one namespace. PHP allow two syntaxes to declare more than one... namespace in a single file. It is strongly discouraged to combine multiple
how to make traffic light code in java
how to make traffic light code in java  what is code of traffic light in java
how to Change column name and Make a unique column.
how to Change column name and Make a unique column.   how to Change column name and Make a unique column.   Hi, Following queries are used to rename a column and to make a column unique. for rename a column- alter
How to make phone call from web application
How to make phone call from web application  I'm creating an XHTML... to make call to a specific number when user clicks a particular button. Please suggest on how to do this. I'm new to this. Thanks in advance
Advertisements
 

 

 

DMCA.com