Advertisement
foozar

SwingLocalDate

Oct 23rd, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. package swing_local_date;
  2.  
  3. import java.awt.Font;
  4. import java.time.LocalDate;
  5. import javax.swing.JFrame;
  6. import javax.swing.JLabel;
  7. import javax.swing.SwingConstants;
  8.  
  9. public class main {
  10.  
  11.     public static void main(String[] args) {
  12.    
  13.         LocalDate date = LocalDate.now();
  14.         JFrame frame = new JFrame("Show LocalDate");
  15.         JLabel label = new JLabel();
  16.        
  17.         label.setHorizontalAlignment(SwingConstants.CENTER);
  18.         label.setFont(new Font("Arial", Font.BOLD, 25));
  19.         label.setText(date.toString());
  20.        
  21.         frame.setSize(300, 300);
  22.         frame.setLocationRelativeTo(null);
  23.         frame.add(label);
  24.         frame.setVisible(true);
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement