Creates a JFrame with a JCalendar inside and can be used for testing.

@param s
The command line arguments
163804
public static void main(String[] s) {
		JFrame frame = new JFrame("JCalendar");

		JCalendar jcalendar = new JCalendar();
		frame.getContentPane().add(jcalendar);
		frame.pack();
		frame.setVisible(true);
	}
1039466
public static void main(String[] args) {
        ///////////////////////////////////////////////////////////////////////////////////////////
        // If desired, set a swing look and feel here. 
        try {
            /*
            // Set a specific look and feel.
            for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
            
            // Set a random look and feel. 
            LookAndFeelInfo[] installedLooks = UIManager.getInstalledLookAndFeels();
            int lookIndex = (int) (Math.random() * installedLooks.length);
            UIManager.setLookAndFeel(installedLooks[lookIndex].getClassName());
            System.out.println(installedLooks[lookIndex].getClassName().toString());
             */
        } catch (Exception e) {
        }

        ///////////////////////////////////////////////////////////////////////////////////////////
        // Create a frame, a panel, and our demo buttons.
        frame = new JFrame();
        frame.setTitle("LGoodDatePicker Demo " + InternalUtilities.getProjectVersionString());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        panel = new DemoPanel();
        frame.getContentPane().add(panel);
        createDemoButtons();

        ///////////////////////////////////////////////////////////////////////////////////////////
        // This section creates DatePickers, with various features.
        //
        // Create variables for repeated use.
        DatePickerSettings dateSettings;
        int row = rowMultiplier;
        final LocalDate today = LocalDate.now();
        int pickerNumber = 0;

        // Create a date picker: With default settings
        datePicker1 = new DatePicker();
        panel.panel1.add(datePicker1, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Default Settings:");

        // Create a date picker: With highlight policy.
        dateSettings = new DatePickerSettings();
        datePicker2 = new DatePicker(dateSettings);
        dateSettings.setHighlightPolicy(new SampleHighlightPolicy());
        panel.panel1.add(datePicker2, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Highlight Policy:");

        // Create a date picker: With veto policy.
        // Note: Veto policies can only be set after constructing the date picker.
        dateSettings = new DatePickerSettings();
        datePicker = new DatePicker(dateSettings);
        dateSettings.setVetoPolicy(new SampleDateVetoPolicy());
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Veto Policy:");

        // Create a date picker: With both policies.
        // Note: Veto policies can only be set after constructing the date picker.
        dateSettings = new DatePickerSettings();
        datePicker = new DatePicker(dateSettings);
        dateSettings.setHighlightPolicy(new SampleHighlightPolicy());
        dateSettings.setVetoPolicy(new SampleDateVetoPolicy());
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Both Policies:");

        // Create a date picker: With Hidden text field (Showing button only).
        // Note: A developer might want to do this if they were providing their own component 
        // for displaying the date.
        dateSettings = new DatePickerSettings();
        dateSettings.setVisibleDateTextField(false);
        dateSettings.setGapBeforeButtonPixels(0);
        datePicker = new DatePicker(dateSettings);
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier),
            "Date " + (++pickerNumber) + ", Hidden text field (Showing button only):");

        // Create a date picker: With date range limits.
        // Notes: 
        // * If you only want to limit one side of the date range, you can optionally pass in null 
        // for one of the date limits.
        // * Date range limits (and other types of veto policies) can only be set after constructing 
        // the date picker.
        dateSettings = new DatePickerSettings();
        datePicker = new DatePicker(dateSettings);
        dateSettings.setDateRangeLimits(today.minusDays(20), today.plusDays(20));
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier),
            "Date " + (++pickerNumber) + ", Limit date range (+/- 20 days):");

        // Create a date picker: Custom button icon.
        // You can replace the example image with any image file that is desired.
        // See also: JButton.setPressedIcon() and JButton.setDisabledIcon().
        // Get the example image icon.
        URL dateImageURL = FullDemo.class.getResource("/images/datepickerbutton1.png");
        Image dateExampleImage = Toolkit.getDefaultToolkit().getImage(dateImageURL);
        ImageIcon dateExampleIcon = new ImageIcon(dateExampleImage);
        // Create the date picker, and apply the image icon.
        dateSettings = new DatePickerSettings();
        datePicker = new DatePicker(dateSettings);
        datePicker.setDateToToday();
        JButton datePickerButton = datePicker.getComponentToggleCalendarButton();
        datePickerButton.setText("");
        datePickerButton.setIcon(dateExampleIcon);
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Custom Icon:");

        // Create a date picker: Change calendar size.
        dateSettings = new DatePickerSettings();
        int newHeight = (int) (dateSettings.getSizeDatePanelMinimumHeight() * 1.6);
        int newWidth = (int) (dateSettings.getSizeDatePanelMinimumWidth() * 1.6);
        dateSettings.setSizeDatePanelMinimumHeight(newHeight);
        dateSettings.setSizeDatePanelMinimumWidth(newWidth);
        datePicker = new DatePicker(dateSettings);
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Change Calendar Size:");

        // Create a date picker: Show Week Numbers.
        // This will display week numbers on the left side of the calendar.
        // By default, the week number rules are specific to the locale of the settings instance.
        // For custom configuration of week numbers, see also these DatePickerSettings: 
        // setWeekNumberRules(), and setWeekNumbersForceFirstDayOfWeekToMatch();
        dateSettings = new DatePickerSettings();
        dateSettings.setWeekNumbersDisplayed(true, true);
        // If you would like the week numbers to be the same for all calendars, (instead of using
        // the default rules for the settings locale), then you could set the weekNumberRules to
        // one of these two widely used rule sets: WeekFields.ISO or WeekFields.SUNDAY_START.
        // dateSettings.setWeekNumberRules(WeekFields.SUNDAY_START);
        // dateSettings.setWeekNumberRules(WeekFields.ISO);
        datePicker = new DatePicker(dateSettings);
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Show Week Numbers:");

        // Create a date picker: Change Colors and Fonts.
        dateSettings = new DatePickerSettings();
        dateSettings.setWeekNumbersDisplayed(true, true);
        // Set backgrounds:
        dateSettings.setColor(DateArea.CalendarBackgroundNormalDates, Color.CYAN);
        dateSettings.setColor(DateArea.BackgroundOverallCalendarPanel, Color.GREEN);
        dateSettings.setColor(DateArea.BackgroundMonthAndYearMenuLabels, Color.YELLOW);
        dateSettings.setColor(DateArea.BackgroundTodayLabel, Color.YELLOW);
        dateSettings.setColor(DateArea.BackgroundClearLabel, Color.YELLOW);
        dateSettings.setColor(DateArea.BackgroundMonthAndYearNavigationButtons, Color.CYAN);
        dateSettings.setColor(DateArea.BackgroundTopLeftLabelAboveWeekNumbers, Color.ORANGE);
        dateSettings.setColor(DateArea.CalendarBackgroundSelectedDate, Color.PINK);
        dateSettings.setColor(DateArea.CalendarBorderSelectedDate, Color.WHITE);
        dateSettings.setColorBackgroundWeekdayLabels(Color.ORANGE, true);
        dateSettings.setColorBackgroundWeekNumberLabels(Color.ORANGE, true);
        // Set fonts:
        Font randomFont = new Font("Monospaced", Font.ITALIC | Font.BOLD, 20);
        Font smallerFont = new Font("Serif", Font.BOLD, 18);
        dateSettings.setFontMonthAndYearMenuLabels(randomFont);
        dateSettings.setFontMonthAndYearNavigationButtons(randomFont);
        dateSettings.setFontTodayLabel(randomFont);
        dateSettings.setFontClearLabel(randomFont);
        dateSettings.setFontCalendarDateLabels(randomFont);
        dateSettings.setFontCalendarWeekdayLabels(smallerFont);
        dateSettings.setFontCalendarWeekNumberLabels(smallerFont);
        // Set text colors:
        dateSettings.setColor(DateArea.TextMonthAndYearMenuLabels, Color.BLUE);
        dateSettings.setColor(DateArea.TextMonthAndYearNavigationButtons, Color.BLUE);
        dateSettings.setColor(DateArea.TextTodayLabel, Color.BLUE);
        dateSettings.setColor(DateArea.TextClearLabel, Color.BLUE);
        dateSettings.setColor(DateArea.CalendarTextNormalDates, Color.MAGENTA);
        dateSettings.setColor(DateArea.CalendarTextWeekdays, Color.RED);
        dateSettings.setColor(DateArea.CalendarTextWeekNumbers, Color.RED);
        // Create the date picker. 
        datePicker = new DatePicker(dateSettings);
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Change Colors and Fonts:");

        // Create a date picker: Custom font.
        dateSettings = new DatePickerSettings();
        dateSettings.setFontValidDate(new Font("Monospaced", Font.ITALIC | Font.BOLD, 17));
        dateSettings.setColor(DateArea.DatePickerTextValidDate, new Color(0, 100, 0));
        datePicker = new DatePicker(dateSettings);
        datePicker.setDateToToday();
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Custom Font:");

        // Create a date picker: Custom Date Format.
        // When creating a date pattern string for BCE dates, use "u" instead of "y" for the year.
        // For more details about that, see: DatePickerSettings.setFormatForDatesBeforeCommonEra().
        // The various codes for the date pattern string are described at this link:
        // https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
        dateSettings = new DatePickerSettings();
        dateSettings.setFormatForDatesCommonEra("yyyy/MM/dd");
        dateSettings.setFormatForDatesBeforeCommonEra("uuuu/MM/dd");
        datePicker = new DatePicker(dateSettings);
        datePicker.setDateToToday();
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Custom Date Format:");

        // Create a date picker: Another Custom Date Format.
        // When creating a date pattern string for BCE dates, use "u" instead of "y" for the year.
        // For more details about that, see: DatePickerSettings.setFormatForDatesBeforeCommonEra().
        // The various codes for the date pattern string are described at this link:
        // https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
        dateSettings = new DatePickerSettings();
        dateSettings.setFormatForDatesCommonEra("d MMM yyyy");
        dateSettings.setFormatForDatesBeforeCommonEra("d MMM uuuu");
        datePicker = new DatePicker(dateSettings);
        datePicker.setDateToToday();
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Another Custom Date Format:");

        // Create a date picker: With a fixed length date format.
        // When creating a date pattern string for BCE dates, use "u" instead of "y" for the year.
        // For more details about that, see: DatePickerSettings.setFormatForDatesBeforeCommonEra().
        // The various codes for the date pattern string are described at this link:
        // https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
        dateSettings = new DatePickerSettings();
        dateSettings.setFormatForDatesCommonEra("yyyyMMdd");
        dateSettings.setFormatForDatesBeforeCommonEra("uuuuMMdd");
        datePicker = new DatePicker(dateSettings);
        datePicker.setDateToToday();
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", With a fixed length date format:");

        // Create a date picker: Change first weekday.
        dateSettings = new DatePickerSettings();
        dateSettings.setFirstDayOfWeek(DayOfWeek.MONDAY);
        datePicker = new DatePicker(dateSettings);
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Set First Day Of Week (Mon):");

        // Create a date picker: No empty dates. (aka null)
        dateSettings = new DatePickerSettings();
        dateSettings.setAllowEmptyDates(false);
        datePicker = new DatePicker(dateSettings);
        datePicker.addDateChangeListener(
            new SampleDateChangeListener("datePicker16 (Disallow Empty Dates or Null), "));
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Disallow Empty Dates:");

        // Create a date picker: Disallow keyboard editing.
        dateSettings = new DatePickerSettings();
        dateSettings.setAllowKeyboardEditing(false);
        datePicker = new DatePicker(dateSettings);
        datePicker.setDateToToday();
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Disallow Keyboard Editing:");

        // Create a Custom Border Properties List.
        // These border properties will be used for the next two date picker examples.
        // Create a list to hold our border properties. Borders properties will be applied to the
        // calendar in the order that they appear this list.
        ArrayList<CalendarBorderProperties> borderProperties
            = new ArrayList<CalendarBorderProperties>();
        // Set all borders to be yellow, and 10 pixels thick. 
        // (Parts of the yellow border will be overwritten by other border settings.)
        borderProperties.add(new CalendarBorderProperties(
            new Point(1, 1), new Point(5, 5), Color.YELLOW, 10));
        // Make the top center border extra thick. Note: All borders in the same row or column will 
        // be displayed with the same thickness as the thickest border in the same line. 
        borderProperties.add(new CalendarBorderProperties(
            new Point(4, 1), new Point(4, 1), Color.YELLOW, 15));
        // Set the borders surrounding the date box to be green.
        borderProperties.add(new CalendarBorderProperties(
            new Point(3, 3), new Point(5, 5), Color.GREEN, 10));
        // Individually set the borders in the top corners of the date box to be blue.
        borderProperties.add(new CalendarBorderProperties(
            new Point(3, 3), new Point(3, 3), Color.BLUE, 1));
        borderProperties.add(new CalendarBorderProperties(
            new Point(5, 3), new Point(5, 3), Color.BLUE, 1));

        // Create a date picker: Custom Borders.
        // Note: Week number borders are always hidden (invisible) unless the the week numbers are 
        // displayed. ("Week number borders" are all borders located in columns 1 and 2.)
        dateSettings = new DatePickerSettings();
        dateSettings.setBorderPropertiesList(borderProperties);
        datePicker = new DatePicker(dateSettings);
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier), "Date " + (++pickerNumber)
            + ", Custom Borders:");

        // Create a date picker: Custom Borders with Week Numbers.
        // Note: Week number borders are always hidden (invisible) unless the the week numbers are 
        // displayed. ("Week number borders" are all borders located in columns 1 and 2.)
        dateSettings = new DatePickerSettings();
        dateSettings.setWeekNumbersDisplayed(true, true);
        dateSettings.setBorderPropertiesList(borderProperties);
        datePicker = new DatePicker(dateSettings);
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier),
            "Date " + (++pickerNumber) + ", Custom Borders with Week Numbers:");

        // Create a date picker: With a default year month, and limited date range.
        // Notes: 
        // * When a default YearMonth has not been set, (or is set to null), the default YearMonth
        // will be YearMonth.now().
        // * If you only want to limit one side of the date range, you can optionally pass in null 
        // for one of the date limits.
        // * Date range limits (and other types of veto policies) can only be set after constructing 
        // the date picker.
        dateSettings = new DatePickerSettings();
        datePicker = new DatePicker(dateSettings);
        LocalDate startJuly = today.plusYears(1);
        startJuly = startJuly.withMonth(7);
        startJuly = startJuly.withDayOfMonth(1);
        LocalDate endJuly = startJuly.withDayOfMonth(startJuly.lengthOfMonth());
        YearMonth yearMonthJuly = YearMonth.from(startJuly);
        dateSettings.setDefaultYearMonth(yearMonthJuly);
        dateSettings.setDateRangeLimits(startJuly.minusDays(10), endJuly.plusDays(10));
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier),
            "<html>Date " + (++pickerNumber) + ", Set Default YearMonth with Range<br>"
                + "(July Next Year + 10 days.):</html>");

        // Create a date picker: Change the text field background color.
        dateSettings = new DatePickerSettings();
        datePicker = new DatePicker(dateSettings);
        dateSettings.setColor(DateArea.TextFieldBackgroundValidDate, Color.cyan);
        panel.panel1.add(datePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel1, 1, (row++ * rowMultiplier),
            "Date " + (++pickerNumber) + ", Change the text field background color:");

        //
        ///////////////////////////////////////////////////////////////////////////////////////////
        // This section creates TimePickers. (1 to 5)
        //
        // Create some variables for repeated use.
        TimePickerSettings timeSettings;
        row = rowMultiplier;

        // Create a time picker: With default settings
        timePicker1 = new TimePicker();
        panel.panel2.add(timePicker1, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 1, Default Settings:");

        // Create a time picker: With No Buttons.
        timeSettings = new TimePickerSettings();
        timeSettings.setDisplayToggleTimeMenuButton(false);
        timeSettings.setInitialTimeToNow();
        timePicker2 = new TimePicker(timeSettings);
        panel.panel2.add(timePicker2, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 2, No Buttons:");

        // Create a time picker: With Spinner Buttons.
        timeSettings = new TimePickerSettings();
        timeSettings.setDisplayToggleTimeMenuButton(false);
        timeSettings.setDisplaySpinnerButtons(true);
        timeSettings.setInitialTimeToNow();
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 3, With Spinner Buttons:");

        // Create a time picker: With All Buttons.
        timeSettings = new TimePickerSettings();
        timeSettings.setDisplaySpinnerButtons(true);
        timeSettings.setInitialTimeToNow();
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 4, With All Buttons:");

        // Create a time picker: 15 minute interval, and 24 hour clock.
        timeSettings = new TimePickerSettings();
        timeSettings.use24HourClockFormat();
        timeSettings.initialTime = LocalTime.of(15, 30);
        timeSettings.generatePotentialMenuTimes(TimeIncrement.FifteenMinutes, null, null);
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 5, Interval 15 minutes, and 24 hour clock:");

        // Create a time picker: Localized (Chinese).
        Locale chineseLocale = new Locale("zh");
        timeSettings = new TimePickerSettings(chineseLocale);
        timeSettings.initialTime = LocalTime.now();
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 6, Localized (to Chinese):");

        // Create a time picker: Custom button icon.
        // You can replace the example image with any desired image file.
        // See also: JButton.setPressedIcon() and JButton.setDisabledIcon().
        // Get the example image icon.
        URL timeIconURL = FullDemo.class.getResource("/images/timepickerbutton1.png");
        Image timeExampleImage = Toolkit.getDefaultToolkit().getImage(timeIconURL);
        ImageIcon timeExampleIcon = new ImageIcon(timeExampleImage);
        // Create the time picker, and apply the image icon.
        timeSettings = new TimePickerSettings();
        timeSettings.initialTime = LocalTime.of(15, 00);
        timePicker = new TimePicker(timeSettings);
        JButton timePickerButton = timePicker.getComponentToggleTimeMenuButton();
        timePickerButton.setText("");
        timePickerButton.setIcon(timeExampleIcon);
        // Adjust the button size to fit the new icon.
        Dimension newTimeButtonSize = new Dimension(
            timeExampleIcon.getIconWidth() + 4, timeExampleIcon.getIconHeight() + 4);
        timePickerButton.setPreferredSize(newTimeButtonSize);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 7, Custom Icon:");

        ///////////////////////////////////////////////////////////////////////////////////////////
        // This section creates DateTimePickers. (1 to 5)
        //
        // Create a DateTimePicker: Default settings
        dateTimePicker1 = new DateTimePicker();
        panel.panel2.add(dateTimePicker1, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier),
            "DateTimePicker 1, Default settings:");

        // Create a DateTimePicker: Disallow empty dates and times.
        dateSettings = new DatePickerSettings();
        timeSettings = new TimePickerSettings();
        dateSettings.setAllowEmptyDates(false);
        timeSettings.setAllowEmptyTimes(false);
        dateTimePicker2 = new DateTimePicker(dateSettings, timeSettings);
        panel.panel2.add(dateTimePicker2, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier),
            "DateTimePicker 2, Disallow empty dates and times:");

        // Create a DateTimePicker: With change listener.
        dateTimePicker3 = new DateTimePicker();
        dateTimePicker3.addDateTimeChangeListener(new SampleDateTimeChangeListener(
            "dateTimePicker3"));
        panel.panel2.add(dateTimePicker3, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier),
            "DateTimePicker 3, With Change Listener:");

        ///////////////////////////////////////////////////////////////////////////////////////////
        // This section creates any remaining TimePickers.
        // Create a time picker: Disallow Empty Times.
        timeSettings = new TimePickerSettings();
        timeSettings.setAllowEmptyTimes(false);
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 8, Disallow Empty Times:");

        // Create a time picker: With TimeChangeListener.
        timeSettings = new TimePickerSettings();
        timePicker = new TimePicker(timeSettings);
        timePicker.addTimeChangeListener(new SampleTimeChangeListener("timePicker7"));
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 9, With a TimeChangeListener:");

        // Create a time picker: With more visible rows.
        timeSettings = new TimePickerSettings();
        timeSettings.maximumVisibleMenuRows = 20;
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 10, With 20 visible menu rows:");

        // Create a time picker: Custom Format.
        timeSettings = new TimePickerSettings();
        timeSettings.setFormatForDisplayTime("ha");
        timeSettings.setFormatForMenuTimes("ha");
        timeSettings.initialTime = LocalTime.of(15, 00);
        timeSettings.generatePotentialMenuTimes(TimeIncrement.OneHour, null, null);
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 11, Custom Format:");

        // Create a time picker: With Veto Policy.
        timeSettings = new TimePickerSettings();
        timePicker = new TimePicker(timeSettings);
        timeSettings.setVetoPolicy(new SampleTimeVetoPolicy());
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier),
            "Time 12, With Veto Policy (Only 9a-5p allowed):");

        // Create a time picker: Seconds precision.
        timeSettings = new TimePickerSettings();
        timeSettings.setFormatForDisplayTime(PickerUtilities.createFormatterFromPatternString(
            "HH:mm:ss", timeSettings.getLocale()));
        timeSettings.setFormatForMenuTimes(PickerUtilities.createFormatterFromPatternString(
            "HH:mm", timeSettings.getLocale()));
        timeSettings.initialTime = LocalTime.of(15, 00, 00);
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 13, Seconds precision (ISO format):");

        // Create a time picker: Milliseconds precision.
        timeSettings = new TimePickerSettings();
        timeSettings.setFormatForDisplayTime(PickerUtilities.createFormatterFromPatternString(
            "HH:mm:ss.SSS", timeSettings.getLocale()));
        timeSettings.setFormatForMenuTimes(PickerUtilities.createFormatterFromPatternString(
            "HH:mm", timeSettings.getLocale()));
        timeSettings.initialTime = LocalTime.of(15, 00, 00, 999000000);
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 14, Millisecond precision (ISO format):");

        // Create a time picker: Nanoseconds precision.
        timeSettings = new TimePickerSettings();
        DateTimeFormatter displayTimeFormatter = DateTimeFormatter.ISO_LOCAL_TIME;
        timeSettings.setFormatForDisplayTime(displayTimeFormatter);
        timeSettings.setFormatForMenuTimes(PickerUtilities.createFormatterFromPatternString(
            "HH:mm", timeSettings.getLocale()));
        timeSettings.initialTime = LocalTime.of(15, 00, 00, 999999999);
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier),
            "<html>Time 15, Nanosecond precision:<br/>(ISO format. Use \".\" to type nanoseconds.)</html>");

        // Create a time picker: Disallow Keyboard Editing.
        timeSettings = new TimePickerSettings();
        timeSettings.setAllowKeyboardEditing(false);
        timePicker = new TimePicker(timeSettings);
        panel.panel2.add(timePicker, getConstraints(1, (row * rowMultiplier), 1));
        panel.addLabel(panel.panel2, 1, (row++ * rowMultiplier), "Time 16, Disallow Keyboard Editing:");

        ///////////////////////////////////////////////////////////////////////////////////////////
        // This section creates any remaining DateTimePickers.
        // (None here at the moment.)
        //
        ///////////////////////////////////////////////////////////////////////////////////////////
        // This section creates date pickers and labels for demonstrating the language translations.
        int rowMarker = 0;
        addLocalizedPickerAndLabel(++rowMarker, "Arabic:", "ar");
        addLocalizedPickerAndLabel(++rowMarker, "Bulgarian:", "bg");
        addLocalizedPickerAndLabel(++rowMarker, "Chinese:", "zh");
        addLocalizedPickerAndLabel(++rowMarker, "Czech:", "cs");
        addLocalizedPickerAndLabel(++rowMarker, "Danish:", "da");
        addLocalizedPickerAndLabel(++rowMarker, "Dutch:", "nl");
        addLocalizedPickerAndLabel(++rowMarker, "English:", "en");
        addLocalizedPickerAndLabel(++rowMarker, "Finnish:", "fi");
        addLocalizedPickerAndLabel(++rowMarker, "French:", "fr");
        addLocalizedPickerAndLabel(++rowMarker, "German:", "de");
        addLocalizedPickerAndLabel(++rowMarker, "Greek:", "el");
        addLocalizedPickerAndLabel(++rowMarker, "Hindi:", "hi");
        addLocalizedPickerAndLabel(++rowMarker, "Italian:", "it");
        addLocalizedPickerAndLabel(++rowMarker, "Indonesian:", "in");
        addLocalizedPickerAndLabel(++rowMarker, "Japanese:", "ja");
        addLocalizedPickerAndLabel(++rowMarker, "Korean:", "ko");
        addLocalizedPickerAndLabel(++rowMarker, "Norwegian:", "no");
        addLocalizedPickerAndLabel(++rowMarker, "Polish:", "pl");
        addLocalizedPickerAndLabel(++rowMarker, "Portuguese:", "pt");
        addLocalizedPickerAndLabel(++rowMarker, "Romanian:", "ro");
        addLocalizedPickerAndLabel(++rowMarker, "Russian:", "ru");
        addLocalizedPickerAndLabel(++rowMarker, "Spanish:", "es");
        addLocalizedPickerAndLabel(++rowMarker, "Swedish:", "sv");
        addLocalizedPickerAndLabel(++rowMarker, "Turkish:", "tr");
        addLocalizedPickerAndLabel(++rowMarker, "Vietnamese:", "vi");

        // This section creates an independent CalendarPanel.
        // This CalendarPanel includes a calendar selection listener and a border.
        DatePickerSettings settings = new DatePickerSettings();
        CalendarPanel calendarPanel = new CalendarPanel(settings);
        calendarPanel.setSelectedDate(LocalDate.now());
        calendarPanel.addCalendarListener(new SampleCalendarListener());
        calendarPanel.setBorder(new LineBorder(Color.lightGray));
        panel.independentCalendarPanel.add(calendarPanel, CC.xy(2, 2));

        // Display the frame.
        frame.pack();
        frame.validate();
        int maxWidth = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().width;
        int maxHeight = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().height;
        frame.setSize(maxWidth / 4 * 3, maxHeight / 8 * 7);
        frame.setLocation(maxWidth / 8, maxHeight / 16);
        frame.setVisible(true);
    }
