DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Apply the EaSynth Look And Feel in Your Applications

Xavier Young user avatar by
Xavier Young
·
Jul. 16, 08 · Interview
Like (0)
Save
Tweet
Share
10.80K Views

Join the DZone community and get the full member experience.

Join For Free

EaSynth look and feel is a free and open-source Java look and feel provided by www.easynth.com. It is based on the Synth look and feel supported by JRE5+. The new look and feel provides a bronze-coloured theme, here is a snapshot:

We can download the EaSynth look and feel at:

http://www.easynth.com/freewares/EaSynthLAF/download/EaSynth_Look_And_Feel_Bundle.zip

It is a full bundle that contains the whole look and feel and its source code. We don't need the source code for usage purpose, so we extract the "EaSynthLookAndFeel.jar" file from the ZIP package, the JAR file is fairly enough for using EaSynth look and feel.

The first step to apply the new look and feel is appending the look and feel JAR file into the classpath, which is very simple:

java -cp EaSynthLookAndFeel.jar com.yourdomain.SampleMainClass

The second step is to specify the current look and feel; it can be achieved by using the swing.defaultlaf VM arguments:

java -Dswing.defaultlaf=com.easynth.lookandfeel.EaSynthLookAndFeel -cp EaSynthLookAndFeel.jar com.yourdomain.SampleMainClass

This will set the EaSynth look and feel as the default one. If you want to switch the look and feel on the fly, you can invoke the setLookAndFeel() static method in UIManager class:

Example 1: use the class name as the parameter for setLookAndFeel()

try {
UIManager.setLookAndFeel("com.easynth.lookandfeel.EaSynthLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}

 

Example 2: use the look and feel object as the parameter for setLookAndFeel()

import com.easynth.lookandfeel.EaSynthLookAndFeel;

try {
final EaSynthLookAndFeel easynthLAF = new EaSynthLookAndFeel();
UIManager.setLookAndFeel(easynthLAF);
} catch (Exception e) {
e.printStackTrace();
}

The 2 examples above are equivalent on runtime, the second one may complain if the "EaSynthLookAndFeel.jar" file is not placed in the classpath. If you invoke setLookAndFeel() method at the first line of the main() method, it will work properly, all UI components will have the new style. But if you invoke setLookAndFeel() method latter (e.g. set new look and feel when user select a menu item), you may find that the UI components still keep their old style. To fix this, you need to invoke the updateComponentTreeUI() method to update the UI for all existing GUI components. Here is the example:

Example 3: update the UIs for the given GUI component and its children, and children's children... So that they will have the new looking.

SwingUtilities.updateComponentTreeUI(yourMainFrameInstance);

In most cases, applying EaSynth look and feel to your application will be very easy, and you don't need to modify any existing source code in your application. But if you specified some UI component's properties distinctly in the source code (such as the opaque property, table row height...), it may conflict with the default settings that comes from EaSynth look and feel. These kinds of issues can be fixed by performing some slight modification on the existing source code.

application

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Authenticate With OpenID Connect and Apache APISIX
  • Test Design Guidelines for Your CI/CD Pipeline
  • Master Spring Boot 3 With GraalVM Native Image
  • The Beauty of Java Optional and Either

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: