When you run a Java application, use the following command java -jar -javaagent:/usr/share/java/jayatanaag. sudo add-apt-repository ppa:danjaredg/jayatanaĭisable gloabl Jayatana configuration sudo rm /usr/share/upstart/sessions/nf Install Jayatana using the following set of commands:įrom Ubuntu 15.04 it is installed by default. Now run the application, you will get a native allok and feel for all the swing applications.Įventhough it is not required for your Calculator application, enabling Global Menu will improve the look and feel of Java applications. gksu gedit /usr/lib/jvm/jdk1.8.0_60/jre/lib/swing.propertiesĪdd the following line in the file and save the file faultlaf=. See Reading/Loading an Image for more deatils. Id also consider using ImageIO to read the image instead of ImageIcon as ImageIO will throw an IOException if the image cant be loaded for some reason. According to your Java version, change the path. Assuming that the path to the image is correct, you should use a JLabel to show the image. So the given command will create a new one. In Java 8 this file is not available by default. As jdv answered you can set it at the runtime or you can set it for all the Java swing applications using the following technique: I hope you need Java to use GTK look and feel. Since you are using the Oracle Java 8 VM, you might even want to try the nice new .NimbusLookAndFeel. The idea is that you want to add this Java define (" faultlaf=.") to the VM arguments somehow. Or you might have to edit a file if your app is being started up via a Java launcher of some kind. You will have to substitute the application name for YourAppName. You can try to force the GTK (or Nimbus, if you have the right version of the VM) LAF as suggested in this link. I suspect you are seeing the "Metal" LAF, which is pretty ugly (and happens to be the default if the developer does not specify a different LAF for a GUI app). The Windows LAF is only available on Windows.) There are a number of shipped LAFs available to the VM, and a few that are specific to some operating systems (i.e. PS: All software involved (Eclipse, Java JRE, etc.) are latest versions.You can hint to the JVM to use a different "Look and Feel" (LAF). However, I would like to know if anyone has encountered this and found any solution. This isn't a dealbreaker for me as I can stop using Remote Desktop when developing Java Swing apps. I have tried locally and the GUI apps display properly. But sadly, the use of =true has no effect at all. Here is all my environment: computer: macbook pro intel i5. Looks like everything is installed properly, including SWT Designer. In the constructor (Line 14), we constructs 4 components - 2 anonymous and 2 Frame adds the components, in GridLayout. The mainFrame.java is created by the drop down menu below: I install Windowbuilder from Eclipse MarketPlace. I've searched high and low in Google about this the closest I came to a solution is this. An AWT GUI program extends from (Line 6) - the top-level window container. Here's what I got when I ran the app:Īpparently there doesn't seem to be anything wrong with the GUI application I'm debugging, because the Java Control Panel exhibits the same problem. I acquired a Java Swing application and I'm debugging it in Eclipse. The only problem is this: Java Swing apps don't display the GUI properly. Everything else runs smooth and fast over Remote Desktop as both computers are connected directly over the ad-hoc wireless. I'm doing programming on my laptop (for portability reasons). I'm connecting to my laptop via Remote Desktop from my desktop to take advantage of the large screen. Connected to laptop via ad-hoc wireless network.Connected to desktop via ad-hoc wireless network.Screen resolution 1024 x 768 Nvidia GeForce Go 6200.Anyway, let me start of with some stats before I ask the actual question: I thought this question fits SuperUser more than StackOverflow because it's not about actual Java programming, though programmers might be more likely to encounter the problem.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |