JFileChooser looks nothing like the native widget. I seem to remember reading some hack to get it look like the native widget but searching for it know i can't seem to find it again i came across posts that suggest using java.awt.FileChooser but that class does not seem to be in the distribution. How can i make JFileChooser make look like the native widget?
Take a look at this page. It goes through a lot of UI tweaks, but the third one is most relevant: "Using the JFileChooser to get Mac file and folder icons."
java.awt.FileDialog will be the classes the posts meant. It is, unsurprisingly, more limited that the Swing version. All Java SE implementations are required to have the FileDialog class (although headless configurations may not be able to do anything useful with it).
It may be worth a look at the Quaqua look and feel, it replaces the file chooser with a much better and more native version, including folder colouring etc.
Related
I want to develop a file-previewer for Node-Webkit. It should be able to handle most file types like .pdf, .pptx, .txt, .docx, .png +++ Some file types are trivial, like images, but others are harder.
I have been digging around a lot and found a few things that could work. I found crocodoc which does something similar to what I am thinking of. I also found pdf.js, but as the name suggests, it only does PDFs.
I have considered an approach where I generate image thumbnails of the files before previewing. It is simply a previewer, not a full reader. For this I found the java library thumbnailer which seems to do the trick, but it is in beta and is very inactive.
The tools that I have at my disposal for this project are Javascript (in Node-Webkit), Java and Ruby.
Are there any existing projects that dose this that I can use without paying a license to Crocodoc & Co.? If not, are there any good and active libraries for file-to-thumbnail conversion?
I must admit the fact Forms layout does save loads of time, wrt other Swing layouts. I did try out other examples from http://www.java2s.com/Open-Source/Java-Document/Swing-Library/jgoodies-forms/Catalogjgoodies-forms.htm and worked fine. However, i was more interested in the forms-demo code from the actual developer, is it available ? Couldn't find them, other than the executable jar file.
Did you see the com.jgoodies.forms.tutorial.building link in that page? Seems to link to a number of source code listings.
But see also the Java version of the Forms Demo at JGoodies|Downloads|Applications.
The site seems to have been reorganized since my last visit, but you can probably find those things from http://www.jgoodies.com/downloads/
I need a table that displays properties and allows their values to be changed. Similar to the Netbeans properties windows for the GUI editor. Does anyone know of any existing classes or libraries. I'd hate to reinvent the wheel on this one.
Edit:
Something like this which allows separators into different groups, JCombos, and JButtons to all be used.
Thanks
I would recommend JTable, and a gridbag layout manager.
The table in NetBeans is PropertySheetView (or similar) and it is part of the NetBeans Platform (PropertySheetView JavaDoc). This class should also be usable in a standalone Swing application by including the necessary NetBeans modules as jar files in the classpath (Found this with a bit of googling).
JTable can be used to display a Grid with values and allow the user to edit the value from columns you enable to it.
You could leverage the JTable class; which should provide the base you need.
JIDE Soft has a number of components, some of them are OpenSource take a look at there to see if you fine the one you need.
For future reference
I'm successfully using l2prof-common's PropertySheetPanel. The documentation is not that great and the API is not that clean, but it works, and the view is nice
The official site is
http://www.l2fprod.com/common/
But the download link is broken; I compiled the propertysheet JAR myself but you can get the whole library from http://www.astrogrid.org/maven/l2fprod/jars/
The library doubles as a demo if you execute the jar and there's also the code in it
I found this other question useful Have com.l2fprod.common.propertysheet.PropertySheetPanel To Display Composited Class
I would recommend taking a look at the SwingX JXTreeTable. I have used it in an application to create a very similar view.
An example screenshot I found on the web (here) to illustrate this
I'm trying to re-write a C# application of mine in Java. I've chosen Java because our target platform is now Linux, no longer Windows.
My C# application used Microsoft Office Interop to automate things like Word and Excel. It would simply open different documents and apply our formatting to them (adjust column width, remove italics, etc). Finally, it would save the documents as PDF.
Now that we are targeting Java and Linux, and knowing that OpenOffice can do all of these things, I figured it would be a smooth transition. OpenOffice is open source, so it must have a relatively nice automation interface, right?
I've been Google'ing and looking at docs all morning. I've downloaded the OpenOffice SDK. I've followed instructions involving installing MinGW and a Zip toolkit. I've tried NetBeans plugins and Eclipse configuration settings.
The funny thing is, I'm not even sure if I'm in the right direction. I've been reading about OpenOffice UDO interface, but that sounds more like in-OpenOffice Scripts, like VBA or something.
Does anyone know if there's simply some sort of import that allows me to use OpenOffice to open and manipulate documents, similar to Office's Interop libraries? If so, know of any recent examples or blog posts, etc?
Yes, the OpenOffice jar files themselves (from the app) are the SDK. The interface involves calling methods in them. It's not hard once you figure it out, but I agree, documentation for it is pretty weak. It was definitely written by people that know how to do it, and can use it as a reference, but aren't any good at explaining it to others. :-)
I am trying to link some user docs to my Java Swing application. The user docs are pdf and I would like to be able to click on a button in my application which opens up some sort of pdf renderer to display my userdoc.pdf.
I do not want to use the runtime exec command
I have tried the following with not much success --
pdfRenderer -- this seems to not work for the current version of pdfs (seems to want older pdfs)
acrobat viewer -- I keep getting font errors (the document is displayed but everytime I go to a new page, I get an error)
JPedal pdfHelp - This sounds cool and if it will work, it would be the best for me. But for some reason, I am unable to open any file here. No pdf file that I have loads in the window (The pdfHelp panel comes up with a list of pdfs as promised, but when I right click one of them and say "OpenPDF", I just get a progress bar and the file does not load, I have tried a few files on this and checked file permissions)
JPedal SimpleViewer -- So far this one seems to be the most promising. I would like to remove some of the functionality of this viewer though and am not able to edit the xml to do this. When I edit the xml, then I seem to get xml parsing errors.
Has anybody done anything similar that worked? Help please
PS. I need this to work on Linux machines (IcePDF seems to works only for Windows). I would very much prefer something that is free!
Would Java's Desktop API meet your requirements? It does launch another process, but it's not through you calling Runtime.exec().
The Desktop API uses your host operating system's file associations to launch applications associated with specific file types.
Update: pdfHelp from IDR solutions (creators of JPedal) works now. The latest version (4.0) has fixed the bug and it reads my pdf files (and I am sure more of the latest pdf files). Just playing around with the product today and it is great! There are few minor bugs but I really appreciate how quickly Mark Stephens(?) responded to the first bug. Good work guys!
I chose pdfbox for a similar use case - it's not perfect with every PDF, but works pretty well and is under active development. From the PDDocument you can get a list of PDPage objects, which have a convertToImage() method that gives you a BufferedImage you can draw on screen. I switched to this from pdf-renderer because I felt it gave better results in general.
PdfHelp has moved to its own domain at http://www.pdfhelp.org and have been updated to fix your issues and add some other improvements...