Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Arian Gerryts

Greenhorn
+ Follow
since Mar 22, 2012
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
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arian Gerryts

I want to access a pdf file for the purpose of splitting it by using JFileChooser but PdfReader cannot read the file. The IOException reads "Publishing Letter.pdf not found as file or resource".



Is it possible to access the pdf file by using the JfileChooser for the purpose of splitting it?, how would I do it?
5 years ago

I am trying to add a Label to a grid and another label in the next cell to display an image of an asterisk.
The image of the asterisk however displays twice, once in front of the first label and again just after it.

Which will be the best way to add this image in the xml file so that it displays properly.


Kind regards
5 years ago


I am doing a tutorial on gwt working with eclipse and I am trying to apply a specific style on a FlexTable just to see how it works.





I then apply the style in the java code



If I run the application the style is however not applied.

Any advice perhaps on a mistake that I am not seeing
5 years ago
GWT
Hi there
I would like some help with filling a JTable with data that I retrieved from a database
The JTable has 5 columns.

this is what I have done so far.


How would I know proceed to fill the JTable with the resultSet(priceAccording).

Kind regards

6 years ago
6 years ago
I am trying to add an image to a panel using Netbeans. I dragged a Panel from the palette on to the frame and sized it according to what I want the image size to be. In the constructor I then added the image to the panel(I named it panelImage) like this.



The image however does not display. What is the best way to have the an image displayed as the size of the Panel using Matisse layout manager(i.o.w. dragging and dropping the panel).
6 years ago
Hi there

I am experiencing some difficulty comparing entries of lotto numbers in a database with an existing winning number.

I stored all the numbers in individual columns as strings and I am supposed to retrieve the numbers according to matches. Three matches, four matches, five matches etc.

I was thinking along the lines of doing the following


but this is tricky as a set of 7 numbers can produce many different matches of three for example. I have been sitting with this problem for a while.


Any advice perhaps on the best why top approach this as retrieving all the numbers from the database and then comparing each digit with the digits of the winning lotto numbers I find also a bit complicating.

Kind regards
6 years ago
Hi there

I have a small homework application that writes random numbers from 5 to 77 to a text file and then I have a different application that reads this and add it to a totalAmount that has been initialized to 0.
I want to display the totalAmount as the number is added to the totalAmount with each loop.

with this I add the numbers to the text file


And with this I read the numbers


The output however starts with

29633



and it end with

42328



I am expecting that it should start with a random number such 40 for example and the adding it to the totalAmount with a new random number being added to the totalAmount with the next loop.

Why do I get this. Just trying to understand the logic

6 years ago
Yes, thanks. Better to create entire GUI using constructors as well as JPanel.


6 years ago
I am learning about the method painComponent(Graphics) and this method I think belongs to the JComponent class and any component inherits from JComponent inherits this method to be overidden.

If I add a textArea (areaDrawing) for example to the form from the pallet, how can I specify that this area should be used as drawing surface. I.o.w. using Netbeans, how could I specify that the paintComponent(Graphics) of the textarea should be implemented if I click on a button for example.

Should I create a separate class that extends JTextArea for example and then add this to the Frame by using the constructor?

Kind regards
6 years ago
I am trying to run a jar file using my command prompt (Windows XP) but get NoClassDefFoundError.

I have my DateAndTime.class file in a folder called dateandtime and also indicated a package called dateandtime in the source file.

Outside the folder I have a manifest.mf file with specification.

Main-Class: dateandtime.DateAndTime



I put this in the command line.

jar cmf manifest.mf myJarFile.jar dateandtime



and this creates the myJarFile.jar in the same folder as manifest.mf.

When I try to run this jar file however I get the NoClassDefFoundError.

Exception in thread "main" java.lang.NoClassDefFoundError: dateandtime/DateAndTime (wrong name: DateAndTime)



The name however is not wrong.

If I have all the classes in the same directory with no package specified then the .jar file runs fine but as soon as I try to specify a package, even though myJarFile.jar was created I get the error.

Why is that?

Regards
6 years ago