• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable Help URGENT ! !  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
'could some one please try to help me'
I'm printing out a report and I print out components like JTextField, JTable, JLabel.
averything works okay accept for the JTable.
this is the code of the print method, my problem is when I use the method translate to position it if I pass the second argument a number larger then 17 I get the above exception, why do I get it whats wrong with the code, the reason why I want to put in a larger number is because I want to position it lower on the page:
public int print(Graphics g,PageFormat pageFormat,int pageIndex)
{
if( pageIndex > 0 )
return Printable.NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D)g;
g2.translate( pageFormat.getImageableX(), pageFormat.getImageableY() + 5 );
g2.setColor( Color.black );
table.paint( g2 );
return Printable.PAGE_EXISTS;
} // end of must overwrite method print
Thank You
Yoel

!
Exception occurred during event dispatching:java.lang.ArrayIndexOutOfBoundsException: -1 < 0 at java.util.Vector.elementAt(Vector.java, Compiled Code) at javax.swing.JTable$1.getValueAt(JTable.java:388) at javax.swing.JTable.getValueAt(JTable.java:1403) at javax.swing.JTable.prepareRenderer(JTable.java:2890) at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:968) at javax.swing.plaf.basic.BasicTableUI.paintRow(BasicTableUI.java:899) at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:811) at javax.swing.plaf.ComponentUI.update(ComponentUI.java, Compiled Code) at javax.swing.JComponent.paintComponent(JComponent.java, Compiled Code) at javax.swing.JComponent.paint(JComponent.java, Compiled Code) at Activity$PrintHandler.print(Activity.java:391) at sun.java2d.RasterPrinterJob.printPage(RasterPrinterJob.java:485) at sun.java2d.RasterPrinterJob.print(RasterPrinterJob.java:235) at Activity$PrintHandler.actionPerformed(Activity.java:349) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1066) at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1101) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:204) at java.awt.Component.processMouseEvent(Component.java:3166) at java.awt.Component.processEvent(Component.java, Compiled Code) at java.awt.Container.processEvent(Container.java, Compiled Code) at java.awt.Component.dispatchEventImpl(Component.java, Compiled Code) at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code) at java.awt.Component.dispatchEvent(Component.java, Compiled Code) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java, Compiled Code) at java.awt.LightweightDispatcher.processMouseEvent(Container.java, Compiled Code) at java.awt.LightweightDispatcher.dispatchEvent(Container.java, Compiled Code) at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code) at java.awt.Window.dispatchEventImpl(Window.java, Compiled Code) at java.awt.Component.dispatchEvent(Component.java, Compiled Code) at java.awt.EventQueue.dispatchEvent(EventQueue.java, Compiled Code) at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java, Compiled Code) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92) at java.awt.Dialog.show(Dialog.java:365) at java.awt.Component.show(Component.java:834) at java.awt.Component.setVisible(Component.java:796) at Activity.setVisible(Activity.java:203) at Main$5.actionPerformed(Main.java:116) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1066) at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1101) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250) at javax.swing.AbstractButton.doClick(AbstractButton.java:226) at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:754) at java.awt.Component.processMouseEvent(Component.java:3166) at java.awt.Component.processEvent(Component.java, Compiled Code) at java.awt.Container.processEvent(Container.java, Compiled Code) at java.awt.Component.dispatchEventImpl(Component.java, Compiled Code) at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code) at java.awt.Component.dispatchEvent(Component.java, Compiled Code) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java, Compiled Code) at java.awt.LightweightDispatcher.processMouseEvent(Container.java, Compiled Code) at java.awt.LightweightDispatcher.dispatchEvent(Container.java, Compiled Code) at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code) at java.awt.Window.dispatchEventImpl(Window.java, Compiled Code) at java.awt.Component.dispatchEvent(Component.java, Compiled Code) at java.awt.EventQueue.dispatchEvent(EventQueue.java, Compiled Code) at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java, Compiled Code) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92) at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
Thanks in advance
Yoel
------------------
Sun Certified Programmer for JAVA 2 Platform
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Yoel,
you should chek if your JTable is not to long,
maybe it's go over the bottom margin?
or if you have time wait till next month, when
it's gona be avilible the new PrintFram on the
javaworld.com.
Anyway what are you doing?
are you a Consulton?
I'm looking for an employee.
maybe you gana be the right person.
just send me an E-mail, how I can contac you.
thanks
JK
placejava@yahoo.com
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joel
What in the world are you talking about, I think you have know idea what my problem is, I Sent you my resume
Thanks
Yoel Stern
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!