小编Aub*_*bin的帖子

在TableView中使用自定义CellFactory的Javafx 2.0慢速列

我在tableView中有这个自定义的CellFactory.滚动时,该列异常缓慢.任何理由都是这样,我该如何改进它.

lastTradeColumn.setCellFactory(
   new Callback<TableColumn<Stock, Price>,TableCell<Stock, Price>>(){
      @Override public TableCell<Stock, Price> call( TableColumn<Stock, Price> p ) {
         TableCell<Stock, Price> cell = new TableCell<Stock, Price>() {
            @Override public void updateItem(Price price, boolean empty) {
               super.updateItem(price, empty);
               if (price != null) {
                  VBox vbox = new VBox(5);
                  vbox.getChildren().add(new Label("£"+price.toString()));
                  if( price.getOldPrice() > price.getNewPrice()) {
                     vbox.setStyle("-fx-background-color:#EA2A15;");
                  }
                  else if( price.getOldPrice() < price.getNewPrice()) {
                     vbox.setStyle("-fx-background-color:#9CF311;");
                  }
                  setGraphic( vbox );
               }
            }
         };
         return cell;
   }
});
Run Code Online (Sandbox Code Playgroud)

java javafx javafx-2

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

Java:计算错误答案,我的错误在哪里?

我似乎无法弄清楚为什么它打印不正确:

public class test3 {
  public static void main(String[] args) {
    double[] gens = {100, 200.1, 9.3, 10};
    double d0 = 0;
    double d1 = 0;
    double d2 = 0;
    double d3 = 0;
    double d4 = 0;
    double d5 = 0;
    double d6 = 0;
    double d7 = 0;
    double d8 = 0;
    double d9 = 0;
    for (int i = 0; i < gens.length; i++) {
      double percs = gens[i];
      while (percs < -9 || 9 < percs) …
Run Code Online (Sandbox Code Playgroud)

java arrays

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

从字符串中删除空格以进行http连接

我正在尝试发送查询网址

String url = String.format(
   "http://xxxxx/xxx/xxx&message=%s",myEditBox.getText.toString());
// Create a new HttpClient and Post Header
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
httpclient.getCookieStore().addCookie(cooki);
try {
   ResponseHandler<String> responseHandler = new BasicResponseHandler();
   httpclient.getParams().setParameter("http.connection-manager.timeout", 15000);
   String response = httpclient.execute(httppost, responseHandler);
Run Code Online (Sandbox Code Playgroud)

给我错误,illegal character at query.那white space可能是.如何处理这个问题?

最好的祝福

java android

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

如何在java中为设计着色?

嗨!我有这个问题:我必须在java中创建一个程序设计一个人的图形,我必须绘制它.我已经编写了设计人类的代码,但我不知道如何用颜色填充形状.我知道我必须使用"java.awt.Color",但我不知道如何.

颜色必须是:图像背景(黄色),头部(蓝色),手臂和腿部(绿色),身体(红色).

到目前为止,这是我的代码:

import javax.swing.*;
import java.awt.*;

public class DrawPanelTest {
    //creates a window to display the drawing
    public static void main(String[] args) {
        // create a new frame to hold the panel
        JFrame application = new JFrame();
        Container pane=application.getContentPane();
        // create a panel that contains our drawing
        DrawPanel panel = new DrawPanel();
        // set the frame to exit when it is closed
        application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        // add the panel to the frame
        pane.add(panel);
        application.setContentPane(pane);
        // set the size of …
Run Code Online (Sandbox Code Playgroud)

java colors draw background-color

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

如何将多个参数绑定到 MySQLi 准备好的语句

我要插入的参数数量不定,(2031) No data supplied for parameters in prepared statement在警告后出现错误Number of variables doesn't match number of parameters in prepared statement in SaveIntermediateData.php5 on line 49

$link = new mysqli( DB_HOST, DB_USER, DB_PASSWORD, DB_NAME );
if( ! $link ) {
    echo "<h1>new mysqli() failed!</h1>";
    exit( 0 );
}
$queryText =
    "CREATE TABLE IF NOT EXISTS visitors (".
        "id    VARCHAR( 512) CHARACTER SET ASCII NOT NULL,".
        "name  VARCHAR(  80) CHARACTER SET ASCII NOT NULL,".
        "value VARCHAR(4096) NOT NULL,".
        "PRIMARY …
Run Code Online (Sandbox Code Playgroud)

php mysqli

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

JavaFX SortedList:监听列表更改和列表项更新事件

使用案例:

  • 有序的ListView(或TableView)
  • 插入后显示
  • 在显示之后进行键的更新

启动时列表:

在启动时列出

添加18后:

加18后

更新后:

更新后

你可以看到没有任何变化!

代码:

public final class SortedListTest extends Application {

   @Override
   public void start( Stage stage ) throws Exception {
      final ObservableList<IntegerProperty> il =
         FXCollections.observableArrayList();
      il.add( new SimpleIntegerProperty( 12 ));
      il.add( new SimpleIntegerProperty( 24 ));
      il.add( new SimpleIntegerProperty( 36 ));
      final Button add    = new Button( "Add 18" );
      final Button update = new Button( "Update 24 to 8" );
      final HBox   ctrl   = new HBox( 4.0, add, update );
      final ListView<IntegerProperty> listVw = …
Run Code Online (Sandbox Code Playgroud)

java sorting javafx-8

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

CSS - 禁用双击Chrome中的自动选择

我现在正在学习HTML/CSS,所以我做了一点点cookie-clicker看起来很有趣:http://jsfiddle.net/Zerh/6kb87sp9/

我的问题是:如果我在任何按钮上点击太快(双击),它会突出显示一个选项.我使用以下CSS来隐藏突出显示:

::selection {
   background: transparent;
}
::-moz-selection {
   background: transparent;
}
Run Code Online (Sandbox Code Playgroud)

它似乎适用于Firefox/Edge,但我不能让它在Chrome上运行.

我发现了这个老话题:如何使用CSS禁用文本选择突出显示?,但它已经6岁了,似乎对我不起作用.

html5 css3

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

为什么文字不是白色的?

这是来源:

<!doctype html>
<html>
<head>
   <meta charset="UTF-8" />
   <title>White</title>
   <style>
body {
   background-color: black;
}
.quadrant-legend {
    position: absolute;
    left    :  28px;
    width   : 288px;
    height  :  62px;
}
.quadrant-legend-img {
    position: absolute;
    top     : 0;
    left    : 0;
    z-index : 3;
}
.quadrant-legend-btn {
    position: absolute;
    top     :  6px;
    right   : 34px;
    z-index : 3;
}
.quadrant-legend-text {
    margin-left: 16px;
    margin-top : 16px;
    font-family: arial, sans-serif;
    font-size  : 26px;
    color      : white;
    z-index    : 4;
}
#quadrant-legend-asset {
    top: …
Run Code Online (Sandbox Code Playgroud)

html5 css3

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

嵌套的花括号括起来的初始化列表

我的代码使用 GCC 生成语法错误:

src/main.cpp: In function ‘int main()’: src/main.cpp:95:4: error:
could not convert ‘{{"enum", E_PRINT}, {"string", "setup"}, {"object",
{{"double", 3.1415926535897931e+0}, {"long", 1235813l}}}}’ from
‘<brace-enclosed initializer list>’ to ‘Object’
};
Run Code Online (Sandbox Code Playgroud)
#include <cmath>
#include <initializer_list>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <vector>

#include <stdlib.h>

struct NamedValueBase {

   NamedValueBase( const std::string & name ) :
      name( name )
   {}

   virtual ~ NamedValueBase( void ) {}

   std::string name;
};

template<class T>
struct NamedValue : public NamedValueBase {

   NamedValue( const std::string & …
Run Code Online (Sandbox Code Playgroud)

c++ variadic c++11

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

java.util.Collections.reverse()如何工作?

请参阅java.util.Collections.reverse()的文档.

我不明白Java方法如何只能通过值传递,但是允许以下内容:

public static void reverse(List<?> list)
Run Code Online (Sandbox Code Playgroud)

它如何改变通过参数传递的原始对象?特别是当通过参数传递的所有对象都按值传递时?这不应该意味着只传递对象的副本,因此只能返回一个引用吗?由于我们返回无效,我们如何更改传递的原始对象?

  • 一个非常混乱的Java Padawan

java collections methods static

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