Hallo zusammen!
Ich habe eine minimalistische Anwendung erstellt, mit der ich ein paar JavaFX 2 - Sachen testen wollte. Dabei enthält meine Szene eine HTMLEditor-Komponente. Diese Komponente reagiert nicht darauf, wenn ich zwecks Zeilenumbruch Enter drücke und ich kann mir nicht erklären, warum das so ist.
Vielleicht könnt Ihr das Verhalten ja reproduzieren. Hier ist mein Quellcode:
Vielleicht hat ja jemand eine Idee, was ich falsch mache - für Tipps bin ich dankbar
Beste Grüße,
David
Ich habe eine minimalistische Anwendung erstellt, mit der ich ein paar JavaFX 2 - Sachen testen wollte. Dabei enthält meine Szene eine HTMLEditor-Komponente. Diese Komponente reagiert nicht darauf, wenn ich zwecks Zeilenumbruch Enter drücke und ich kann mir nicht erklären, warum das so ist.
Vielleicht könnt Ihr das Verhalten ja reproduzieren. Hier ist mein Quellcode:
Java:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.ComponentEvent;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBuilder;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TabPaneBuilder;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.AnchorPaneBuilder;
import javafx.scene.layout.VBox;
import javafx.scene.layout.VBoxBuilder;
import javafx.scene.web.HTMLEditor;
import javafx.scene.web.HTMLEditorBuilder;
import javafx.scene.web.WebView;
import javax.swing.ImageIcon;
import javax.swing.SwingUtilities;
public class NotesMainWindow extends javax.swing.JFrame {
private JFXPanel fxPanel;
private VBox view;
private TabPane toolPane;
private HTMLEditor edit;
private Scene scene;
private int startup=0;
/**
* Creates new form NotesMainWindow
*/
public NotesMainWindow() {
initComponents();
fxPanel=new JFXPanel();
Platform.runLater(new Runnable() {
@Override
public void run() {
Group group = new Group();
scene = new Scene(group);
fxPanel.setScene(scene);
fxPanel.setBackground(new Color(255, 0, 255));
view = VBoxBuilder.create().build();
group.getChildren().add(view);
edit = HTMLEditorBuilder.create().build();
toolPane = TabPaneBuilder.create().minHeight(60d).build();
toolPane.getTabs().add(new Tab("Allgemein"));
view.getChildren().add(edit);
}
});
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
jPanel3.add(fxPanel);
}
});
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jToolBar1 = new javax.swing.JToolBar();
jButton1 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jSplitPane1 = new javax.swing.JSplitPane();
jPanel2 = new javax.swing.JPanel();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel4 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
setAlwaysOnTop(true);
setAutoRequestFocus(false);
setMinimumSize(new java.awt.Dimension(640, 480));
jToolBar1.setFloatable(false);
jToolBar1.setRollover(true);
jButton1.setFocusable(false);
jButton1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jToolBar1.add(jButton1);
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.LINE_AXIS));
jSplitPane1.setDividerLocation(200);
jSplitPane1.setDividerSize(7);
jSplitPane1.setDoubleBuffered(true);
jSplitPane1.setOneTouchExpandable(true);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 194, Short.MAX_VALUE)
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 160, Short.MAX_VALUE)
);
jTabbedPane1.addTab(null, jPanel4);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING)
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 158, Short.MAX_VALUE))
);
jSplitPane1.setLeftComponent(jPanel2);
jPanel3.setLayout(new javax.swing.BoxLayout(jPanel3, javax.swing.BoxLayout.Y_AXIS));
jSplitPane1.setRightComponent(jPanel3);
jPanel1.add(jSplitPane1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(6, 6, 6))
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 642, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
public static void main(String args[]) {
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NotesMainWindow().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JToolBar jToolBar1;
// End of variables declaration
}
Vielleicht hat ja jemand eine Idee, was ich falsch mache - für Tipps bin ich dankbar
Beste Grüße,
David