小编Mat*_*han的帖子

运行javafx程序时发生InvocationTargetException

所以这在javafx的例子中起作用,当时我的电脑有jdk 1.7.0,所以这可能是java8中FX的新版本;

我得到了一个很好的堆栈跟踪

jfx-project-run:
Executing E:\workspace\PathFinderApp\dist\run1095471771\PathFinderApp.jar using platform C:\Program Files\Java\jdk1.8.0\jre/bin/java
Exception in Application start method
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:894)
    at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56)
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158)
    at java.lang.Thread.run(Thread.java:744)
Caused by: javafx.fxml.LoadException: 
file:/E:/workspace/PathFinderApp/dist/run1095471771/PathFinderApp.jar!/com/rpg/gui/main.fxml:11

    at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)
    at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:104)
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:937)
    at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:976)
    at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:216)
    at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:738)
    at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2723)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3230) …
Run Code Online (Sandbox Code Playgroud)

java netbeans javafx

19
推荐指数
2
解决办法
8万
查看次数

没有合适的排序错误方法

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Collection;

public class ClearlyAnArrayList
{
    public static void main(String[] args){
        Scanner kb=new Scanner(System.in);
        ArrayList<Integer>ints=new ArrayList<Integer>();
        int num=kb.nextInt();
            while(num!=-1){
            ints.add(num);
            }
    sortPrint(ints);
}

    public static void sortPrint(Collection<Integer>ints){
        Collections.sort(ints);
        for(Integer i:ints){
        System.out.printf("%d\n",i);
        }
}
}
Run Code Online (Sandbox Code Playgroud)

这是我用blueJ编译的代码当我编译它时,我得到一个冗长的错误,从" no suitable method for sort(java.util.Collection<java.lang.Integer>)" 开始,然后继续说更多我不理解的东西.

对此的解决方案是我使用的List不是集合并且Collections.sort()需要List

import对于我的所有工具,还有比单数语句更好的方法吗?

给出的解决方案是

import java.util.*;
Run Code Online (Sandbox Code Playgroud)

java

6
推荐指数
1
解决办法
2万
查看次数

无法处理绑定

我目前正在尝试使用此模型创建人员列表

{firstName: "", lastname: "", address:""}
Run Code Online (Sandbox Code Playgroud)

在多值选择.

在我的viewModel中,我有一个名为selectedItem的字段,我将其设置为null,因为没有选择任何内容开始.

在我的视图中,我能够将selectedItem设置为在我的Select元素中选择的项目,然后我想在屏幕上显示selectedItem的属性,我尝试的方式是

<p data-bind="text: selectedItem.firstName">First Name</p>
<p data-bind="text: selectedItem.lastName">Last Name</p>
<p data-bind="text: selectedItem.address">Address</p>
Run Code Online (Sandbox Code Playgroud)

但它在控制台中说明了这一点

Unable to process binding "text: function (){return selectedItem.firstName }"
Message: Cannot read property 'firstName' of undefined;
Run Code Online (Sandbox Code Playgroud)

这会阻止所有其他绑定发生(我还有一个删除按钮). 上下文的屏幕截图,我在描述事情时很糟糕 控制台消息似乎表明viewModel是在页面之后处理或者那个效果导致的,否则它会抱怨空值正确??? 无论如何,如果selectedItem未定义/ null,或者我以错误的方式尝试这种方式,是否会忽略绑定?

编辑:这是一个jsFiddle,但我注意到它与我正在使用的node-webkit环境的行为不同100%,它接收列表中第一个项目的所有数据,但之后没有别的什么

knockout.js durandal

4
推荐指数
1
解决办法
2万
查看次数

使用Dlookup返回访问中的多个项目

DealID是使用Combobox设置的,它需要在其下方的字段中显示最多3个MID

Private Sub DealID_AfterUpdate()
Dim strFilter As String
strFilter = "DealID = " & Me!DealID
Me!MID = DLookup("MID", "DealContent", strFilter)
Exit_ProductID_AfterUpdate:
Exit Sub
End Sub
Run Code Online (Sandbox Code Playgroud)

