Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

indian greenhorn

Greenhorn
+ Follow
since May 01, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by indian greenhorn

To achieve what you are looking for, use cell renderer for your table. Use the interface TableCellRenderer.
In the interface you have a method "getTableCellRendererComponent" method which has various parameters. This renderer extends JLabel. You have to pass your cell to this renderer and it will be converted to JLabel. Use the SwingConstants.setHorizontalAlignment(CENTER) to display your text at the center of the cell.
Hope you are able to follow the flow.
regards
17 years ago
I have three component in a frame. One of them is JTable. When I set Look and Feel it is not displaying fully. I tried the default look and feel, but when I try windows look and feel it is showing the table well. What could be the reason for this problem. Any suggestions on this would be nice to have.
regards,
17 years ago
I have three component in a frame. One of them is JTable. When I set Look and Feel it is not displaying fully. I tried the default look and feel, but when I try windows look and feel it is showing the table well. What could be the reason for this problem. Any suggestions on this would be nice to have.
regards,
17 years ago
Hi,
Using Graphics2D when I rotate my component I want the event associated with the component also to move along with the coordinates of the component.
In Event class there is one method translate(int x, int y) can anyone tell me how to implement this method in my program. A simple example will be of great use.
regards
17 years ago
Add KeyListener to the textfield and call keyPressed() or keyTyped() method. Eg,
public void KeyTyped(KeyEvent ke)
{
System.out.println(ke.getKeyCode());
}
It will printout the codes for the keys typed on the screen. You first get the code for the #,^ etc and by if condition check for their presence.
that is if(ke.getKeyCode()==100) inside the keyTyped() block. If it equals to the key code then give the alert message you want to display.
regards,
17 years ago
Hi,
Using Graphics2D when I rotate my component I want the event associated with the component also to move along with the coordinates of the component.
In Event class there is one method translate(int x, int y) can anyone tell me how to implement this method in my program. A simple example will be of great use.
regards
17 years ago
hi thankx to know that it is somehow possible.
Krishna
17 years ago
Hi,
When u select an item from the combobox u are making the list to change according to item selected. Right?
After u select the item and before you add the changed list of items to the combobox just remove the actionlistener. After updating the comboxbox with new items now again add the actionlistener. This will solve the problem you are having.
regards,
Krish
17 years ago
Hello, it is not possible to put the image directly on the JFrame or on a JPanel. One way to make it is to set the image (should have good size)on a JLabel and when you add the JLabel it will appear as it is a background image. You can also add components over this image. This way you can achieve your requirement of background image to the JFrame.
regards
17 years ago
Hi friends,
I want to know whether it is possible to copy a JFrame with its components(JButtons,JLabels) into the clipboard and paste it from the clipboard to anyother application like MS-Paint. If it is possible please provide me the details.
regards,
Krish
17 years ago
hi,
Do check the image file path and check whether it is in correct folder.
Krishna
17 years ago

Originally posted by Vishal Saxena:
#1. DriverManager.getConnection(String url);
#2. Driver driver = DriverManager.getDriver(url);
driver.connect(url);
I want to know, the difference between them, which one to use under what requirement ?



Hi Vishal,
Just go through the java documention and API for SQL it will give u a clear picture and difference of the statements u have given.
regards,
Krishna

Originally posted by Deepa Raghuraman:
hi friends,
I have a table (JTable) with 3 buttons.
when clicked on button "populate", the table must get populate with records,
when clicked on button "clear", the table must get cleared (no records shuld be displayed)
when clicked on button "add", a new record must be added at the end of the table.
how to do this? I needed it very urgently...
Regards,
Deepa Raghuraman



Hi,
I have given a reply to your query in java.sun.com forum. Now I understand u want the table to be empty with no rows and column at all. Is that right? In that case apart from what I have said do check the reply given by one of the persons here, just before me.
Hope it works for u.
Krishna
17 years ago

Originally posted by Vidya Venkatesh:
hi I'm facing a problem with ImageIcon. In my applet, I'm trying to read images from a zip file on the server. The image objects are read and created correctly, but the ImageIcon objects which I make from the Image objects are null. The interesting part is that this is happening only when I run the applet from my office computer. When I run it from home, the ImageIcon objects are not null and displayed correctly. The code is shown below. Please advise.
Thank you
Vidya
public static Hashtable getImageTableFromZip(String zipFileName)
{
Hashtable imageTable=new Hashtable();
ZipInputStream zipIn;
try
{
String zipFilePath=Environment.getInstance().getImageZipUrl ();
URL url = new URL(zipFilePath+zipFileName);
InputStream in = url.openConnection().getInputStream();
BufferedInputStream bufIn = new BufferedInputStream(in);
zipIn = new ZipInputStream(bufIn);
ZipEntry zipEntry;
while((zipEntry = zipIn.getNextEntry()) != null)
{
Image image=extractImageFromZip(zipIn);
ImageIcon imageIcon=new ImageIcon(image);
System.out.println ("image is "+image +" imageicon made from image is "+imageIcon);
imageTable.put(zipEntry.getName(),imageIcon);
}

}catch(Exception e){e.printStackTrace(); }
return imageTable;
}



Hello, one idea is to try a sample (small) code with an imageicon class in that and see whether it is working fine. If it is fine certainly there is something wrong in the code. If it is not so certainly it is the problem of the system.
regards,
Krishna
17 years ago

Originally posted by Vidya Venkatesh:
hi I'm facing a problem with ImageIcon. In my applet, I'm trying to read images from a zip file on the server. The image objects are read and created correctly, but the ImageIcon objects which I make from the Image objects are null. The interesting part is that this is happening only when I run the applet from my office computer. When I run it from home, the ImageIcon objects are not null and displayed correctly. The code is shown below. Please advise.
Thank you
Vidya
public static Hashtable getImageTableFromZip(String zipFileName)
{
Hashtable imageTable=new Hashtable();
ZipInputStream zipIn;
try
{
String zipFilePath=Environment.getInstance().getImageZipUrl ();
URL url = new URL(zipFilePath+zipFileName);
InputStream in = url.openConnection().getInputStream();
BufferedInputStream bufIn = new BufferedInputStream(in);
zipIn = new ZipInputStream(bufIn);
ZipEntry zipEntry;
while((zipEntry = zipIn.getNextEntry()) != null)
{
Image image=extractImageFromZip(zipIn);
ImageIcon imageIcon=new ImageIcon(image);
System.out.println ("image is "+image +" imageicon made from image is "+imageIcon);
imageTable.put(zipEntry.getName(),imageIcon);
}

}catch(Exception e){e.printStackTrace(); }
return imageTable;
}

17 years ago