The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

hello eric, ur ans is just on the link to this hyperlink

Posted by swapnil on November 27, 2000 at 8:30 AM

> d/eric,
i have tried the example with buttons and textfield. and it works!!.So should on the JTable fields.
pl. try this code on ur JTable.
.............................................................


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class test extends JFrame
{
public static void main(String h[])
{
test t=new test();
t.show();
}
public test()
{
super("Focus Demo");
setSize(300,300);

Container mycontentpane=getContentPane();
JButton jb1=new JButton("hello");
JButton jb2=new JButton("pakistan");
JTextField jtf=new JTextField("text here");
jtf.setEditable(false);
//jtf.setRequestFocusEnabled(false);
//jb2.setEnabled(false);
JButton jb3=new JButton("Singapore");
JPanel jp=new JPanel();
jp.add(jb1);
jb1.setNextFocusableComponent(jb2);
jp.add(jtf);
jp.add(jb2);
jp.add(jb3);

mycontentpane.add(jp);
}
}


.............................................................


hope this method helps you,
regards,
swapnil



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us