Results 1 to 16 of 16
  1. #1
    Melodia is offline Member
    Join Date
    Sep 2013
    Posts
    18
    Rep Power
    0

    Default GUI problems on OSX

    I've been having a strange problem when trying to use GUIs on my Mac laptop. I have a project that works perfectly well on PC, and I've downloaded and used it on numerous PC computers, but this is not the case for Mac.

    When you launch the program from a Mac computer, the GUI frames will still show, but the close button will not work (and neither will the minimise or maximise ones). It will also not let the user fill in textboxes. I tried running a simple JFrame program from the same computer, and it works perfectly. The problem seems to be with the project, which contains about 30 classes. Nevertheless, whichever part of it you open, the case is always the same.

    It is worth noting that when I download the file from Google drive on my mac, casts like <String> or <Object> are placed after any instance of a JComboBox, and these need to be removed before anything can be run. Also, a lot of the instances of parsing have changed Integer to int. These also need to be changed back before anything can be run.

    So, what's going on?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: GUI problems on OSX

    Generification of JComboBox is since Java 7. Your Mac probably has an older version, possibly Java SE 6. No idea what you mean about parsing changing Integer to int.

    The unresponsive issue sounds like you have an improperly parented (or null-parented) modal JDialog that gets displayed behind your JFrame. Make sure all dialogs are parented to the JFrame that is the primary UI when they are launched.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default Re: GUI problems on OSX

    You could also be doing something that takes a long time on the EDT.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    Melodia is offline Member
    Join Date
    Sep 2013
    Posts
    18
    Rep Power
    0

    Default Re: GUI problems on OSX

    Quote Originally Posted by DarrylBurke View Post
    Generification of JComboBox is since Java 7. Your Mac probably has an older version, possibly Java SE 6. No idea what you mean about parsing changing Integer to int.
    db
    Sorry, I misremembered that bit. It isn't on parsing that that happens. I just happen to use the wrapper classes for parsing more than anything, and I sort of breezed through changing the code back. It's on casts used before calling some methods. Here is a working one before the change:

    Java Code:
    Driver.activeInvoice=(Invoice) Methods.retrieveOrderItem(
    	 				(Integer) tableModel.getValueAt(j, 1));
    This is what happens to it after I download the .java file on my mac, and causes a compiler error.

    Java Code:
    Driver.activeInvoice=(Invoice) Methods.retrieveOrderItem(
    	 				(int) tableModel.getValue
    No idea why it happens. I thought it might have been a version problem, but I've tried changing it several times. Maybe I'm just not doing it right.

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default Re: GUI problems on OSX

    What version of Java are you using?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    Melodia is offline Member
    Join Date
    Sep 2013
    Posts
    18
    Rep Power
    0

    Default Re: GUI problems on OSX

    Sorry for taking so long to get back, but I was just finishing up my project this week. I'm running Java 1.7. Here are some screen shots which may help you see the problem.

    GUI problems on OSX-screen-shot-2013-09-11-11.50.10.png
    As you can see, it is 1.7 as far as the terminal is concerned.

    GUI problems on OSX-screen-shot-2013-09-11-11.52.38.png
    Eclipse is also set to 1.7. for the compliance level. It does say 1.6 in the brackets for the configuration at the bottom. I don't know how to change that though. Might that be the problem?

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: GUI problems on OSX

    That looks like a problem yes. Check the preferences -> Java -> Installed JREs to see what runtimes the Workspace has available to it. Also check the project properties to see if no java runtime is specifically configured there.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    Melodia is offline Member
    Join Date
    Sep 2013
    Posts
    18
    Rep Power
    0

    Default Re: GUI problems on OSX

    I think we have indeed found a problem. I see version 6 there and version 6 only.
    GUI problems on OSX-screen-shot-2013-09-11-12.38.54.png

    If I click on the add button, I am given these four options to choose from.
    GUI problems on OSX-screen-shot-2013-09-11-12.39.05.png

    Any advice?

  9. #9
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: GUI problems on OSX

    Remove Java 6 runtime, add Java 7 runtime?

    It is also likely that Eclipse is actually booted itself using the Java 6 runtime. Check the eclipse.ini file to see if there is a -vm line in there
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  10. #10
    Melodia is offline Member
    Join Date
    Sep 2013
    Posts
    18
    Rep Power
    0

    Default Re: GUI problems on OSX

    Took me a while to find out how to find the Java 7 JRE. I didn't realise hitting "search" just makes it appear immediately (which is awesome). Anyway, I now have Java SE 7 set to my default.

    GUI problems on OSX-screen-shot-2013-09-11-14.07.16.png

    Unfortunately, this has solved absolutely nothing for me. The problem with not being able to close GUIs is still the exact same.

  11. #11
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: GUI problems on OSX

    Also check the project settings, it might be that it is still referring to that old Java 6 runtime. You can override workspace settings per project.

    If not: ... well then it is more than likely a problem in the code. Problems that seem to magically not happen on certain platforms are not that uncommon. Unfortunately at that point I become useless to you since I know nothing about Java on Macs, except for some basics.

    Note that you have given no attention yet to the tips that Darryl gave to you in reply #2.
    Last edited by gimbal2; 09-11-2013 at 04:34 PM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  12. #12
    Melodia is offline Member
    Join Date
    Sep 2013
    Posts
    18
    Rep Power
    0

    Default Re: GUI problems on OSX

    Quote Originally Posted by gimbal2 View Post
    Note that you have given no attention yet to the tips that Darryl gave to you in reply #2.
    The part of Darryl's post that I didn't reply to applied only to code with JDialogs in it. Mine has none of those. But you're right that I should have acknowledged it, if just for the sake of politeness.


    I haven't the faintest idea where to find Project Settings on Eclipse.

  13. #13
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: GUI problems on OSX

    Well I do that by right clicking on the project name and then choosing "properties" in the context menu. No idea how you do that in MacOS.

    You also didn't reply to Kevin's #3 reply, which is a common cause for what you're experiencing.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  14. #14
    Melodia is offline Member
    Join Date
    Sep 2013
    Posts
    18
    Rep Power
    0

    Default Re: GUI problems on OSX

    I didn't actually understand what Kevin meant at the time to be honest (Yeah, in hindsight I should have mentioned that fact). Nevertheless, that wasn't the problem.

    You can go give yourself a round of applause. Changing the project properties has solved the problem.

  15. #15
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: GUI problems on OSX

    Woohoo.

    Still, learning about the EDT ("Event Dispatch Thread") and concurrency in Swing is going to prevent plenty of misery in the future, so consider doing that regardless.

    Lesson: Concurrency in Swing (The Java™ Tutorials > Creating a GUI With JFC/Swing)
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  16. #16
    Melodia is offline Member
    Join Date
    Sep 2013
    Posts
    18
    Rep Power
    0

Similar Threads

  1. InputStream/Jar Problems/File IO Problems
    By rdjava in forum Advanced Java
    Replies: 31
    Last Post: 01-17-2011, 12:12 PM
  2. problems with Jxl
    By Harpreet1111 in forum New To Java
    Replies: 1
    Last Post: 07-07-2010, 08:27 PM
  3. Gui problems
    By bulldog in forum Advanced Java
    Replies: 1
    Last Post: 12-11-2009, 01:35 PM
  4. Few Problems Help!
    By elad_bj in forum New To Java
    Replies: 4
    Last Post: 04-07-2009, 04:45 AM
  5. a few problems
    By gary in forum AWT / Swing
    Replies: 0
    Last Post: 07-11-2007, 05:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •