December 12, 2008 at 1:54 AM
Hi friend,
Code to help in solving the problem :
import javax.swing.*;
import java.awt.event.*;
public class DimensionItemList{
public static void main(String[] args) {
DimensionItemList di = new DimensionItemList();
}
public DimensionItemList(){
String name[] = {"aaa","bbb","ccc","ddd","eee"};
JFrame frame = new JFrame("Setting the Dimensions of an Item in a JList Component");
JPanel panel = new JPanel();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
DefaultListModel model = new DefaultListModel();
for(int i = 0; i < name.length; i++)
model.addElement(name[i]);
JList list = new JList(model){
public String getToolTipText(MouseEvent e) {
int index = locationToIndex(e.getPoint());
if (-1 < index) {
String item = (String)getModel().getElementAt(index);
return item;
} else {
return null;
}
}
};
list.setPrototypeCellValue("RoseIndia.net");
panel.add(list);
frame.add(panel);
frame.setSize(400,400);
frame.setVisible(true);
}
}
For more information on Swing visit to :
http://www.roseindia.net/java/example/java/swing/Thanks
Related Tutorials/Questions & Answers:
How to save data - Swing AWTHow to
save data Hi,
I have a problem about
how to
save data ,but
first before
data save to dababase,
data must view in jLisit or Jtable...
save data from jList and Jtable(in jList or jTable
data will be many).Thank's
Advertisements
How can we save a data list in jsf?How can we
save a
data list in jsf? I have a code in jsf that fires a query in
Data Base each time it is called, i have added a validation check... it is called again. I tried using
save State but it did not help as other functions got
save data in excelsave data in excel hello sir,
i'm new to this field i want to know can i
save data in excel by html forms input,means if any one fill up form online then it is
save offline in excel
how can i do it can you give me solution sir
save data in excelsave data in excel hello sir,
i'm new to this field i want to know can i
save data in excel by html forms input,means if any one fill up form online then it is
save offline in excel
how can i do it can you give me solution sir
save data DAOsave data DAO
how to
save data in db
package com.tcs.ignite.dao;
import com.tcs.ignite.bean.User;
import com.tcs.ignite.connection.Connectiondetails;
import java.sql.ResultSet;
import java.sql.SQLException;
import
How to save value in JSPHow to
save value in JSP Employee Name Time-IN Time-OUT... 324 2012-12-12
save
i want to
save dis value jsp to action ...
how can i get all value ..and store..
how can its values goes
Save the input data until user get changedSave the input
data until user get changed I would like to know
how to store the give input
data and perform the calculations even after re-opening... know
how to change the fine amount and store for a day by the ADMINISTRATOR
Save the input data until user get changedSave the input
data until user get changed I would like to know
how to store the give input
data and perform the calculations even after re-opening... know
how to change the fine amount and store for a day by the ADMINISTRATOR
Save the input data until user get changedSave the input
data until user get changed I would like to know
how to store the give input
data and perform the calculations even after re-opening... know
how to change the fine amount and store for a day by the ADMINISTRATOR
To save table format data in pdf/excel in jspTo
save table format
data in pdf/excel in jsp Hello,
I am doing web... table. So my question is ,I want so
save this html format
data in pdf/excel format... can
save html table
data in pdf/excel format.Your inputs are valuable to me
save switch data into database - Java Beginnerssave switch
data into database switch(menu) {
case 1://add a student
System.out.print("Enter student ID: ");
int ID = scan.nextInt();
System.out.print("Enter your name: ");
String name = scan.next();
break
SQLGrammarException while trying to save data in dbSQLGrammarException while trying to
save data in db //hibernate cfg file//
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN
How to save file in vi editor?How to
save file in vi editor? Hi,
I am trying to find commands... the commands?
Thanks
Hi,
Here are the details:
How to
save file... :w to
save the file
Type :wq to
save and quit
Type :
q! to quit without saving
How to save image on the server by appletHow to
save image on the server by applet HI, in my project I am... If user want to export this chart as GIF format then this chart should be
save as a gif image on the server directory. Can any Body help me
how can I do it
Thanks
How to save image on the server by appletHow to
save image on the server by applet HI, in my project I am... If user want to export this chart as GIF format then this chart should be
save as a gif image on the server directory. Can any Body help me
how can I do it
Thanks
How to save JPanel as gif or jpeg fileHow to
save JPanel as gif or jpeg file i draw polygons , rectangles, lines on jpanel using draw line method drawpolygon methods etc, now i want
save the
data of jpanel which is drawn by me(lines,polygons) as a gif or jpeg file
How to save image after edit in phpHow to
save image after edit in php Hello,
I have create a simple... successfully but i don't know
how to replace orignal image with the effects. please...;body>
<form name="form1" action="index.php" enctype="multipart/form-
data How to save JPanel as gif or jpeg fileHow to
save JPanel as gif or jpeg file i draw polygons , rectangles, lines on jpanel using draw line method drawpolygon methods etc, now i want
save the
data of jpanel which is drawn by me(lines,polygons) as a gif or jpeg file
How to save and get value from JSPHow to
save and get value from JSP Employee Name Time... 324 2012-12-12
save
i want to
save dis value jsp to action ...
how can i get all value ..and store..
how can its values goes
How to save user interface in flex for design toolHow to
save user interface in flex for design tool Hi
I want to create a flex application "sticker design tool" in which i want to
save all the caption/logos used with its properties like size,position,textcolor etc.,so when
HOW TO SAVE XML INTO MYSQL AND RETRIEVE IT USING JAVAHOW TO
SAVE XML INTO MYSQL AND RETRIEVE IT USING JAVA H ello, i have an xml code, i need to
save it into mysql 5.5 server database using java. i also want to be able to retrieve it as well. please note that i want it saved
how to save uploaded image in database using javascripthow to
save uploaded image in database using javascript Please can you tell me
how to store uploaded image in database using java I'll use the upload code as
extArray = new Array(".gif", ".jpg", ".png");
function LimitAttach
how to show data in database ?how to show
data in database ?
how to show the
data in the database to the user in the textbox so that user can modify it and
save it again
How much data is How much
data is Hi,
How much
data is "Big
Data"?
What is the size of
data to be called "Big
Data"?
Thanks
how to become a data scientisthow to become a
data scientist Hi,
I am beginner in
Data Science and machine learning field. I am searching for
the tutorials to learn:
how... that I can learn the
topic "
how to become a
data scientist". Also tell