Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Multiple questions

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 36
1
VI Editor Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Marshal
Posts: 74365
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nitesh Sakargayan wrote: . . . and please use meaningful subject line.

Thank you for noticing.
 
Sheriff
Posts: 22508
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
J. Floyd
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 74365
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22508
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
POI is under the ASL; it can be used in commercial products.

You do *not* want to duplicate this work, believe me.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic