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
Related Tutorials/Questions & Answers:
how to make multiple rectangleshow 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 questionshow 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 arrayhow 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 scrollableHow 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 excelhow 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 bubbles, make bubbles, bubbles
How to
make bubbles
... to
make it easily to draw.
New File: First take colored background file.ADS....
ADS_TO_REPLACE_3
Duplicate: Now
make duplicate layer and press
Ctr
How to make directory in javaDescription:
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... mask
tool (T key) and
make formatting
as looking here.
Write Text: Now write... text
make copy (Ctr +C) and past (Ctr + V).ADS_TO_REPLACE_2
Drop Shadow: Go
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.ADS_TO_REPLACE_1
How to make a new List in JavaHow 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
(adsbygoogle = window.adsbygoogle || []).push({});
Hi,
The easiest way is to use
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 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 iPhone Window ApplicationHow 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 JavaHow 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 display multiple images in jspHow 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 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 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 Make This Program - Java BeginnersHow 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 cardhow 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 scroll multiple images using on Click in Androidhow 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 to make combinations - Development processhow 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 make paging with class and ajaxhow 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 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 login form in Struts 2?How to
make login form in Struts 2? Hi,
How to
make login form in Struts 2?
Thanks
Hi,
If you want to learn to
make Login form in Struts then check following tutorial:
How to create Login Form in Struts2?
Thanks