JFileChooser visibility problem

Hi,
I have a problem with JFileChooser-component. Every now and then the JFileChooser-component won't come visible and the application hangs.
For example:
import java.io.File;
import javax.swing.JFileChooser;
public class Main {
    public static void main(String args[])
         JFileChooser fcSaveAs = new JFileChooser();
         fcSaveAs.setSelectedFile(new File(fcSaveAs.getCurrentDirectory() + File.separator + "test.pdf"));
     int saveResp = fcSaveAs.showSaveDialog(null);
     if(saveResp == JFileChooser.APPROVE_OPTION) {
          System.out.println("true");
}So, I want to give the user a sample filename, which he/she can use to save a file.
But if I run that, every fifth or sixth time the dialog won't come visible and the application hangs. The user can't do anything but stop java.exe.
If i take that line 8 off, system works fine. But I want to give a sample filename to the user, which he/she can use to save the file.

Hi,
Have you tried running on the Event Dispatch Thread (as you always should with Swing code)?
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.SwingUtilities;
public class ChooserTest {
    public static void main(String[] args) {
     SwingUtilities.invokeLater(new Runnable() {
         @Override
         public void run() {
          JFileChooser fcSaveAs = new JFileChooser();
          fcSaveAs.setSelectedFile(new File(fcSaveAs
               .getCurrentDirectory()
               + File.separator + "test.pdf"));
          int saveResp = fcSaveAs.showSaveDialog(null);
          if (saveResp == JFileChooser.APPROVE_OPTION) {
              System.out.println("true");
}Piet

Similar Messages

  • Email visibility problem fixed?

    Since I don't know how to check (and I'm really not that interested) I was wondering if someone can confirm what this e-mail I got from Sun seems to be saying:
    In other words, did they fix the e-mail hole?
    Hello,
    Thank you for writing. I am very sorry for this
    trouble and any inconvenience you experienced
    as a result. We have followed up on this matter
    and it has been fixed.
    Sincerely,
    Sun Web Team
    Sun Microsystems, Inc.
    name: ***
    url: http://forum.java.sun.com/forum.jspa?forumID=31
    descself: Software Development
    comments: The privacy hole mentioned the thread:
    http://forum.java.sun.com/thread.jspa?messageID=3938145 is serious.
    I don't feel like I can trust with my privacy details with something likethis
    going on. Please fix this soon. I would appreciate being informed of progresson
    this hole.
    mailfrom: ***
    mailsubject: Forums or Community
    thanks_url: /contact/thankyou.jsp
    category: sdn
    Time Stamp: Tue Oct 18 15:31:02 PDT 2005
    Contact Page Referer: http://forum.java.sun.com/forum.jspa?forumID=31
    Remote host : ***
    Remote IP address : ***
    Remote Agent : ***
    Script : http://developers.sun.com/jsp_utils/form_mailer.jsp
    Referring URL : ***
    ---

    Yes, the email visibility problem has been fixed.

  • T70 / tx9 touch screen visibility problems - patchy somewhat iridescent hazing

    I currently own a tx9 that has served me well for a year and a half.   in the past few months, the surface of the touch screen developed an iridescent patchy filmy look  that interferes with my ability to know if the picture I am about to take is in crystal clear focus, and as you might imagine, my photos have suffered as a result. the screen functions, and in certain lighting conditions (indirect mid morning light inside my house) I can mostly see what's going on, but generally, it is as though I am taking pictures mostly on faith, and do not know how the images look for certain from a clarity perspective until I upload them to my pc.  think of my problem as sort of an oil slick on water, but not swirly lore more like, peeling paint although nothing has peeled off that I am aware of)    is there anything at all that can help remedy this visibility problem or prevent it on future t series camera purchases? I have tried simply wiping it, using a lens cloth dampened with lens cleaner, and today just purchased a zagg screenprotector that I have yet not attempted to install as I ran across this forum.    i have for the most part kept my camera in a lined carrying case when not in use and in travels.  is it advisable to use a screen protector for the oled screen on the tx66? if so, what kind? ( I honestly would prefer to salvage my tx9 if possible and not shell  out the three hundred   plus dollars for the tx66, especially if this happens again in only two years..and I would hate to have to start looking at other brands.  my first Sony, the t70, also had similar problems and I willingly upgraded for the improvement in light sensitivity, but I really am ok with the tech in my tx9 otherwise ) .  

    There are MANY of us that have experienced the same issue.  This is NOT simply damage to the screen due to misuse, it is a failure of the anti-reflective coating.  We experienced this with a previous version of the Sony Cybershot and the store we purchased through advised us that the problem had been corrected on the new models.  As we have all found out, the touch screen on the Sony cameras has a serious durability issue and Sony has washed their hands of the problem.  We will not buy another sony camera again.  It's too bad, because the camera is really nice as a pocket camera and performs well otherwise.  Had we known that this was going to be an issue, we would have installed a protective film while it was new or simply chosen another camera.  We liked the simplicity of the touch screen but the failure of the anti reflective coating makes the screen almost unusable in areas where there is a lot of light.  The only solution that we have been able to find is to use a very fine polishing compound and remove the residual coating.  It means that the screen will have reflections but it will at least be more usable.  Toothpaste and a soft rag will remove the patchy areas of the coating that remains.  A touch sensitive screen should be a lot more durable than the one that Sony has been shipping. Sony has really done a disservice to their customers that have spent good money for a product that has a known failure problem.  What's worse is that they deny that there is an issue.  We all know better.

  • [svn] 3216: Fix for MXMLG-228, a visibility problem with graphic elements.

    Revision: 3216
    Author: [email protected]
    Date: 2008-09-15 18:13:11 -0700 (Mon, 15 Sep 2008)
    Log Message:
    Fix for MXMLG-228, a visibility problem with graphic elements. This is a quick fix that may force extra display objects when toggling visibility. We should investigate alternate solutions if performance is a problem.
    Bugs: MXMLG-228
    Reviewer: Deepa
    QA: Please check for performance problems when toggling visibility of a large number of graphic elements.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/MXMLG-228
    http://bugs.adobe.com/jira/browse/MXMLG-228
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/graphics/graphicsClasses/GraphicElement .as

    Hello Antonio;
    After many, many test I discovered that the problem, at least in my case it is caused by the new ACR 4.5. Please read the Thread that I post under Camera Raw. I include the link below.
    I also open two Bug Reports about this, but as usual Adobe (and other Software Companies) will never take responsability for this, until one day they release a new version with "enhancements".
    PSE6 Organizer Crash with ACR 4.5 (Vista Only?)
    http://www.adobeforums.com/webx/.3bb6a869.59b60d3e

  • Data visibility problem in PDF file generated from R/3 system

    Hi all,
    We are converting the output of a Smartform into a PDF format. From this smart from, we receive data in OTF format, after which the required data is converted from OTF format to PDF format. Then PDF data is sent through mail using FM SO_NEW_DOCUMENT_ATT_SEND_API1 as an attachment. 
    For the above mentioned Smartform, we have defined Paragraph & Character font type as 'TIMES' in smart style. But when we receive the PDF file (through mail), some data of appears in other fonts:
    1) When PDF file is generated from Development system, the different font types which are used by PDF are Arial and Times-Roman. In this case, we are able to see the PDF output and faced no major problems because both of these fonts are supported by PDF file format.
    2) When PDF file is generated from Testing system, the font types which is used by PDF is Arial. In this case, we are able to see the PDF output because this font is supported by PDF file format.
    3) When PDF file is generated from Production system, the different font types which are used by PDF are Arial, Times-Roman and PBRS. Here, we are able to see the data which is displayed in Arial font and Times-Roman font. But we are not able to see the data which is displayed in PBRS font because this type of font is not supported by PDF file format. If we copy the distorted text from PDF file and paste it in MS-Word then the required data is clearly visible and that is due to the reason that MS-Word supports PBRS font.
    But as per smart style we have used only 'TIMES' font, then why different fonts are appearing in PDF file?
    What settings are required to be done to make this data visible?
    Any pointer to solve this issue will be really appreciable. Thanks in advance for your help.
    Thanks and Regards,
    Dheeraj Tolani

    Hi,
    check the following
    http://help.sap.com/bp_biv235/BI_EN/html/bw.htm
    business content
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/biw/g-i/how%20to%20co-pa%20extraction%203.0x
    https://websmp203.sap-ag.de/co
    http://help.sap.com/saphelp_nw04/helpdata/en/37/5fb13cd0500255e10000000a114084/frameset.htm
    (navigate with expand left nodes)
    also co-pa
    http://help.sap.com/saphelp_nw04/helpdata/en/53/c1143c26b8bc00e10000000a114084/frameset.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/fb07ab90-0201-0010-c489-d527d39cc0c6
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1910ab90-0201-0010-eea3-c4ac84080806
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ff61152b-0301-0010-849f-839fec3771f3
    FI-CO 'Data Extraction -Line Item Level-FI-CO'
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/a7f2f294-0501-0010-11bb-80e0d67c3e4a
    FI-GL
    http://help.sap.com/saphelp_nw04/helpdata/en/c9/fe943b2bcbd11ee10000000a114084/frameset.htm
    http://help.sap.com/saphelp_470/helpdata/en/e1/8e51341a06084de10000009b38f83b/frameset.htm
    http://www.sapgenie.com/sapfunc/fi.htm
    Please reward for the same.

  • Jpopupmenu visibility problem with JWindows

