小编Eli*_*ias的帖子

JavaFX 2中的组合框选择项

我在javaFX中有一个用国家填充的组合.

我的目标:

public static class CountryObj {

    private  String TCountryDescr;
    private  String TCountryCode;        

    private CountryObj(String CountryDescr,String CountryCode) {
        this.TCountryDescr = CountryDescr;         
        this.TCountryCode = CountryCode;             
    }  
    public String getTCountryCode() {
        return TCountryCode;
    }
    public void setTCountryCode(String fComp) {
        TCountryCode= fComp;
    }         
    public String getTCountryDescr() {
        return TCountryDescr;
    }
    public void setCountryDescr(String fdescr) {
        TCountryDescr = fdescr;
    }                 
    @Override
    public String toString() {
        return TCountryDescr;
    }

}    
Run Code Online (Sandbox Code Playgroud)

然后我有我的可观察列表:

private final ObservableList<CountryObj> CountrycomboList =
    FXCollections.observableArrayList(
                 new CountryObj ("United States", "US"),
                 new CountryObj ("United …
Run Code Online (Sandbox Code Playgroud)

select combobox javafx-2

16
推荐指数
3
解决办法
6万
查看次数

javafx GridPane检索特定的Cell内容

我想检索Gridpane中一个特定单元格的内容.我把按钮放在了细胞中

setConstraints(btt , 0 ,1 ) 

setConstraints(btt , 0 ,2 )

getChildren().add....
Run Code Online (Sandbox Code Playgroud)

在我的情况下,这GridPane.getChildren.get(10)是不好的.我想直接进入单元格(4,2)并获取其内容.

javafx cell gridpanel

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

javafx 2 CheckBoxTableCell在tableview中不起作用

我需要一些帮助,即使我的情况很简单.但我无法理解为什么tableview中的复选框没有确定值.我从javafx合奏中得到了例子

我上课了

public class ReservationObj {
    private  BooleanProperty        tcheck;        
    private  StringProperty         tname;      
    private  StringProperty         tstatus;       
    private  int                    tser;

    public ReservationObj(boolean tcheck, String lname , String lBStatus, int serialinVector) {

        this.tcheck = new SimpleBooleanProperty(tcheck);            
        this.tname = new SimpleStringProperty(lname); 
        this.tstatus = new SimpleStringProperty(lBStatus);  

        this.tser = serialinVector;   

        this.tcheck.addListener(new ChangeListener<Boolean>() {

            @Override
            public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
                System.out.println("The check Box is: " + t1);
            }
        });

    }

    public BooleanProperty getTcheck() {return tcheck;}

    public String   getTname() {return tname.getValue() ;} …
Run Code Online (Sandbox Code Playgroud)

java checkbox tableview javafx-2 javafx-8

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

Postgres Exceptions和java

我正在使用"postgresql-9.3-1102.jdbc3.jar"来连接数据库.当我有一个例外,例如一个空值时,我可以使用几种方法来捕获异常.

例如try { ............} catch(PSQLException seRs){ ......... }

要么

try { .......} catch(SQLException se){ .......}

要么

try { .......} catch(Exception se){ ........ }

我的目标是在我感兴趣的情况下捕获特定的SQLState.

例如,我想捕获一个字段的无效NULL值,Postgress返回值"23502"SQLState但在任何先前的"捕获"我不能这样做,因为错误代码是继承的我无法检查它.

在之前的"捕获"中,我可以拥有".getmessage",但这并不能帮助我,我想检查SqlState

谢谢你的任何想法.

java postgresql exception-handling exception

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