Results 1 to 3 of 3
- 10-08-2011, 08:26 AM #1
Member
- Join Date
- Oct 2011
- Posts
- 5
- Rep Power
- 0
swings
import javax.swing.*;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class tabledemo extends JPanel
{
private boolean debug = false;
public tabledemo()
{
super(new GridLayout(1,0));
String[] columns={"name","id","place"};
Object[][] data={
{"hem",new Integer(1),"vizag"},
{"ram",new Integer(2),"vizag"},
{"hemram",new Integer(3),"vizag"}
};
final JTable tb = new JTable(data, columns);
if(debug)
{
tb.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent me)
{
printdebugdata(tb);
}
});
}
}
private void printdebugdata(JTable tb)
{
int numrows=tb.getRowCount();
int numcols=tb.getColumnCount();
javax.swing.table.TableModel tm = tb.getModel();
for(int i=0;i<numrows;i++)
{
System.out.println("rows : " + i);
for(int j=0;j<numcols;j++)
{
System.out.println("Rows and columns are : " + tb.getValueAt(i,j));
}
}
}
private static void createshowgui()
{
JFrame jf = new JFrame("emp table");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tabledemo newContentPane = new tabledemo();
newContentPane.setOpaque(true); //content panes must be opaque
jf.setContentPane(newContentPane);
//Display the window.
jf.pack();
jf.setVisible(true);
}
public static void main(String[] args)
{
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void Run()
{
createshowgui();
}
});
}
}
getting error <anonymous tabledemo> is not a abstract and does not overide abstract method run() in Runnable
-
Re: swings
That error is telling you that the code above that implements the Runnable interface does not implement all the methods of Runnable correctly. Since a Runnable only has to implement one method, run, then you're not doing it right (hint: spelling and especially capitalization matters).
A suggestion for future questions here: consider using a more informative thread title. "swings" doesn't tell us briefly what your problem is. I'd have titled this thread "Error: class is not abstract and does not override the inherited abstract method...".Last edited by Fubarable; 10-08-2011 at 08:38 AM.
- 10-08-2011, 08:39 AM #3
Member
- Join Date
- Oct 2011
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
JAVA-Swings
By HariPrasad in forum AWT / SwingReplies: 6Last Post: 12-29-2010, 02:29 AM -
How to get the GUI Help for Swings?
By CHARU_SH in forum EclipseReplies: 1Last Post: 05-19-2010, 11:03 AM -
URL retrieval using swings
By gbose in forum AWT / SwingReplies: 1Last Post: 02-07-2010, 02:19 PM -
Swings
By bsantosh in forum AWT / SwingReplies: 4Last Post: 08-31-2009, 02:10 PM -
awt and swings
By masa in forum AWT / SwingReplies: 2Last Post: 11-24-2008, 07:09 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks