我正在尝试在我的应用程序中使用JavaFX
HTMLEditor
,但我似乎遇到了问题。我选择了表格中的所有单元格,并尝试使用left-align
按钮左对齐数据。我可以让它适用于单个单元格,但不能在CTRL-A
之后,然后在left-align
按钮之后。这是一个错误还是这种预期的行为。其他对齐按钮似乎在CTRL-A
之后工作。
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.web.HTMLEditor;
import javafx.stage.Stage;
/**
*
* @author blj0011
*/
public class HTMLEditorTest extends Application
{
@Override
public void start(Stage primaryStage)
{
String htmlString = "<!doctype html>\n"
+ "<html lang=\"en\">\n"
+ " <head>\n"
+ " <meta charset=\"utf-8\">\n"
+ "\n"
+ " <title>HTMLEditor Test</title>\n"
+ " <meta name=\"description\" content=\"HTMLEditor Test\">\n"
+ " <meta name=\"author\" content=\"SitePoint\">\n"
+ " </head>\n"
+ "\n"
+ " <body>\n"
+ " <table style=\"width:100%\">\n"
+ " <tr>\n"
+ " <th>Firstname</th>\n"
+ " <th>Lastname</th> \n"
+ " <th>Age</th>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td>Jill</td>\n"
+ " <td>Smith</td> \n"
+ " <td>50</td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td>Eve</td>\n"
+ " <td>Jackson</td> \n"
+ " <td>94</td>\n"
+ " </tr>\n"
+ " </table>\n"
+ " </body>\n"
+ "</html>";
HTMLEditor htmlEditor = new HTMLEditor();
htmlEditor.setHtmlText(htmlString);
StackPane root = new StackPane();
root.getChildren().add(htmlEditor);
Scene scene = new Scene(root, 500, 700);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
launch(args);
}
}