这是我使用明显限制的代码是Dlookup只返回它找到的第一个结果.这会造成2个问题,但是我会关注第一个问题,它不会显示多个MID

那么如何才能显示1-3个MID?

我有的第二个问题是更深入,但如果有人想帮助,个人聊天将不胜感激.基本上上面的表单是一个子表单,我需要它在表单表中为每个Mount ID保存一个单独的条目.

如果有人想提供帮助但不理解(我的提交通常就是这种情况),我认为Skype上的屏幕共享是最好的选择.

ms-access vba access-vba

3
推荐指数
1
解决办法
2万
查看次数

如何在JavaFX TableView中悬停一行时发生一些事情?

现在,当在tableview中选择一行时,我在鼠标位置显示对话框.当我将鼠标悬停在每一行上时,我希望显示对话框,似乎有一个CSS:悬停所以我认为它可以在某些容量的Java代码中捕获.

java javafx

2
推荐指数
1
解决办法
4554
查看次数

为什么按钮不是水平对齐堆栈面板?

我有一个从数据生成的按钮列表,因此有可变数量的按钮.在我正在检修的旧版本软件中,他们使用随机自定义控件,但结果是有一个无限增长的水平卷轴.

看起来我有完全相同的XAML,但它没有水平对齐每个项目,只是垂直对齐

只是垂直

<ScrollViewer Background="#33FFFFFF" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled" >
    <StackPanel Orientation="Horizontal">
        <ItemsControl ItemsSource="{Binding Events}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Button Margin="10" HorizontalAlignment="Stretch" Background="#FF1B1B1B" BorderThickness="5" BorderBrush="White" Command="{Binding Source={StaticResource Locator}, Path=EventSelector.ViewEventCommand}" CommandParameter="{Binding }">
                        <Grid Name="tileGridButton" Height="600" Width="400" Margin="5">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="5*"></RowDefinition>
                                <RowDefinition Height="5*"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Border Grid.Row="0" Name="tileImageBorder" Margin="5" BorderThickness="1" VerticalAlignment="Stretch" HorizontalAlignment="Center">
                                <Image Name="tileImage" Margin="0" Source="{Binding ImageURL}"/>
                            </Border>
                            <Grid Grid.Row="1" VerticalAlignment="Top">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="6*"></RowDefinition>
                                    <RowDefinition Height="4*"></RowDefinition>
                                </Grid.RowDefinitions>
                                <TextBlock Grid.Row="0" Name="tileText" Margin="5" Foreground="White" TextAlignment="Center" TextTrimming="CharacterEllipsis" TextWrapping="Wrap" FontSize="30" FontWeight="Bold" Text="{Binding Title}" />
                                <TextBlock Grid.Row="1" Name="tileDescription" Margin="5" Foreground="White" TextAlignment="Center" TextTrimming="CharacterEllipsis" TextWrapping="Wrap" …
Run Code Online (Sandbox Code Playgroud)

wpf mvvm-light

2
推荐指数
1
解决办法
68
查看次数

方法上的类型不兼容

import java.util.*;
import java.lang.Math;

class StandardDeviation{
  public static void main(String args[]){
    ArrayList<Double> numbers = new ArrayList<Double>();
    Scanner kb=new Scanner(System.in);
    double in=kb.nextDouble();
    while(in!=-1){
        numbers.add(kb.nextDouble()); 
    }
    double avg = getAvg(numbers);
    double stdD = getD(avg,numbers);// tells me these are incompatible types
    System.out.printf("%f\n",stdD);
  }

  public static double getAvg(ArrayList<Double> numbers){
    double sum = 0.0;
    for (Double num : numbers){
        sum+= num;
    }
    return sum/numbers.size();
  }

  public static void getD(double avg, ArrayList<Double> numbers){
    ArrayList<Double> newSet = new ArrayList<Double>();
    for (int i = 0; i < numbers.size(); …
Run Code Online (Sandbox Code Playgroud)

java incompatibletypeerror

0
推荐指数
1
解决办法
571
查看次数