summaryrefslogtreecommitdiff
path: root/libs/FLib/JCalendar/doc/example/Example2.java
diff options
context:
space:
mode:
Diffstat (limited to 'libs/FLib/JCalendar/doc/example/Example2.java')
-rw-r--r--libs/FLib/JCalendar/doc/example/Example2.java182
1 files changed, 91 insertions, 91 deletions
diff --git a/libs/FLib/JCalendar/doc/example/Example2.java b/libs/FLib/JCalendar/doc/example/Example2.java
index 0866447..0299ef9 100644
--- a/libs/FLib/JCalendar/doc/example/Example2.java
+++ b/libs/FLib/JCalendar/doc/example/Example2.java
@@ -33,138 +33,138 @@ import org.freixas.jcalendar.*;
// All Rights Reserved.
class Example2
- extends JFrame
+ extends JFrame
{
//**********************************************************************
// main
//**********************************************************************
-public static void
-main(
- String[] args)
-{
- new Example2();
-}
+ public static void
+ main(
+ String[] args)
+ {
+ new Example2();
+ }
//**********************************************************************
// Constructors
//**********************************************************************
-/**
- * Create various instances of a JCalendarCombo.
- */
+ /**
+ * Create various instances of a JCalendarCombo.
+ */
-public
-Example2()
-{
- // Set up the frame
+ public
+ Example2()
+ {
+ // Set up the frame
- setTitle("Example2");
- setDefaultCloseOperation(EXIT_ON_CLOSE);
+ setTitle("Example2");
+ setDefaultCloseOperation(EXIT_ON_CLOSE);
- Container contentPane = getContentPane();
- contentPane.setLayout(new GridLayout(2, 2, 5, 5));
+ Container contentPane = getContentPane();
+ contentPane.setLayout(new GridLayout(2, 2, 5, 5));
- // Create a date listener to be used for all calendars
+ // Create a date listener to be used for all calendars
- MyDateListener listener = new MyDateListener();
+ MyDateListener listener = new MyDateListener();
- // Display date and time using the default calendar and locale.
- // Display today's date at the bottom. Allow editing
+ // Display date and time using the default calendar and locale.
+ // Display today's date at the bottom. Allow editing
- JCalendarCombo calendar1 =
- new JCalendarCombo(
- JCalendarCombo.DISPLAY_DATE | JCalendarCombo.DISPLAY_TIME,
- true);
- calendar1.setEditable(true);
- calendar1.addDateListener(listener);
+ JCalendarCombo calendar1 =
+ new JCalendarCombo(
+ JCalendarCombo.DISPLAY_DATE | JCalendarCombo.DISPLAY_TIME,
+ true);
+ calendar1.setEditable(true);
+ calendar1.addDateListener(listener);
- // Set fonts rather than using defaults
+ // Set fonts rather than using defaults
- calendar1.setFont(new Font("DialogInput", Font.PLAIN, 16));
+ calendar1.setFont(new Font("DialogInput", Font.PLAIN, 16));
- calendar1.setTitleFont(new Font("Serif", Font.BOLD|Font.ITALIC, 24));
- calendar1.setDayOfWeekFont(new Font("SansSerif", Font.ITALIC, 12));
- calendar1.setDayFont(new Font("SansSerif", Font.BOLD, 16));
- calendar1.setTimeFont(new Font("DialogInput", Font.PLAIN, 10));
- calendar1.setTodayFont(new Font("Dialog", Font.PLAIN, 14));
+ calendar1.setTitleFont(new Font("Serif", Font.BOLD|Font.ITALIC, 24));
+ calendar1.setDayOfWeekFont(new Font("SansSerif", Font.ITALIC, 12));
+ calendar1.setDayFont(new Font("SansSerif", Font.BOLD, 16));
+ calendar1.setTimeFont(new Font("DialogInput", Font.PLAIN, 10));
+ calendar1.setTodayFont(new Font("Dialog", Font.PLAIN, 14));
- // Display date only
+ // Display date only
- JCalendarCombo calendar2 =
- new JCalendarCombo(JCalendarCombo.DISPLAY_DATE, false);
- calendar2.addDateListener(listener);
+ JCalendarCombo calendar2 =
+ new JCalendarCombo(JCalendarCombo.DISPLAY_DATE, false);
+ calendar2.addDateListener(listener);
- // Display time only and set the time pattern to use as a duration
- // from 00:00 to 23:59
+ // Display time only and set the time pattern to use as a duration
+ // from 00:00 to 23:59
- JCalendarCombo calendar3 =
- new JCalendarCombo(
- Calendar.getInstance(),
- Locale.getDefault(),
- JCalendarCombo.DISPLAY_TIME,
- false,
- "HH:mm:ss");
- calendar3.setDateFormat(new SimpleDateFormat("HH:mm:ss"));
- calendar3.addDateListener(listener);
+ JCalendarCombo calendar3 =
+ new JCalendarCombo(
+ Calendar.getInstance(),
+ Locale.getDefault(),
+ JCalendarCombo.DISPLAY_TIME,
+ false,
+ "HH:mm:ss");
+ calendar3.setDateFormat(new SimpleDateFormat("HH:mm:ss"));
+ calendar3.addDateListener(listener);
- // Display a French calendar
+ // Display a French calendar
- JCalendarCombo calendar4 =
- new JCalendarCombo(
- Calendar.getInstance(Locale.FRENCH),
- Locale.FRENCH,
- JCalendarCombo.DISPLAY_DATE | JCalendarCombo.DISPLAY_TIME,
- false);
- calendar4.addDateListener(listener);
+ JCalendarCombo calendar4 =
+ new JCalendarCombo(
+ Calendar.getInstance(Locale.FRENCH),
+ Locale.FRENCH,
+ JCalendarCombo.DISPLAY_DATE | JCalendarCombo.DISPLAY_TIME,
+ false);
+ calendar4.addDateListener(listener);
- // Add all the calendars to the content pane
+ // Add all the calendars to the content pane
- JPanel panel1 = new JPanel(new BorderLayout());
- panel1.add(calendar1, BorderLayout.NORTH);
- contentPane.add(panel1);
+ JPanel panel1 = new JPanel(new BorderLayout());
+ panel1.add(calendar1, BorderLayout.NORTH);
+ contentPane.add(panel1);
- JPanel panel2 = new JPanel(new BorderLayout());
- panel2.add(calendar2, BorderLayout.NORTH);
- contentPane.add(panel2);
+ JPanel panel2 = new JPanel(new BorderLayout());
+ panel2.add(calendar2, BorderLayout.NORTH);
+ contentPane.add(panel2);
- JPanel panel3 = new JPanel(new BorderLayout());
- panel3.add(calendar3, BorderLayout.NORTH);
- contentPane.add(panel3);
+ JPanel panel3 = new JPanel(new BorderLayout());
+ panel3.add(calendar3, BorderLayout.NORTH);
+ contentPane.add(panel3);
- JPanel panel4 = new JPanel(new BorderLayout());
- panel4.add(calendar4, BorderLayout.NORTH);
- contentPane.add(panel4);
+ JPanel panel4 = new JPanel(new BorderLayout());
+ panel4.add(calendar4, BorderLayout.NORTH);
+ contentPane.add(panel4);
- // Make the window visible
+ // Make the window visible
- pack();
- setVisible(true);
-}
+ pack();
+ setVisible(true);
+ }
//**********************************************************************
// Inner Classes
//**********************************************************************
-private class MyDateListener
- implements DateListener
-{
+ private class MyDateListener
+ implements DateListener
+ {
+
+ public void
+ dateChanged(
+ DateEvent e)
+ {
+ Calendar c = e.getSelectedDate();
+ if (c != null) {
+ System.out.println(c.getTime());
+ }
+ else {
+ System.out.println("No time selected.");
+ }
+ }
-public void
-dateChanged(
- DateEvent e)
-{
- Calendar c = e.getSelectedDate();
- if (c != null) {
- System.out.println(c.getTime());
- }
- else {
- System.out.println("No time selected.");
}
-}
-
-}
//**********************************************************************
// End Inner Classes