    Hello,
    BACKGROUND:
    I am attempting to implement a feature similar to one found in the netbeans IDE for a programming editor I am helping to write. The feature is an autocomplete/function suggestion based on the current word being typed, and an api popup for the selected function.
    Currently a JPopupMenu is used to provide a list of suggested functions based on the current word being typed. EG, when a user types 'array_s' a JPopupMenu pops up with array_search, array_shift, array_slice, etc.
    When the user selects one of these options (using the up/down arrow keys) a JWindow (with a jscrollpane embedded in it) is made visible which displays the api page for that particular function.
    PROBLEM:
    The problem is that when a user scrolls down the JWindow the JPopupmenu disappears so he user cannot select another function.
    I have added a ComponentListener to the JPopupMenu so that when componentHidden is called I can do checks to see if it should be visible and make visible if necessary. However, componentHidden is never called.
    I have added a focuslistener to the JPopupMenu so that when it loses focus I can do the same checks/make visible if necessary. This function is never called.
    I have added a popupMenuListener but this tells me when it is going to make something invisible, not actually when it's done it, so I can't call popup.setVisible(true) from popupMenuWillBecomeInvisible because at that point the menu is still visible.
    Does anyone have any suggestions about how I can scroll through a scrollpane in a JWindow whilst still keeping the focus on a separate JPopupMenu in a separate frame?
    Cheers

    The usual way to do popup windows (such as autocomplete as you're doing) is not to create a JPopupMenu, but rather an undecorated (J)Window. Stick a JList in the popup window for the user to select their choice from. The problem with using a JPopupMenu is just what you're experiencing - they're designed to disappear when they lose focus. Using an undecorated JWindow, you can control when it appears/disappears.
    See this thread for information on how to do this:
    http://forum.java.sun.com/thread.jspa?threadID=5261850&messageID=10090206#10090206
    It refers you to another thread describing how to create the "popup's" JWindow so that it doesn't steal input focus from the underlying text component. Then, further down, it describes how you can forward keyboard actions from the underlying text component to the JWindow's contents. This is needed, for example, so the user can keep typing when the autocomplete window is displayed, or press the up/down arrow keys to select different items in the autocomplete window.
    It sounds complicated, but it really isn't. :)

  • XDK 9.0.2.0.C XSQL parameter visibility problem

    Dear Steven,
    I consider this as a serious bug:
    When one set XSQL page or XSQL session page parameter it
    become visible in page/request/session or otherwise only after
    the following round trip to the client.
    In other words, it is not present in the incoming XML to xslt to
    process.
    Thank you,
    David

    David,
    I just re-tested with 9.0.2C and things are working as they
    should. For example, the following XSQL page:
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="test.xsl"?>
    <page xmlns:xsql="urn:oracle-xsql" connection="demo">
      <xsql:set-page-param name="page-param" value="1"/>
      <xsql:set-session-param name="sess-param" value="2"/>
      <xsql:set-stylesheet-param name="sheet-param" value="3"/>
      <xsql:include-param name="page-param"/>
      <xsql:include-param name="sess-param"/>
    </page>referencing the following stylesheet:
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:param name="sheet-param"/>
      <xsl:template match="/">
        <html><body>
        <b><xsl:value-of select="$sheet-param"/></b>
        <b><xsl:value-of select="/page/sess-param"/></b>
        <b><xsl:value-of select="/page/page-param"/></b>
        </body></html>
      </xsl:template>
    </xsl:stylesheet>shows an HTML page with the expected "321" the first request.
    If you are talking about cookies, then you are correct that the
    cookies you set this request are not visible until the next
    request (which is the standard way cookies work), however, you
    can use the new XSQL 9.0.2C feature to "see" the cookie value
    immediately by adding the immediate="yes"] attribute to
    your <xsql:set-cookie> action.
    If I've misunderstood your problem, please post a testcase that
    illustrates the issue. Thanks.

  • JFileChooser weird problem (Help!!!)

    Does anyone here have loading problem with JFileChooser?
    I have a class that inherited the JFileChooser class and another class that inherited the JFrame class and this class create an instance of the JFileChooser class.
    My program sometime will not show (but sometime will: no changes at all) and they are no exception being shown on the console window what so ever. I can solve my program by initializing the JFileChooser object after showing the application and not before but that stupid JFileChooser is so slow to initialize. What the hell is going on? Any help hint would be appreciated.

    I also want to add that the following code is in my JFileChooser class:
    protected JDialog createDialog(Component Parent)
    JDialog CustomDialog=super.createDialog(Parent);
    CustomDialog.setLocationRelativeTo(Parent);
    CustomDialog.setResizable(false);
    return CustomDialog;
    Aside from the abnormally, I don't not what else could be causing the problem!

  • Developing new Swing Components - Visibility problems with UI classes

    I was wondering if anyone out there had run into the following problems when developing new Swing components. If so it might be worth banding together and putting pressure on Sun to fix them. However, if no one else develops new Swing components then I guess I'm just a lone voice...
    I have been writing a new dockable toolpanel Swing component and when it came to implementing the UI manager I was unable to access many of the standard features in basic and metal LAFs because they had been made package protected. This forced me to reimplement quite a bit of existing code which took time as well as being bad practice.
    While in some cases I can understand this from a security POV I am pretty sure that in this case it is the result of lazy programming practice. Appart from basic architectural reasons for this I have noticed a trend where newer code seems to suffer from this more than the original code. The practice of using package protection reminds me of C++ style coding, or just that of an inexperienced developer who does not understand the need to code for extensibility.
    An additional problem arises because the Security manager stops you cheating the system by putting new classes into the javax.swing.plaf... package structure. Thus the only way to solve this nicely is a proper fix.
    This would entail going through all the UI PLAF classes and rationalizing the visibility to either public or protected as appropriate. Really there should be minimal use of package protection unless it is vital for security concerns.
    Some Examples (there are many more):
    javax.swing.plaf.basic.LazyActionMap
    javax.swing.plaf.basic.BasicBorders.RolloverMarginBorder
    javax.swing.plaf.basic.BasicBorders.SplitPaneDividerBorder (why are just these two classes package protected when all the others are public?)
    javax.swing.plaf.metal.MetalUtils
    javax.swing.plaf.metal.MetalBumps
    Anyway, I am happy to give advice to other poor saps who wind up fighting the UI manager but it would be better if we could get Sun to sort out this mess (after all they created it).
    Cheers, Lewis