148288
public static A_CmsAjaxGallery createInstance(String galleryTypeName, CmsJspActionElement jsp) {

        if (jsp != null) {
            // must have a valid JSP in order to read from the user session
            HttpSession session = jsp.getRequest().getSession();
            // lookup the workplace settings
            CmsWorkplaceSettings settings = (CmsWorkplaceSettings)session.getAttribute(
                CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
            if (settings != null) {
                if (CmsStringUtil.isEmpty(galleryTypeName)) {
                    // look up the gallery type from the settings
                    galleryTypeName = settings.getGalleryType();
                } else {
                    // store the last used gallery type name
                    settings.setGalleryType(galleryTypeName);
                }
            }
        }
        // get the gallery class name for the type
        A_CmsAjaxGallery template = OpenCms.getWorkplaceManager().getGalleries().get(galleryTypeName);

        if (template == null) {
            // requested gallery type is not configured
            CmsMessageContainer message;
            if (jsp == null) {
                message = Messages.get().container(Messages.LOG_UNKNOWN_GALLERY_TYPE_REQ_1, galleryTypeName);
            } else {
                message = Messages.get().container(
                    Messages.LOG_UNKNOWN_GALLERY_TYPE_REQ_JSP_2,
                    galleryTypeName,
                    jsp.info("opencms.request.element.uri"));
            }
            LOG.error(message.key());
            throw new CmsRuntimeException(message);
        }

        try {
            // first get the class of the gallery
            Class<?> galleryClass = Class.forName(template.getResourceType().getFolderClassName());
            // create a new instance and cast to a gallery
            A_CmsAjaxGallery galleryInstance = (A_CmsAjaxGallery)galleryClass.newInstance();
            // set the type name and id
            galleryInstance.m_resourceType = template.getResourceType();
            galleryInstance.m_galleryTypeParams = template.getResourceType().getFolderClassParams();
            // initialize the members
            galleryInstance.initWorkplaceMembers(jsp);
            // perform other initialization
            galleryInstance.init();
            // return the result
            return galleryInstance;
        } catch (Exception e) {
            // requested type is not configured
            CmsMessageContainer message;
            if (jsp == null) {
                message = Messages.get().container(
                    Messages.LOG_CREATE_GALLERY_INSTANCE_FAILED_2,
                    template.getResourceType().getFolderClassName(),
                    galleryTypeName);
            } else {
                message = Messages.get().container(
                    Messages.LOG_CREATE_GALLERY_INSTANCE_FAILED_JSP_3,
                    template.getResourceType().getFolderClassName(),
                    galleryTypeName,
                    jsp.info("opencms.request.element.uri"));
            }
            LOG.error(message.key());
            throw new CmsRuntimeException(message);
        }
    }
726246
private JFrame initMainFrame()
    {
        final String title = getTitle();
        final JFrame jframe = new JFrame(title, conf);
        jframe.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        jframe.addWindowListener(new WindowAdapter()
        {
            @Override
            public void windowClosing(WindowEvent event)
            {
                listeners.forEach(ScreenListener::notifyClosed);
            }
        });
        jframe.setResizable(false);
        jframe.setUndecorated(false);
        jframe.setIgnoreRepaint(true);

        return jframe;
    }
481060
protected PageComponent createPageComponent(PageComponentDescriptor descriptor) {
        PageComponent pageComponent = descriptor.createPageComponent();
        pageComponent.setContext(new DefaultViewContext(this, createPageComponentPane(pageComponent)));
        if (pageComponent instanceof ApplicationListener && getApplicationEventMulticaster() != null) {
            getApplicationEventMulticaster().addApplicationListener((ApplicationListener) pageComponent);
        }

        return pageComponent;
    }
1342494
@Override
    public JmsQueue createQueue(String name) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createQueue", name);
        JmsQueue queue = null;

        // if name string is null, empty or just "queue://", throw exception
        if ((name == null) || ("".equals(name)) || (JmsQueueImpl.QUEUE_PREFIX.equals(name))) {
            throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
                                                                           InvalidDestinationException.class,
                                                                           "INVALID_VALUE_CWSIA0003",
                                                                           new Object[] { "Queue name", name },
                                                                           tc
                            );
        }

        // if name is "topic://" throw exception
        if (name.startsWith(JmsTopicImpl.TOPIC_PREFIX)) {
            throw (InvalidDestinationException) JmsErrorUtils.newThrowable(
                                                                           InvalidDestinationException.class,
                                                                           "MALFORMED_DESCRIPTOR_CWSIA0047",
                                                                           new Object[] { "Queue", name },
                                                                           tc
                            );
        }

        name = name.trim();
        queue = (JmsQueue) destCreator.createDestinationFromString(name, URIDestinationCreator.DestType.QUEUE);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createQueue", queue);
        return queue;
    }
538450
@Override
    public QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSRuntimeException, InvalidDestinationRuntimeException, InvalidSelectorRuntimeException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createBrowser", new Object[] { queue, messageSelector });

        QueueBrowser queueBrowser = null;

        try {
            queueBrowser = jmsSession.createBrowser(queue, messageSelector);
        } catch (InvalidDestinationException ide) {
            throw (InvalidDestinationRuntimeException) JmsErrorUtils.getJMS2Exception(ide, InvalidDestinationRuntimeException.class);
        } catch (InvalidSelectorException ise) {
            throw (InvalidSelectorRuntimeException) JmsErrorUtils.getJMS2Exception(ise, InvalidSelectorRuntimeException.class);
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createBrowser");
        }

        return queueBrowser;
    }
449344
private void init(int ignoreFrames, boolean partial)
    {
        // Extract stack components, after we look for the Frame constructor
 	    // itself and pull that off the stack!
        int check=_stack.length;
        if (check>3) check=3;
        for (int i=0;i<check;i++)
        {
            if (__className.equals(_stack[i].getClassName()) &&
                "<init>".equalsIgnoreCase(_stack[i].getMethodName()))
            {
                _top=i+1;
                break;
            }
        }
        _top+=ignoreFrames;
        _where=_stack[_top].toString();
        if (!partial) complete();
    }
