aspose file tools*
The moose likes Java in General and the fly likes Multiple questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Multiple questions" Watch "Multiple questions" New topic
Author

Multiple questions

J. Floyd
Greenhorn

Joined: Apr 27, 2010
Posts: 5
Hello. My professor directed me here to see if I could get some questions answered. I need help with Java and the program I am working on.

My program is made up of multiple classes, but some share the same panels. Is there a way I can put the panel in its own class and then call that panel to the other classes that use it?
I tried creating a class with all the variables and then making a method that returns the JPanel, however the compiler won't allow it. Are there any suggestions?

Is it possible to write to an Excel file with JDBC/OBDC? I figured out how to read from an Excel sheet, but I do not know how to make it write.

Once everything is saved to said Excel sheet, am I able to search through the values to look for a specific value? There is a section where I need to be able to search through the data and return what I'm asking for. This is one of the most crucial features to the program.

Finally, when I save the entire thing as an executable jar file, the images are not include. How do I get it to display the image?
This is the code I currently have:

but the image is not displayed when I turn it into a .jar file. It does show when I use Eclipse, however.

Thank you very much.
J. Floyd
Greenhorn

Joined: Apr 27, 2010
Posts: 5
The code for my first question is this:
where the entryPanel and all of its variables are declared and instantiated above in the class and constructor.
S. Nitesh
Ranch Hand

Joined: Jan 15, 2010
Posts: 36
    
    1

Is it possible to write to an Excel file with JDBC/OBDC? I figured out how to read from an Excel sheet, but I do not know how to make it write.

I don't know about the other questions but for creating xls you can use the poi (api for microsoft docs.) by apache.
You can refer this link for more details
http://poi.apache.org/spreadsheet/index.html

and please use meaningful subject line.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
Nitesh Sakargayan wrote: . . . and please use meaningful subject line.
Thank you for noticing.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

J. Floyd wrote:Finally, when I save the entire thing as an executable jar file, the images are not include. How do I get it to display the image?
This is the code I currently have:

but the image is not displayed when I turn it into a .jar file. It does show when I use Eclipse, however.

Check out Class.getResource(). This returns a URL that you can use in the ImageIcon constructor.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
J. Floyd
Greenhorn

Joined: Apr 27, 2010
Posts: 5
Thank you.

Sorry for the uninformative subject line, I just didn't know what to call it since there were several different topics.

I'm trying to not use any copyrighted work because I plan on protecting this program once I finish. I don't know if I'd be allowed to do so if I used JExcel or the POI. I am trying to learn XML so I can save everything as an xml and then have Excel read it.

The Class.getResource is not working. I keep getting a message saying that I cannot make a static reference to a non static method getResource(String) from the type Class.
I've tried to make a url as well, but there is something that I'm missing.



Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
You would have to read the terms and conditions of use of POI to see whether you can incorporate it in your own product. It might be laborious and error-prone to write your own when there is a well-tested product already available, however.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

J. Floyd wrote:The Class.getResource is not working. I keep getting a message saying that I cannot make a static reference to a non static method getResource(String) from the type Class.

When I said Class.getResource, that was a hint to go to the Javadoc of java.lang.Class and lookup method getResource.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

POI is under the ASL; it can be used in commercial products.

You do *not* want to duplicate this work, believe me.
 
Don't get me started about those stupid light bulbs.
 
subject: Multiple questions