    It may be more a case of creating new Swing components and trying to provide support for all the standard LnFs.
    This is very awkward although you can sometimes achieve what you want by borrowing resources from UIManager (a border here, an icon there etc.).
    Essentially the problem is that Swing is designed to have new components added to it but the standard LnFs aren't quite so accommodating!

  • JFileChooser language problem

    Hi,
    I have changed the various text fields of the JFileChooser to my language,
    e.g. UIManager.put("FileChooser.fileNameHeaderText", "string"); but i'm
    facing a strange problem. When the JFileChooser opens and i select the Details view, everything seems OK and the text is depicted correctly in my language, such as the name, date and the other columns. But when i change a folder, e.g. when i select the C:\ folder or when i press the Desktop button, the language of the text in the columns changes back to the English language. The other text fields, i.e. File type, ok button text etc are depicted correctly in my language. Does anyone know where is the problem?

    If something like this happens, then all of the JFileChooser fields shouldn't be changed to the OS language? Why only the columns text of the details view? By the way, i want the text fields to retain the names that i give, no matter the OS language. I don't want to remove any language from the OS since this is a customized solution and i want my application to run in every OS independently of the installed language.

  • Photoshop CS4 Pen Tool Visibility Problem

    I recently upgraded to CS4 and started using Photoshop to do some work. Working on some clipping path with the pen tool I've come to notice how incredibly light the pen tool outline is. I cant see where or what im tracing cause I can't tell where the line is unlike the other earlier creative suites where the line was visible.
    Anyone have any ideas on making this outline more visible so I can actually see what I am doing. Input would be much appreciated.

    I am having the exact same problem with Photoshop CS 4 on my MacBook OSX 10.5.7 4 GB RAM    Intel GMA X3100:  graphics card
    When I enable Open GL in PS CS4 preferences, the pen tool line is too light, too thin to use and the anchor points aren't accurate , I have to disable Open GL to get the normal pen function back. Adobe should get us a fix to make Open GL compatable with all graphics cards. All functions in Open GL work fine except the Pen Tool.

  • Visibility problem

    I'm currently using Director MX 2004, basically I'm wanting
    the mouse pointer to click on an object, and when the object has
    been clicked, for it to disappear. The problem comes when the
    sprite doesnt return at the start of a new game. What code could I
    use to make it re-appear at the start of a new game? I'm currently
    using
    on mouseUp
    sprite(2).visible = FALSE
    end
    to get the objects to dissappear. Any help would be greatly
    appreciated.

    When the new game starts, make it always set all of the
    parts'
    visibility back to true. If there are only a few things, then
    it may be
    easiest to put a script like this on the "reset button" (or
    whatever is
    used to start the game over)
    sprite(2).visible=true
    sprite(3).visible=true
    ..etc...
    If there are a lot of them, then put a handler like this in
    the script
    for those objects
    on resetVisibility me
    sprite(me.spriteNum).visible=true
    end
    and on your rest button, put this command to do all of them
    at once:
    sendAllSprites(#resetVisibility)

  • NetBeans JFileChooser visualization problem

    I have a visualization problem when i implement a JFileChooser. I use
    Windows XP with SDK 1.3.1 and Netbeans 3.3
    I insert a JFileChooser from the Form Editor in NetBeans but when i run my
    application the JFileChooser appear in the background without waiting to be
    called by an event generated by a button. When you after press the button
    it works correctly; so it is only a visualization problem....
    How is possible to make it hide until the pressure of that button ???
    Thankyou for the help
    Andrea Franceschini
    [email protected]

    I solved the problem by myself....-:)
    I added the jFileChooser to the JFrame.
    It is instead to add it out of the jFrame with "others components"

  • ActiveX container visibility problem

    I am having problems with container visibility on a tab when the tab is made invisible. I have made a demo program to change tabs with and see how visibility behavior is affected based on which tab-page is visible at the time. I know there is a work around by programmatically changing to a different tab before setting visibility false.
    Attachments:
    ActiveX_Problem.vi ‏34 KB

    Hi,
    Actually, if you set the visibility of the ActiveX container to be the same as that of the Visibility boolean, the program seems to work correctly.
    Go ahead and take a look at the modified example I've attached. Also, I slightly modified the way the stop button was being handled (I included it as a case in the event structure, which is generally the way NI recommends the use of the Stop button in event structures).
    Hopefully this program will now work as expected. Thanks!
    Kileen C.
    Applications Engineer
    National Instruments
    NI Week 2004 is here!!
    Attachments:
    ActiveX_Problem.vi ‏48 KB

  • JFileChooser hanging problem

    I am developing an application in which I use JFileChooser. It was working for a while and then (after a recent new application instal) it started to hang every time it attempted to execute the line
    JFileChooser fc = new JFileChooser();
    I tried creating a trivial new application, tried stepping into the library code and tried re-installing NetBeans 4.1 - all with no success.
    Can you suggest what else I might try?

    Thanks for the suggestion. I had not tried printing before and after so I tried it as follows:
    I put the following lines:
    System.out.println("starting new call");
    JFileChooser fc = new JFileChooser();
    System.out.println("ended new call");
    iand I got the following when I ran it:
    nit:
    deps-jar:
    compile:
    run:
    starting new call
    I then had to interrupt the process because it hung and I got:
    Java Result: 1073807364
    I had already tried it with the debugger and stepped into the code invoked by the call to new JFileChooser(). It eventually reached the Toolkit function getDefaultToolkit and never successfully returned from there. It repeatedly executed the test
    if (toolkit == null)
    as false and went straight to the final line
    return toolkit;
    Stepping on or trying to step out of that function simply returned execution to the function's opening line:
    if (toolkit == null)
    This appears to loop.
    I had a problem with Star Office not long before this problem surfaced. It reported that it had failed to save a file as I closed the application. Since it is Java based (and I am ignorant of whether there could be interference) I wonder whether that could have resulted in an overwrite of something in NetBeans. That was why I tried a re-instal - but with no beneficial effect.

Maybe you are looking for

  • I have osx 10.6.8 and need to update to latest version - how do i do that - I do not have an app store icon

    I need help!

  • KDE in Solaris 10

    HI, I've installed KDE in Solaris 10 3/05 but don't know how to make it my default Desktop Environment. I don't see it anywhere. The KDE I installed is the one from the Companion DVD, just in case you need this information. Can you please tell me how

  • Management Portal does not render content in IE10

    This appears to be a somewhat recent experience: I have logged on to the https://manage.windowsazure.com last month and all was working fine. Today I went and logged on via the ASC/ADFS SSO, and got the management portal with the top menu working, bu

  • Why is this an error

    the first line below gives an error that says "Statement expected. " public Connection getConnection() { Connection conn = null; try { String userid = "ddavidson"; String password = "8132"; String driver = "sun.jdbc.odbc.JdbcOdbcDriver"; String URL =

  • WLANC2106 Failure while storing in flash!

    Hello - I am getting this error when trying to upgrade from 4.0.155.5 to 4.0.217.0. I've tried three different TFTP servers including TFTP32d as recommended in the Cisco TAC case. Anyone else getting this error after switching TFTP servers? Thanks