David J Evans

Greenhorn
+ Follow
since Apr 28, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by David J Evans

Hi all,

I've been working on an application work require, which prints a JPanel (and the contents of it) to a 4x4 inch label.

Ideally, the system needs to print silently, so I am trying to get all the print settings set correctly, however, I am having some trouble.

When the default printer on the computer is set to the label printer, my labels all appear to have a large margin, which pushes the information off the page. But if the default printer is the normal laser printer, and the label printer is selected by the user via the print dialog box, then the label prints perfectly on the label printer.

Similarly, regardless of the computers default printer, if I do a print service lookup and then set it to print on the label printer, I once again get the large margin, thus ruining my label.

I don't know what I should be doing here - is there a way of getting all the information (the properties of the printjob) after the print dialog has been closed by the user? Or can anyone suggest what might be wrong here?

Thanks,

Dave.
17 years ago
Hi all,

Hope someone can help me, this is driving me mad!

I have JBuilder 12 installed, and I've been trying to use it to test out just simple servlet programs.

The problem is that I can create a new webmodule, and servlet, and it works. But if I exit Jbuilder, next time I open a previous project, it appears not to recognise the servlet bits, as it says javax.servlet.* package does not exist. I've looked on the net for a solution, but everything I find doesn't relate to Jbuilder in particular, and so I'm hoping someone can give me a hand with regards to this. Everything is clearly installed correctly, I'm guessing there's just something a bit screwed up somewhere. (Oh yeah, I've already tried un/re-installing Jbuilder several times, didn't work either).

Just as a side issue, might not make a difference, but I have Netbeans 5.0 (also bundled with tomcat 5.5.9) and this all works fine for servlet stuff.

Any more info needed, please let me know...just wanna get this sorted so I can properly test Jbuilder to see which I prefer.

Thanks

Dave
Hi guys, sorry to be a pain, but I just can't work out how to use this...can you give me the code example of how to fill a 10 space array with a null value for each space.

Thanks.
18 years ago
Thanks for the suggestion - but I can't understand how to set all the values to null...all I can see (as far as I understand from the method descriptions), are ways to set the values in the array to a char/boolean/int etc...
18 years ago
Hi guys,

Just wondering if there is a simple way to empty an array in java, without explicitly delcaring like myArray[n] = null...it's not really critical, as obviously I can write a quick function to iterate through and do it, but I was just curious to know if there is a function to just destroy the whole damn thing...kinda like the unset() function in PHP.

Thanks.
18 years ago
Tim, thanks for your suggestion, I'll probably experiment with sticking them into a hashmap like you suggest...just feel like I should maintain control over them in some way lol!

Michael, thanks for your shorthand - much less cluttered.
18 years ago
Tim, thanks for your reply. Sorry Jesper, but I really don't see how what you said explained what I was seeing.

Tim (or anyone else) - is what I've done safe? I mean, can I reference each instance of area, and if so, what name would I use?
[ October 19, 2006: Message edited by: David J Evans ]
18 years ago
Hi, I've been working on something during my spare time at work (i'm not a java programmer at work!!), and this snippet of code works perfectly well, although I didn't expect it to, and would be grateful if someone could explain why it works, and why I am clearly wrong about how I think it should work!

Here's the code:



The bit I don't get is this: jTabbedPane1.add(choose.getDescription(files[i]),new JScrollPane(area = new JTextArea())); , and it's because I define a new JTextArea called area, and then do it several times, so in my mind, this should mean when I open several files, they should display the contents of the last file to go through the for loop iteration...but I was wrong, and I don't understand why!!

Please help me understand!

Thanks
18 years ago
cheers ken, you're on the ball.
18 years ago
Hi, thanks for you reply.

I realise that the upper limit of an integer may be exceeded by that number, but I thought the long data type was for larger numbers?

Either way, what I want to achieve is turning a timestamp, back into a readable date, which I can do in PHP, so I'm sure java has a function to do it. The timestamp for about 2 minutes ago was this 1146261394418, which is 2 digits longer than the number in my example, but is returned through this function, as a long datatype.



So can anyone explain to me what's going on, or just simply, how I can turn my timestamp back into a human readable date.

Thanks
18 years ago
Hi,

I have the following method



and to me, it should turn the long number, into whatever date that represents, and this works with some numbers. But when I try it with that number in the example (which I have just chosen arbitrarily), I get the error message(at compile time): integer number too large: 99500000000.

Anyway, I really don't understand why I am getting this error, and only this can sum up how I feel !

Please help!
18 years ago