1040826
protected void displayInFrame(String title)
    {
        JFrame frame = new JFrame(title);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        configure(frame);
        frame.pack();
        frame.setVisible(true);
    }
712533
private static JFrame showDotPlotJFrame(AFPChain afpChain ) {

		DotPlotPanel dotplot = new DotPlotPanel(afpChain);

		//Create JFrame

		String title = String.format("Dot plot of %s vs. %s", afpChain.getName1(),afpChain.getName2());

		// Create window
		JFrame frame = new JFrame(title);
		frame.addWindowListener(new WindowAdapter(){
			@Override
			public void windowClosing(WindowEvent e){
				JFrame f = (JFrame) e.getSource();
				f.setVisible(false);
				f.dispose();
			}
		});


		frame.getContentPane().add(dotplot);

		frame.pack();
		frame.setVisible(true);

		return frame;
	}
1022017
public static void main(String args[])
    {
        BaseApplet.main(args);
        AppointmentApplet applet = (AppointmentApplet)AppointmentApplet.getSharedInstance();
        if (applet == null)
            applet = new AppointmentApplet(args);
        new JBaseFrame("Test", applet);
    }
333936
@Override
	public DynamicMBean createFor(List<?> monitorables, MBeanSettings setting, boolean enableRefresh) {
		checkNotNull(monitorables);
		checkArgument(monitorables.size() > 0, "Size of list of monitorables should be greater than 0");
		checkArgument(monitorables.stream().noneMatch(Objects::isNull), "Monitorable can not be null");
		checkArgument(CollectionUtils.allItemsHaveSameType(monitorables), "Monitorables should be of the same type");

		Object firstMBean = monitorables.get(0);
		Class<?> mbeanClass = firstMBean.getClass();

		boolean isRefreshEnabled = enableRefresh;

		List<MBeanWrapper> mbeanWrappers = new ArrayList<>(monitorables.size());
		if (ConcurrentJmxMBean.class.isAssignableFrom(mbeanClass)) {
			checkArgument(monitorables.size() == 1, "ConcurrentJmxMBeans cannot be used in pool. " +
					"Only EventloopJmxMBeans can be used in pool");
			isRefreshEnabled = false;
			mbeanWrappers.add(new ConcurrentJmxMBeanWrapper((ConcurrentJmxMBean) monitorables.get(0)));
		} else if (EventloopJmxMBean.class.isAssignableFrom(mbeanClass)) {
			for (Object monitorable : monitorables) {
				mbeanWrappers.add(new EventloopJmxMBeanWrapper((EventloopJmxMBean) monitorable));
			}
		} else {
			throw new IllegalArgumentException("MBeans should implement either ConcurrentJmxMBean " +
					"or EventloopJmxMBean interface");
		}

		AttributeNodeForPojo rootNode = createAttributesTree(mbeanClass, setting.getCustomTypes());
		rootNode.hideNullPojos(monitorables);

		for (String included : setting.getIncludedOptionals()) {
			rootNode.setVisible(included);
		}

		// TODO(vmykhalko): check in JmxRegistry that modifiers are applied only once in case of workers and pool registartion
		for (String attrName : setting.getModifiers().keySet()) {
			AttributeModifier<?> modifier = setting.getModifiers().get(attrName);
			try {
				rootNode.applyModifier(attrName, modifier, monitorables);
			} catch (ClassCastException e) {
				//noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException - doesn't ignore
				throw new IllegalArgumentException("Cannot apply modifier \"" + modifier.getClass().getName() +
						"\" for attribute \"" + attrName + "\": " + e.toString());
			}
		}

		MBeanInfo mBeanInfo = createMBeanInfo(rootNode, mbeanClass);
		Map<OperationKey, Method> opkeyToMethod = fetchOpkeyToMethod(mbeanClass);

		DynamicMBeanAggregator mbean = new DynamicMBeanAggregator(mBeanInfo, mbeanWrappers, rootNode, opkeyToMethod);

		// TODO(vmykhalko): maybe try to get all attributes and log warn message in case of exception? (to prevent potential errors during viewing jmx stats using jconsole)
//		tryGetAllAttributes(mbean);

		if (isRefreshEnabled) {
			handleJmxRefreshables(mbeanWrappers, rootNode);
		}
		return mbean;
	}
385083
@Override
    protected void prepareGUI(Container container)
    {
        itineraryPanel = new ItineraryPanel(distances.getKnownCities());
        strategyPanel = new StrategyPanel(distances);
        executionPanel = new ExecutionPanel();

        container.add(itineraryPanel, BorderLayout.WEST);
        JPanel innerPanel = new JPanel(new BorderLayout());
        innerPanel.add(strategyPanel, BorderLayout.NORTH);
        innerPanel.add(executionPanel, BorderLayout.CENTER);
        container.add(innerPanel, BorderLayout.CENTER);

        executionPanel.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent actionEvent)
            {
                Collection<String> cities = itineraryPanel.getSelectedCities();
                if (cities.size() < 4)
                {
                    JOptionPane.showMessageDialog(TravellingSalesmanApplet.this,
                                                  "Itinerary must include at least 4 cities.",
                                                  "Error",
                                                  JOptionPane.ERROR_MESSAGE);
                }
                else
                {
                    try
                    {
                        setEnabled(false);
                        createTask(cities).execute();
                    }
                    catch (IllegalArgumentException ex)
                    {
                        JOptionPane.showMessageDialog(TravellingSalesmanApplet.this,
                                                      ex.getMessage(),
                                                      "Error",
                                                      JOptionPane.ERROR_MESSAGE);
                        setEnabled(true);
                    }
                }
            }
        });
        container.validate();
    }
18922
@Nonnull
  public JSDefinedClass _class (@Nonnull @Nonempty final String sName) throws JSNameAlreadyExistsException
  {
    final JSDefinedClass aDefinedClass = new JSDefinedClass (sName);
    return addDeclaration (aDefinedClass);
  }
257266
private static WindowFocusListener createRepaintWindowListener(final JComponent component) {
        return new WindowAdapter() {
            public void windowActivated(WindowEvent e) {
                component.repaint();
            }

            public void windowDeactivated(WindowEvent e) {
                component.repaint();
            }
        };
    }
208359
@Override
    public Object newInstance(Object[] args) throws BeanConstructorNotFoundException {
        Constructor<?> constructor = getSuitableConstructor(args);
        return LdiConstructorUtil.newInstance(constructor, args);
    }
1317882
private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("TableFilterDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //Create and set up the content pane.
        TableFilterDemo newContentPane = new TableFilterDemo();
        newContentPane.setOpaque(true); //content panes must be opaque
        frame.setContentPane(newContentPane);

        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }