S Saunders

Greenhorn
+ Follow
since Mar 21, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by S Saunders

Thanks. Your suggestion worked great.
Steve

Originally posted by Rich Smyth:
File f = new File("");
File [] files = {f};
myFileChooser.setSelectedFile(f);
myFileChooser.setSelectedFiles(files);

is one way to reset the selected file(s). When I had the same problem setting to null did not help.


Rich

[ July 20, 2004: Message edited by: Rich Smyth ]


[ July 21, 2004: Message edited by: S Saunders ]
19 years ago
I have a static JFileChooser object avaible in my application. I went with a static object so that when the "Open File" dialog is shown, it opens to the last directory navigated by the user.

This works great. The only problem is that when it displays any file(s) previously selected are shown as selected. Is this a bug? Is there any way around this?

Thanks.
19 years ago
I am running into a problem while using a JTextPane to display documents. I have written a simple test class as can be seen below. The largest file I can read in using jdk1.4_2 is 1.6MB. If I use jdk1.4_0, the size is reduced to 0.6MB. I have search in the problem database and could find nothing. Has anyone else seen similar issues? Any ideas for work arounds?
If I use a JTextArea, I have not had this problem only with the JTextPane. I do need to have the ability to display HTML, that is why I have stuck with the JTextPane.
19 years ago
I am running into a problem while using a JTextPane to display documents. I have written a simple test class as can be seen below. The largest file I can read in using jdk1.4_2 is 1.6MB. If I use jdk1.4_0, the size is reduced to 0.6MB. I have search in the problem database and could find nothing. Has anyone else seen similar issues? Any ideas for work arounds?
If I use a JTextArea, I have not had this problem only with the JTextPane. I do need to have the ability to display HTML, that is why I have stuck with the JTextPane.
19 years ago
Layne,
You bring up a good point. I guess I hoped for a simple solution in Java. Thanks for the reminder, and I will begin looking at doing it with code outside of java.
Steve
20 years ago

Originally posted by Cindy Glass:
Getting and Setting Text on the System Clipboard


I appreciate the response. I can currently copy/paste a string, but would like to know if it is possible to paste a "file handle" from java, such that Windows would recognize it as a file and not as text. Currently, I have been unsuccessful at finding a solution.
Steve
20 years ago
I am trying to write some code that will allow the user to select a file in a java application and then be copied to the system clipboard for them to paste into a folder in the Windows Explorer.
Currently when I try this, the path of where the file exists is copied. I go to the Explorer and try to paste, but the Paste option is not enabled. I am using the following code to copy the file to the clipboard:

Is it possible to transfer a file from Java and have it recognized by the system? If so, will you point me to documentation/example of how it can be done.
Thanks.
20 years ago
I have a problem within my application. If while the application is running the user deletes a printer from their Window's desktop, PrintServiceLookup.lookupPrintServices will still return a service for the deleted printer. Why? Does anyone know if this is a documented fact? I have tried to find information on sun's site without any luck.
Any information would be appreciated.
Thanks,
Steve
20 years ago

Originally posted by Jeanne Boyarsky:
Steve,
Suppose you are displaying a table in a Swing program. You can check that the table has the correct values, number of rows/columns, ... While this doesn't check everything, it's better than nothing. I remember reading an article with a good example of this, but now I can't find it.


So you are suggesting a "traditional" test check of the UI components. I agree that this is important. I would be interested in the article if you remember or even if you remember the publication/website would be good.
Thanks,
Steve
20 years ago
We use an AWT/Swing UI. You mentioned testing of the underlying model, what does this entail? I am new to testing and am trying to grasp the terminology and philosophies.
Steve

Originally posted by Jeanne Boyarsky:
Steve,
Do you use an AWT/Swing UI or an HTML/JSP UI?
If it is an AWT/Swing UI, you can test the underlying model. There are probably ways of testing the actual UI, but I'm not sure what they are.
If it is an HTML/JSP UI, you can use Mock Objects and JWebUnit to test the session/request objects and layout.

20 years ago
I am not familiar with xunit, what is it? Could you point me to information about it?
Thanks,
Steve

Originally posted by hassane E.:
Hi,
Since Junit and xunit have been around for a while now, I am wondering if some best practices and unit testing related patterns are being captured and documented somewhere (maybe in you book).
Thanks.

20 years ago
My team this year decided to experiment with unit testing. I found it to be quite helpful during our development. However some of my tasks dealt mostly with the creation of the user interface. I found that I had a difficult time creating JUnit tests for this. In fact, we decided to not write tests that dealt with the UI. Could those who have had experience with this eloborate on the following questions.
What are the possibilities for testing?
Is it possible to use JUnit for these tests?
And finally,
Should I go to the trouble of creating the Java event objects to use in my tests?
Thanks,
Steve
20 years ago
Before I get to the question, here is some background to the problem I am having. I am working on a printing enhancement to an application. When I send a print job to the printer the first page prints followed by two blank pages. As far as I can tell the print() is rendering the text properly into the Graphics2D object.
Now for the question: Is it possible to view the contents of this Graphics2D object without recausing it to repaint? My hunch is that the printer is doing something incorrect with the data so I would like to view what I have rendered. The reason I am wondering if it is the printer is the fact that I can use the same code and send it to a different printer and the document prints fine.
Thanks for your help,
Steve
20 years ago

Originally posted by Richard Jensen:

Have you read Test Infected?


Yes, I have read that article and am trying to read the other articles on JUnit's site.



Are you having problems writing JUnit tests for your code or are you just feeling that it is a lot of work for little (or no) benefit?
[Do all of the developers share the same feelings?]
Are you doing (or plan to do) refactoring? If so, even the tests that you don't think are worthwhile now may save you later.
What are your goals for unit testing?


I am for unit testing. I see that it can have many potential benefits. At the beginning of this year my manager selected myself and another devloper to "try out" JUnit and unit testing our code. Therefore we are in a learning period. I am trying to understand the why, when, where and hows of testing to give this a good test. I am new to the concepts of XP and would love to have input as to good information about XP and unit testing.
Some developers are wary about the whole thing that it could simply be extra time to write the tests. I want to have a good experiance and have enough information for when we do evaluate this type of development. I can say that I have already found several short comings in my code when using tests.
Steve
20 years ago
The method is not a complex method. As I stated before, I am beginnging to implement unit testing and ran across the testing of a private method in my code.
Ilja, what is your opinion of the scope of testing? Currently, we are trying to test the majority of methods by using JUnit. Is this a waste of time? What are your thoughts about how much/many of a classes methods should be tested?
Steve
20 years ago