This is the old documentation of lombok-pg. The new version can be found in the wiki of the github repository. Take me to the new Version then!

With.with(...)

Overview

Detailed Description

With Lombok

01 import static lombok.With.with;
02 
03 import java.awt.BorderLayout;
04 import java.awt.Dimension;
05 import javax.swing.JFrame;
06 import javax.swing.JButton;
07 import javax.swing.JScrollPane;
08 
09 class WithExample {
10   public JFrame createApplicationFrame() {
11     return with(new JFrame(),
12       setTitle("Application"),
13       setResizable(false),
14       setFrameIcon(ICON),
15       setLayout(new BorderLayout()),
16       add(new JButton(new CancelAction()), BorderLayout.SOUTH),
17       pack(),
18       setVisible(true)
19     );
20   }
21 }

Vanilla Java

01 import java.awt.BorderLayout;
02 import java.awt.Dimension;
03 import javax.swing.JFrame;
04 import javax.swing.JButton;
05 import javax.swing.JScrollPane;
06 
07 class WithExample {  
08   public JFrame createApplicationFrame() {
09     JFrame $with1 = new JFrame();
10     $with1.setTitle("Application");
11     $with1.setResizable(false);
12     $with1.setFrameIcon(ICON);
13     $with1.setLayout(new BorderLayout());
14     $with1.add(new JButton(new CancelAction()), BorderLayout.SOUTH);
15     $with1.pack();
16     $with1.setVisible(true);
17     return $with1;
18   }
19 }

Small print

Smallprint