Problem with Swing GUI on Macintosh

I am new to Swing.

Are there any specific issues related to customizing the paint operation on the Mac?

I have developed a sample application using NetBeans + Swing on Windows. It is working fine. But if I run the same application on a Mac, panels' buttons' labels don't appear on the screen. Only when the mouse over operation is performed on particular component does it get displayed on the screen.

Kindly can anyone help me out in solving this issue?

Thanks in advance. sakkiharry


Asked by: Oliver575 | Posted: 23-01-2022






Answer 1

Since Swing paints all UI itself, it is not really influenced by Mac OS. There are exceptions, though. If you allow Java to use a native menu, the menu will behave like any other Swing menu, but it is in fact translated to native menu functions (so it will be displayed on top of screen and behave like a native Mac OS X menu... nothing you as programmer need to care about, but great for Mac users, who hate menus to appear elsewhere).

I guess your issue is probably something else, but it's hard to guess, if I have no code to work with. Can you break down the issue into an ultra minimal test case? E.g. can you just draw a JFrame, add a singe one of your custom buttons there, that shows the problematic behavior and just use as much code as is necessary to paint this minimal UI and expose the problem? If you'd post this code here, I'd take a closer look into it and will try to find out what causes the issue and how to resolve it (I'm a graduated Java programmer, but I also have years of Mac OS X development experience; so these are two fields of knowledge I should know really well, but I usually don't combine them, as I don't develop in Java for Mac OS X).

Answered by: Vivian267 | Posted: 24-02-2022



Similar questions

swing - Java method works on windows but not Macintosh?

I had a real weird method which is used to hide JInternalFrame's title bar. Now the dilemma is below method works on windows platform, ((javax.swing.plaf.basic.BasicInternalFrameUI) aXInternalFrame.getUI()).setNorthPane(null); But not on Macintosh! Any experts have any idea which can explain internal process which makes this method not usable on Mac. And is there any ...


Can't insert into mysql database in windows 7. Program written in java using macintosh


macos - Where is Java JDK on Macintosh El Capitan?

I know there are a lots of question like this but they seem to reefer to an old version of java or an old os environment, so i am forced to make the question again: how can i find the path of java jdk on my mac? Thank you.






Still can't find your answer? Check out these amazing Java communities for help...



Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)



top