Reputation: 882
I am currently working with swing applications.For a developer ,it is most important that the user must be comfortable with the GUI.I want to develop an application which can have the native (Platform's default) look and feel for all platforms that are used on a computer(I mean to say my application is not intended for mobile devices).The code I am using for the same is
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
Is there any simpler or more effective method for achieving the same thing?
Upvotes: 1
Views: 491
Reputation: 19187
Simpler? Sure, use SWT, you won't need those two lines of code to make it look native ^_^
If you want to use Swing, setting native look and feel might not be enough. This is one of those "Run once, test everywhere" things. It doesn't get simpler, only more complicated and hack-ish.
Upvotes: 1
Reputation: 68907
Yes, you can make it "simpler":
public static void useSystemLaF()
{
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {}
}
And then:
useSystemLaF();
Conclusion: This isn't simpler. There is no way to do this easier. You can put the method in a utility class, which make your code look better, if it is that what you want.
Upvotes: 2
Reputation:
Is there any simpler or more effective method for achieving the same thing?
No, there isn't
Upvotes: 3