com.github.lgooddatepicker.ysandbox.TestStart Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of LGoodDatePicker Show documentation
Show all versions of LGoodDatePicker Show documentation
Java 8 Swing Date Picker. Easy to use, good looking, nice features, and
localized. Uses the JSR-310 standard.
package com.github.lgooddatepicker.ysandbox;
import com.github.lgooddatepicker.datepicker.DatePickerSettings;
import com.github.lgooddatepicker.datepicker.DatePicker;
import java.awt.GraphicsEnvironment;
import java.time.LocalDate;
import java.time.Month;
import java.util.Locale;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
* testStart, This is a class used to test various functions while programming. This class is not
* involved with the normal operation of the date pickers.
*/
public class TestStart {
public static void main(String[] args) {
///////////////////////////////////////////////////////////////////////////////////////////
// Create a frame, a panel, and our demo buttons.
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
frame.getContentPane().add(panel);
Locale datePickerLocale = new Locale("en");
DatePickerSettings settings = new DatePickerSettings(datePickerLocale);
settings.initialDate = LocalDate.of(2016, Month.APRIL, 15);
DatePicker datePicker = new DatePicker(settings);
panel.add(datePicker);
// Display the frame.
frame.pack();
frame.validate();
int maxWidth = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().width;
int maxHeight = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().height;
frame.setSize(640, 480);
frame.setLocation(maxWidth / 2, maxHeight / 2);
frame.setVisible(true);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy