This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes setLookAndFeel UI issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "setLookAndFeel UI issue" Watch "setLookAndFeel UI issue" New topic
Author

setLookAndFeel UI issue

Ixus See
Ranch Hand

Joined: Jul 17, 2011
Posts: 160
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Hello Guys, i notice if I don't do this.. my UI will jumble up !!!

Does it mean, my application UI might not look the same on a different platform?
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Ixus See wrote:UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Hello Guys, i notice if I don't do this.. my UI will jumble up !!!

It is not clear what you mean by "jumble up". Can you give us more of a complete description of the problem you are experiencing?

Ixus See wrote:Does it mean, my application UI might not look the same on a different platform?

As a team lead I am sure you would recommend that your team members actually test their work, rather than relying on someone telling them it should work ?

Would your team test on different platforms? Maybe you have access to different platforms in work, so you could test on them? Or you could install a different platform on your own machine and test?


SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Ixus See
Ranch Hand

Joined: Jul 17, 2011
Posts: 160
Sean Keane wrote:
Ixus See wrote:UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Hello Guys, i notice if I don't do this.. my UI will jumble up !!!

It is not clear what you mean by "jumble up". Can you give us more of a complete description of the problem you are experiencing?

Ixus See wrote:Does it mean, my application UI might not look the same on a different platform?

As a team lead I am sure you would recommend that your team members actually test their work, rather than relying on someone telling them it should work ?

Would your team test on different platforms? Maybe you have access to different platforms in work, so you could test on them? Or you could install a different platform on your own machine and test?



my UI will jumble up !!! -> It means the Text field and buttons all extend, so they jumble up.


May I ask if you are working software engineer? IF you are I doubt the size of your project pass 1million or you are in the position to know the contract details. Anyway the platform would be stated in the contract, this is to safe guard the company, so all our developments are perform on the stipulated platform
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Ixus See wrote:Anyway the platform would be stated in the contract, this is to safe guard the company, so all my developers develop on the same platform.


If your company supports other platforms, then I am sure that your company will have other platforms that you can easily get access to and test on. I would suggest this as a first option.

Alternatively you could use something like cygwin. Or you could install a different platform on your machine - you could use a virtual machine on your own machine or you could create a separate partition to install the platform.

If you follow either of my recommendations above you should be able to answer your question "Does it mean, my application UI might not look the same on a different platform?". Would you not agree?

Alternatively, you could simply state in your options that you have no idea whether your application works on another platform because you did not test it.
Ixus See
Ranch Hand

Joined: Jul 17, 2011
Posts: 160
hmmm I think stating that it will only work on my development platform would be a safer bet, that would reduce the complication.

Yes I know Java suppose to code once work everywhere..

I am going to set .setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); just to be safe and do a check before executing the program.

Chris Zaremba
Ranch Hand

Joined: Nov 22, 2010
Posts: 54

I'm sorry but I think you need to stop talking down to those that ultimately have been trying to help you. If it was my choice I would rather have working along side me, the person with less experience but is motivated to research, test and work things out themselves rather than just talking the talk.


SCJA, OCPJP, OCMJD
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Ixus See wrote:UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Hello Guys, i notice if I don't do this.. my UI will jumble up !!!

Does it mean, my application UI might not look the same on a different platform?


No, it means you haven't learned to use layout managers correctly.
http://download.oracle.com/javase/tutorial/uiswing/layout/index.html

And as this doesn't appear to have anything to do with Developer Certification (SCJD/OCMJD), I'm moving it to the GUIs forum.


luck, db
There are no new questions, but there may be new answers.
Ixus See
Ranch Hand

Joined: Jul 17, 2011
Posts: 160
Sean Keane wrote:
Ixus See wrote:Anyway the platform would be stated in the contract, this is to safe guard the company, so all my developers develop on the same platform.


If your company supports other platforms, then I am sure that your company will have other platforms that you can easily get access to and test on. I would suggest this as a first option.

Alternatively you could use something like cygwin. Or you could install a different platform on your machine - you could use a virtual machine on your own machine or you could create a separate partition to install the platform.

