how to make multiple rectangles
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();
}
}
View Answers
Ads
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 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 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 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 a new List in Java
How to
make a new List in Java Hi,
I have to create list object in Java.
How to
make a new List in Java?
Thanks
Hi,
The easiest way is to use the new operator as shown below:
List list = new ArrayList
How to make first JSP page?
How to
make first JSP page? Hello,
How I can
make first JSP page?
Thanks
HI,
Beginner can learn JSP from writing the first Program... tutorial:
How to
make my first JSP page?
Thanks
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 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 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 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 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 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 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 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 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 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 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