Sign in to follow this  

[java] Printing a JTable

This topic is 4593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Well, I decided to try out Java's new SDK 5.0 today. I put it to use with an old project of mine, but I've had a bit of a problem. I'm trying to print an extended version of JTable. The table prints, but a border around the table is also being printed. I have not set any border for the table. Any ideas of how I would print the table without the border around the outside being present? This is the code I use to print the JTable:
	PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
	aset.add(OrientationRequested.LANDSCAPE);
	aset.add(MediaSizeName.ISO_A4);
				
	table.setShowGrid( false );
				
	try 
	{
		table.print(JTable.PrintMode.FIT_WIDTH,
                     		null,
                     		null,
                     		true,
                     		aset,
                     		true);
	} 
	catch (PrinterException e)
	{
		e.printStackTrace();
	}

	table.setShowGrid( true );

Any tips/recommendations would be much appreciated. I must say that the new API is really nice. It's so easy to perform certain (and perhaps once complicated) tasks. I'm glad I switched; I need to play with the API more to see its full potential. Thanks, GCS584

Share this post


Link to post
Share on other sites

This topic is 4593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this