小编Phi*_*yyy的帖子

如何在带引导程序的按钮上放置链接?

如何将一个链接放在带引导程序的按钮上?

bootstrap文档中有4种方法:

<a href="#" class="btn btn-info" role="button">Link Button</a>
<button type="button" class="btn btn-info">Button</button>
<input type="button" class="btn btn-info" value="Input Button">
<input type="submit" class="btn btn-info" value="Submit Button">
Run Code Online (Sandbox Code Playgroud)

第一个对我不起作用,没有按钮显示,只有带链接的文本,感觉它的主题即时使用.

第二个显示按钮,这是我想要的,但是什么代码使按钮链接到另一个页面时单击?

干杯

html button hyperlink twitter-bootstrap

78
推荐指数
7
解决办法
21万
查看次数

如何使用更改侦听器JavaFX在两个ListView之间移动项目

我有两个ListViews,allStudentsList已经填充了其中的项目,currentStudentList没有.当用户选择项目时,我的目标allStudentList是移动到该项目currentStudentList.我通过在一个选择模型上放置一个监听器来做到这一点allStudentList.

我得到了一个IndexOutOfBoundsException,我不知道为什么会这样.从测试来看,似乎这个问题被隔离到这个方法的最后4行,但我不知道为什么.

allStudentsList.getSelectionModel().selectedItemProperty()
        .addListener((observableValue, oldValue, newValue) -> {
            if (allStudentsList.getSelectionModel().getSelectedItem() != null) {

                ArrayList<String> tempCurrent = new ArrayList<>();
                for (String s : currentStudentList.getItems()) {
                    tempCurrent.add(s);
                }

                ArrayList<String> tempAll = new ArrayList<>();
                for (String s : allStudentsList.getItems()) {
                    tempAll.add(s);
                }

                tempAll.remove(newValue);
                tempCurrent.add(newValue);

                // clears current studentlist and adds the new list
                if (currentStudentList.getItems().size() != 0) {
                    currentStudentList.getItems().clear();
                }
                currentStudentList.getItems().addAll(tempCurrent);

                // clears the allStudentList and adds the new …
Run Code Online (Sandbox Code Playgroud)

java listview javafx listener

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

如何将文件转换为图像以便在Java中的ImageView中显示?

我试图从文件选择器中选择后立即显示图像文件.文件选择器仅限于.png和.jpg文件,所选文件存储在File类型的变量中.要做到这一点,我已经设置了一个ImageView,我希望用这个新文件设置图像只是问题是它是File not Image类型.

怎么能实现这一目标?代码到目前为止......

public void fileSelection(){

        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle("Select Profile Picture");
        fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Image Files", "*.png", "*jpg"));
        File selectedFile = fileChooser.showOpenDialog(null);
        File selectedFileInput = selectedFile;

        if(selectedFile != null) {
            selectedFileOutput.setText("File selected: " + selectedFile.getName());
            previewPicture.setImage();
        } else {
            selectedFileOutput.setText("Please select a profile picture...");
        }
    }
Run Code Online (Sandbox Code Playgroud)

java javafx image filechooser

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

如何将可观察列表转换为数组列表?爪哇

我正在尝试获取表视图中的所有项目并将它们放在数组列表中以供进一步处理。这就是我想要实现的目标,但显然它行不通。

ArrayList<Consultation> showing = consultationTable.getItems();
Run Code Online (Sandbox Code Playgroud)

java javafx

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

如何根据 JavaFX 中的条件设置列表视图单元格的样式

我试图根据条件设置列表视图中各个单元格的样式。列表视图的类型是Label,在列表视图中插入标签时,条件是根据另一个类确定的。

目前,我尝试设置列表视图中每个标签的背景颜色,但它没有覆盖整个区域(见图)。

在此输入图像描述

我也研究了这篇文章,但它不适合我的情况,因为字符串中不包含用于突出显示列表视图单元格的标识符。

如何动态更改 JavaFX 中列表视图中项目的背景

到目前为止的当前代码:

for (Consultation c : notifications){
            Label l = new Label(": consult reminder - "  + c.getReminderTime());

            if(c.getReminderRead() == 1){ //if the consultation reminder hasn't been read
                l.setStyle("-fx-background-color: #33CEFF");
                counter = counter + 1;
            }


            notificationList.getItems().add(l);
}
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

css java listview javafx

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