Reputation: 44250
I'm trying to install Sea Glass Look and Feel. I want to install/configure the LaF using a property file, but the tutorial that outlines this process is quite confusing.
That being said, can anyone provide a simple step-by-step guide on installing/configuring a custom LaF using a property file?
Upvotes: 5
Views: 17108
Reputation: 311
Here are the steps to install the Sea Glass L&F using the jar file (Note that i use eclipse so the instructions will be in eclipse)
Click Ok then in your code go to your public static void main(String[] args)
and copy paste this snippet:
try {
UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
There you go, the L&F is now applied. If you have questions just ask it
Upvotes: 4
Reputation: 7435
From their website:
To use the Sea Glass Look and Feel, you must either include our Maven repository in your pom.xml file or download the jar file and include it in your class path. See the downloads page for more details.
To enable the Sea Glass Look and Feel, include the following in your application before creating any controls:
try {
UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
We also support setting the user interface on the command line using the VM option
-Dswing.defaultlaf=com.seaglasslookandfeel.SeaGlassLookAndFeel
Upvotes: 6
Reputation: 109823
I haven't any issue running that from NB IDE
from code
import java.awt.*;
import javax.swing.*;
//import javax.swing.plaf.InsetsUIResource;
public class NimbusJPanelBackGround {
public NimbusJPanelBackGround() {
JFrame f = new JFrame();
JButton btn = new JButton(" Whatever ");
JButton btn1 = new JButton(" Whatever ");
JPanel p = new JPanel();
p.add(btn);
//UIManager.getLookAndFeelDefaults().put("Button.contentMargins", new InsetsUIResource(0, 0, 0, 0));
//SwingUtilities.updateComponentTreeUI(f);
p.add(btn1);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.add(p, BorderLayout.CENTER);
f.setSize(200, 100);
f.setLocation(150, 150);
f.setVisible(true);
}
public static void main(String[] args) {
/*try {
for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(laf.getName())) {
UIManager.setLookAndFeel(laf.getClassName());
UIManager.getLookAndFeelDefaults().put("Panel.background", Color.white);
}
}
} catch (Exception e) {
e.printStackTrace();
}*/
try {
UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
NimbusJPanelBackGround nimbusJPanelBackGround = new NimbusJPanelBackGround();
}
});
}
}
EDIT:
nor from Substance L&F emulator notice for viewing my answer is required users reputation >10k, answer is deleted by community as not an answer :-)
Upvotes: 2