Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java jfxtras-运行议程时获得空白白屏_Java_Javafx_Jfxtras - Fatal编程技术网

Java jfxtras-运行议程时获得空白白屏

Java jfxtras-运行议程时获得空白白屏,java,javafx,jfxtras,Java,Javafx,Jfxtras,我正试图建立一个jfxtras演示项目,它只会显示议程,但当我尝试启动应用程序时,我只得到一个白色屏幕 这是我发现的代码,因为集成演示源代码已经过时: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the e

我正试图建立一个jfxtras演示项目,它只会显示议程,但当我尝试启动应用程序时,我只得到一个白色屏幕

这是我发现的代码,因为集成演示源代码已经过时:

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.geometry.HPos;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.stage.Stage;
import javafx.util.Callback;
import jfxtras.scene.control.CalendarTextField;
import jfxtras.scene.control.agenda.Agenda;


/**
 *
 * @author Maxim
 */
public class AgendaApplication extends Application
{
    public AgendaApplication() 
    {
        agenda = new Agenda();

        // setup appointment groups
        final Map<String, Agenda.AppointmentGroup> lAppointmentGroupMap = new TreeMap<String, Agenda.AppointmentGroup>();
        lAppointmentGroupMap.put("group00", new Agenda.AppointmentGroupImpl().withStyleClass("group0"));
        lAppointmentGroupMap.put("group01", new Agenda.AppointmentGroupImpl().withStyleClass("group1"));
        lAppointmentGroupMap.put("group02", new Agenda.AppointmentGroupImpl().withStyleClass("group2"));
        lAppointmentGroupMap.put("group03", new Agenda.AppointmentGroupImpl().withStyleClass("group3"));
        lAppointmentGroupMap.put("group04", new Agenda.AppointmentGroupImpl().withStyleClass("group4"));
        lAppointmentGroupMap.put("group05", new Agenda.AppointmentGroupImpl().withStyleClass("group5"));
        lAppointmentGroupMap.put("group06", new Agenda.AppointmentGroupImpl().withStyleClass("group6"));
        lAppointmentGroupMap.put("group07", new Agenda.AppointmentGroupImpl().withStyleClass("group7"));
        lAppointmentGroupMap.put("group08", new Agenda.AppointmentGroupImpl().withStyleClass("group8"));
        lAppointmentGroupMap.put("group09", new Agenda.AppointmentGroupImpl().withStyleClass("group9"));
        lAppointmentGroupMap.put("group10", new Agenda.AppointmentGroupImpl().withStyleClass("group10"));
        lAppointmentGroupMap.put("group11", new Agenda.AppointmentGroupImpl().withStyleClass("group11"));
        lAppointmentGroupMap.put("group12", new Agenda.AppointmentGroupImpl().withStyleClass("group12"));
        lAppointmentGroupMap.put("group13", new Agenda.AppointmentGroupImpl().withStyleClass("group13"));
        lAppointmentGroupMap.put("group14", new Agenda.AppointmentGroupImpl().withStyleClass("group14"));
        lAppointmentGroupMap.put("group15", new Agenda.AppointmentGroupImpl().withStyleClass("group15"));
        lAppointmentGroupMap.put("group16", new Agenda.AppointmentGroupImpl().withStyleClass("group16"));
        lAppointmentGroupMap.put("group17", new Agenda.AppointmentGroupImpl().withStyleClass("group17"));
        lAppointmentGroupMap.put("group18", new Agenda.AppointmentGroupImpl().withStyleClass("group18"));
        lAppointmentGroupMap.put("group19", new Agenda.AppointmentGroupImpl().withStyleClass("group19"));
        lAppointmentGroupMap.put("group20", new Agenda.AppointmentGroupImpl().withStyleClass("group20"));
        lAppointmentGroupMap.put("group21", new Agenda.AppointmentGroupImpl().withStyleClass("group21"));
        lAppointmentGroupMap.put("group22", new Agenda.AppointmentGroupImpl().withStyleClass("group22"));
        lAppointmentGroupMap.put("group23", new Agenda.AppointmentGroupImpl().withStyleClass("group23"));
        for (String lId : lAppointmentGroupMap.keySet())
        {
            Agenda.AppointmentGroup lAppointmentGroup = lAppointmentGroupMap.get(lId);
            lAppointmentGroup.setDescription(lId);
            agenda.appointmentGroups().add(lAppointmentGroup);
        }

        // accept new appointments
        agenda.createAppointmentCallbackProperty().set(new Callback<Agenda.CalendarRange, Agenda.Appointment>()
        {
            @Override
            public Agenda.Appointment call(Agenda.CalendarRange calendarRange)
            {
                return new Agenda.AppointmentImpl()
                        .withStartTime(calendarRange.getStartCalendar())
                        .withEndTime(calendarRange.getEndCalendar())
                        .withSummary("new")
                        .withDescription("new")
                        .withAppointmentGroup(lAppointmentGroupMap.get("group01"));
            }
        });

        // initial set
        Calendar lFirstDayOfWeekCalendar = getFirstDayOfWeekCalendar(agenda.getLocale(), agenda.getDisplayedCalendar());
        int lFirstDayOfWeekYear = lFirstDayOfWeekCalendar.get(Calendar.YEAR);
        int lFirstDayOfWeekMonth = lFirstDayOfWeekCalendar.get(Calendar.MONTH);
        int FirstDayOfWeek = lFirstDayOfWeekCalendar.get(Calendar.DATE);
        Calendar lToday = agenda.getDisplayedCalendar();
        int lTodayYear = lToday.get(Calendar.YEAR);
        int lTodayMonth = lToday.get(Calendar.MONTH);
        int lTodayDay = lToday.get(Calendar.DATE);
        agenda.appointments().addAll(
        /*
         *  . . . .
         *  . . . . 
         *  A . . .  8:00
         *  A B C .  8:30
         *  A B C D  9:00
         *  A B . D  9:30
         *  A . . D 10:00
         *  A E . D 10:30
         *  A . . D 11:00
         *  . . . D 11:30
         *  . . . D 12:00
         *  F . . D 12:30
         *  F H . D 13:00
         *  . . . . 13:30
         *  G . . . 14:00
         *  . . . . 14:30
         * 
         */
        new Agenda.AppointmentImpl()
                .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 8, 00))
                .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 11, 30))
                .withSummary("A")
                .withDescription("A much longer test description")
                .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 8, 30))
            .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 10, 00))
            .withSummary("B")
            .withDescription("A description 2")
            .withAppointmentGroup(lAppointmentGroupMap.get("group08"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 8, 30))
            .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 9, 30))
            .withSummary("C")
            .withDescription("A description 3")
            .withAppointmentGroup(lAppointmentGroupMap.get("group09"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 9, 00))
            .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 13, 30))
            .withSummary("D")
            .withDescription("A description 4")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 10, 30))
            .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 11, 00))
            .withSummary("E")
            .withDescription("A description 4")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 12, 30))
            .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 13, 30))
            .withSummary("F")
            .withDescription("A description 4")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 13, 00))
            .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 13, 30))
            .withSummary("H")
            .withDescription("A description 4")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 14, 00))
            .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 14, 45))
            .withSummary("G")
            .withDescription("A description 4")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 8, 10))
            .withEndTime(null)
            .withSummary("K asfsfd dsfsdfs fsfds sdgsds dsdfsd ")
            .withDescription("A description 4")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 19, 00))
            .withEndTime(null)
            .withSummary("L asfsfd dsfsdfs fsfds sdgsds dsdfsd ")
            .withDescription("A description 4")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 15, 00))
            .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 16, 00))
            .withSummary("I")
            .withDescription("A description 4")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 15, 30))
            .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 16, 00))
            .withSummary("J")
            .withDescription("A description 4")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
            // -----
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 20, 30))
            .withEndTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay, 20, 31))
            .withSummary("S")
            .withDescription("Too short")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
            // -----
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay))
            .withSummary("all day1")
            .withDescription("A description")
            .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
            .withWholeDay(true)
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay))
            .withSummary("all day2")
            .withDescription("A description")
            .withAppointmentGroup(lAppointmentGroupMap.get("group08"))
            .withWholeDay(true)
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay))
            .withSummary("all day3")
            .withDescription("A description3")
            .withAppointmentGroup(lAppointmentGroupMap.get("group09"))
            .withWholeDay(true)
        ,   new Agenda.AppointmentImpl()
            .withStartTime(new GregorianCalendar(lTodayYear, lTodayMonth, lTodayDay + 1))
            .withSummary("all day")
            .withDescription("A description3")
            .withAppointmentGroup(lAppointmentGroupMap.get("group03"))
            .withWholeDay(true)
        );
    }
    final Agenda agenda;

    public String getSampleName() {
        return this.getClass().getSimpleName();
    }

    public String getSampleDescription() {
        return "Basic Agenda usage";
    }

    public Node getPanel(Stage stage) {
        return agenda;
    }

    public Node getControlPanel() {
        // the result
        GridPane lGridPane = new GridPane();
        lGridPane.setVgap(2.0);
        lGridPane.setHgap(2.0);

        // setup the grid so all the labels will not grow, but the rest will
        ColumnConstraints lColumnConstraintsAlwaysGrow = new ColumnConstraints();
        lColumnConstraintsAlwaysGrow.setHgrow(Priority.ALWAYS);
        ColumnConstraints lColumnConstraintsNeverGrow = new ColumnConstraints();
        lColumnConstraintsNeverGrow.setHgrow(Priority.NEVER);
        lGridPane.getColumnConstraints().addAll(lColumnConstraintsNeverGrow, lColumnConstraintsAlwaysGrow);
        int lRowIdx = 0;

        // week
        {
           /* lGridPane.add(new Label("Week of"), new GridPane.C().row(lRowIdx).col(0).halignment(HPos.RIGHT));
            CalendarTextField lCalendarTextField = new CalendarTextField();
            lGridPane.add(lCalendarTextField, new GridPane.C().row(lRowIdx).col(1));
            lCalendarTextField.calendarProperty().bindBidirectional(agenda.displayedCalendar());*/
        }
        lRowIdx++;

        // done
        return lGridPane;
    }

    public String getJavaDocURL() {
        return "http://jfxtras.org/doc/8.0/" + Agenda.class.getName().replace(".", "/") + ".html";
    }

    public static void main(String[] args) {
        launch(args);
    }


    /**
     * get the calendar for the first day of the week
     */
    static private Calendar getFirstDayOfWeekCalendar(Locale locale, Calendar c)
    {
        // result
        int lFirstDayOfWeek = Calendar.getInstance(locale).getFirstDayOfWeek();
        int lCurrentDayOfWeek = c.get(Calendar.DAY_OF_WEEK);
        int lDelta = 0;
        if (lFirstDayOfWeek <= lCurrentDayOfWeek)
        {
            lDelta = -lCurrentDayOfWeek + lFirstDayOfWeek;
        }
        else
        {
            lDelta = -lCurrentDayOfWeek - (7-lFirstDayOfWeek);
        }
        c = ((Calendar)c.clone());
        c.add(Calendar.DATE, lDelta);
        return c;
    }

    @Override
    public void start(Stage stage) throws Exception {
        new AgendaApplication();
        stage.show();
    }
}
/*
*要更改此许可证标题,请在“项目属性”中选择“许可证标题”。
*要更改此模板文件,请选择工具|模板
*然后在编辑器中打开模板。
*/
导入java.util.Calendar;
导入java.util.GregorianCalendar;
导入java.util.Locale;
导入java.util.Map;
导入java.util.TreeMap;
导入javafx.application.application;
导入静态javafx.application.application.launch;
导入javafx.geometry.HPos;
导入javafx.scene.Group;
导入javafx.scene.Node;
导入javafx.scene.scene;
导入javafx.scene.control.Label;
导入javafx.scene.layout.ColumnConstraints;
导入javafx.scene.layout.GridPane;
导入javafx.scene.layout.Priority;
导入javafx.stage.stage;
导入javafx.util.Callback;
导入jfxtras.scene.control.CalendarTextField;
导入jfxtras.scene.control.agenda.agenda;
/**
*
*@作者格言
*/
公共类AgendaApplication扩展应用程序
{
公共代理应用程序()
{
议程=新议程();
//设置约会组
最终映射lAppointmentGroupMap=新树映射();
lAppointmentGroupMap.put(“group00”,new Agenda.AppointmentGroupImpl().withStyleClass(“group0”);
lAppointmentGroupMap.put(“group01”,new Agenda.AppointmentGroupImpl().withStyleClass(“group1”);
lAppointmentGroupMap.put(“group02”,新议程.AppointmentGroupImpl().withStyleClass(“group2”));
lAppointmentGroupMap.put(“group03”,新议程.AppointmentGroupImpl().with样式类(“group3”);
lAppointmentGroupMap.put(“group04”,新议程.AppointmentGroupImpl()。带有样式类(“group4”);
lAppointmentGroupMap.put(“group05”,新议程.AppointmentGroupImpl().withStyleClass(“group5”);
lAppointmentGroupMap.put(“group06”,new Agenda.AppointmentGroupImpl().withStyleClass(“group6”);
lAppointmentGroupMap.put(“group07”,new Agenda.AppointmentGroupImpl()。带有样式类(“group7”);
lAppointmentGroupMap.put(“group08”,new Agenda.AppointmentGroupImpl()。带有样式类(“group8”);
lAppointmentGroupMap.put(“group09”,new Agenda.AppointmentGroupImpl().withStyleClass(“group9”);
lAppointmentGroupMap.put(“group10”,new Agenda.AppointmentGroupImpl().withStyleClass(“group10”);
lAppointmentGroupMap.put(“group11”,new Agenda.AppointmentGroupImpl().withStyleClass(“group11”);
lAppointmentGroupMap.put(“group12”,new Agenda.AppointmentGroupImpl().withStyleClass(“group12”);
lAppointmentGroupMap.put(“group13”,new Agenda.AppointmentGroupImpl().withStyleClass(“group13”);
lAppointmentGroupMap.put(“group14”,new Agenda.AppointmentGroupImpl().withStyleClass(“group14”);
lAppointmentGroupMap.put(“group15”,new Agenda.AppointmentGroupImpl().withStyleClass(“group15”);
lAppointmentGroupMap.put(“group16”,new Agenda.AppointmentGroupImpl().withStyleClass(“group16”);
lAppointmentGroupMap.put(“group17”,new Agenda.AppointmentGroupImpl().withStyleClass(“group17”);
lAppointmentGroupMap.put(“group18”,new Agenda.AppointmentGroupImpl().withStyleClass(“group18”);
lAppointmentGroupMap.put(“group19”,new Agenda.AppointmentGroupImpl().withStyleClass(“group19”);
lAppointmentGroupMap.put(“group20”,new Agenda.AppointmentGroupImpl().withStyleClass(“group20”);
lAppointmentGroupMap.put(“group21”,新议程.AppointmentGroupImpl().withStyleClass(“group21”));
lAppointmentGroupMap.put(“group22”,new Agenda.AppointmentGroupImpl()。带有样式类(“group22”);
lAppointmentGroupMap.put(“group23”,new Agenda.AppointmentGroupImpl().withStyleClass(“group23”);
对于(字符串lId:lAppointmentGroupMap.keySet())
{
Agenda.appointgroup lappointgroup=lAppointmentGroupMap.get(lId);
lAppointmentGroup.setDescription(lId);
agenda.AppointGroups().add(lAppointmentGroup);
}
//接受新任命
agenda.createAppointmentCallbackProperty().set(new Callback())
{
@凌驾
公共议程.约会呼叫(Agenda.CalendarRange)
{
返回新议程
.withStartTime(calendarRange.getStartCalendar())
.withEndTime(calendarRange.getEndCalendar())
.带摘要(“新”)
.附说明(“新”)
.WithAppointGroup(lAppointmentGroupMap.get(“group01”);
}
});
//初凝
Calendar lFirstDayOfWeekCalendar=getFirstDayOfWeekCalendar(agenda.getLocale(),agenda.getDisplayedCalendar());
int lFirstDayOfWeekYear=lFirstDayOfWeekCalendar.get(Calendar.YEAR);
int lFirstDayOfWeekMonth=lFirstDayOfWeekCalendar.get(Calendar.MONTH);
int FirstDayOfWeek=lffirstDayOfWeekCalendar.get(Calendar.DATE);
Calendar lToday=agenda.getDisplayedCalendar();
int lTodayYear=lToday.get(Calendar.YEAR);
int lTodayMonth=lToday.get(Calendar.MONTH);
int lTodayDay=lToday.get(Calendar.DATE);
议程.约会().addAll(
/*
*  . . . .
*  . . . . 
*A…8点
*公元前8:30
*A B C D 9:00
*A公元前9:30
*A..D 10:00
*公元10:30
*A..D 11:00
*…D 11:30
*…D 12:00
*F..D 12:30
*F H.D 13:00
*  . . . . 13:30
*G…14:00
*  . . . . 14:30
* 
*/
新议程.任命Impl()
.具有起始时间(新的格里高利安日历(lTodayYear,lTodayMonth,
@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Hello World!");


    StackPane root = new StackPane();
    root.getChildren().add(agenda);
    primaryStage.setScene(new Scene(root, 600, 600));
    primaryStage.show();
}