If you follow either of my recommendations above you should be able to answer your question "Does it mean, my application UI might not look the same on a different platform?". Would you not agree?

Alternatively, you could simply state in your options that you have no idea whether your application works on another platform because you did not test it.


do you think it is necessary to test the application in different platform? Because the solution you provide requires a lot of effort, is easy to provide solutions to many problems but solutions shouldbe as simple and require least effort. I think IF my engineer come and ask me this question(assuming I have enough knowledge to answer)

my answer would be, well the contract stipulates that it should work on windows platform so as long if it works, you should be fine...

but if you wish to test you can run it on different platform but is not necessary for this project. KUDOS for considering this, but lets not get ahead of us.

well apparently the "contract" aka assignment here doesn't state if the software needs to run across different platform and moreover they ask you to state the host platform you work on. I assume they are going to give you some benefit of doubt if your assignment cant work on GTK+, HP UX or IBM UNIX.

more over UI manager allows you to get the LOOK AND FEEL so as long the platform has the particular API installed, the UI should run flawlessly, that is the reason why I change from setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); to .setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

I'm sure you are a talented and resourceful engineer, but you need to evaluate the solution you provide to others. For example in this case you ask me to test my application in different platform, which is absolutely unnecessary and time consuming and worst you make feel lousy when you question my team lead role.
Ixus See
Ranch Hand

Joined: Jul 17, 2011
Posts: 160
Darryl Burke wrote:
Ixus See wrote:UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Hello Guys, i notice if I don't do this.. my UI will jumble up !!!

Does it mean, my application UI might not look the same on a different platform?


No, it means you haven't learned to use layout managers correctly.
http://download.oracle.com/javase/tutorial/uiswing/layout/index.html

And as this doesn't appear to have anything to do with Developer Certification (SCJD/OCMJD), I'm moving it to the GUIs forum.


hmmm I doubt there is anything to do with Layout Manager, because it works if I set windows look and feel UI Manager.

it has something to do with UIManager rather than Layout Manager.

anyway thanks ;)
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Ixus See wrote:more over UI manager allows you to get the LOOK AND FEEL so as long the platform has the particular API installed, the UI should run flawlessly, that is the reason why I change from setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); to .setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

Which will set exactly the same L&F on Windows, and fail with an exception on any other platform. So what have you gained?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Ixus See wrote:hmmm I doubt there is anything to do with Layout Manager, because it works if I set windows look and feel UI Manager.

That's exactly why it has everything to do with the improper use (or lack of) of a layout manager.

Ixus See wrote:it has something to do with UIManager rather than Layout Manager.

Nope. It appears you don't correctly understand their roles. did you go through the tutorial I linked?

Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Ixus See wrote:For example in this case you ask me to test my application in different platform, which is absolutely unnecessary and time consuming and worst you make feel lousy when you question my team lead role.


Correct me if I am wrong, but your original question was "Does it mean, my application UI might not look the same on a different platform?"? I think most people would agree that if you want to know whether your UI will look different on a different platform the solution is simple, go test it.

If you aren't worried about how it will look on other platforms, then you shouldn't have asked that question. Simple logic my friend.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5147
    
  12

Darryl Burke wrote:did you go through the tutorial I linked?

I would be very amazed if he would. His original question is part of the SCJD certification, but he tries to pursue this certification with no effort at all (or the least possible). So reading a tutorial, using google to do some research,... is all to much effort for our friend and he doesn't do it at all. He just wants an answer on his question, preferrably with the needed code provided, so he just has to do some copying and pasting. He is pursuing a developer certification but lacks every skill a developer should have, but he has for everything some fancy excuse.

So I would suggest: don't spend your valuable time answering his questions, because he does not show any effort at all and only appreciates instant answers (the ones he can just copy/paste). When you give him an answer he has to put some effort in (some thinking of his own, reading tutorial, using google,...) he complains about the assistance he gets instead of being grateful to get some assistance and start working with the information provided.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
Consider Paul's rocket mass heater.
 
subject: setLookAndFeel UI issue
 
Similar Threads
Confusion between domain model and presentation model
MTOM not working in Axis2
jQuery button with default window skin
return connection object from a function
accessing <s:param> values in action