19 package com.basistech.df.cybertriage.autopsy.ctoptions.ctcloud;
21 import java.awt.BorderLayout;
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.nio.charset.StandardCharsets;
25 import javafx.application.Platform;
26 import javafx.concurrent.Worker.State;
27 import javafx.embed.swing.JFXPanel;
28 import javafx.scene.Scene;
29 import javafx.scene.layout.VBox;
30 import javafx.scene.paint.Color;
31 import javafx.scene.web.WebView;
32 import javax.swing.SwingUtilities;
33 import org.apache.commons.io.IOUtils;
49 public EULADialog(java.awt.Frame parent,
boolean modal)
throws IOException {
55 boolean isAcceptPressed() {
60 InputStream eulaInputStream =
EULADialog.class.getResourceAsStream(EULA_RESOURCE);
61 final String htmlString = IOUtils.toString(eulaInputStream, StandardCharsets.UTF_8);
62 final JFXPanel fxPanel =
new JFXPanel();
64 Platform.runLater(() -> {
65 WebView webView =
new WebView();
66 webView.setMaxSize(Short.MAX_VALUE, Short.MAX_VALUE);
67 webView.setPrefSize(Short.MAX_VALUE, Short.MAX_VALUE);
68 webView.setMinSize(100, 100);
69 webView.getEngine().getLoadWorker().stateProperty().addListener((ov, oldState, newState) -> {
70 if (newState == State.SUCCEEDED) {
71 SwingUtilities.invokeLater(() -> EULADialog.this.acceptButton.setEnabled(true));
74 webView.getEngine().loadContent(htmlString,
"text/html");
75 VBox root =
new VBox(webView);
76 Scene scene =
new Scene(root, Color.RED);
77 fxPanel.setScene(scene);
86 @SuppressWarnings(
"unchecked")
89 java.awt.GridBagConstraints gridBagConstraints;
92 javax.swing.JPanel paddingPanel =
new javax.swing.JPanel();
94 javax.swing.JButton cancelButton =
new javax.swing.JButton();
96 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
97 setTitle(
org.openide.util.NbBundle.getMessage(
EULADialog.class,
"EULADialog.title"));
98 setMaximumSize(
new java.awt.Dimension(32767, 32767));
99 setPreferredSize(
new java.awt.Dimension(550, 550));
100 setSize(
new java.awt.Dimension(550, 550));
101 getContentPane().setLayout(
new java.awt.GridBagLayout());
104 gridBagConstraints =
new java.awt.GridBagConstraints();
105 gridBagConstraints.gridx = 0;
106 gridBagConstraints.gridy = 0;
107 gridBagConstraints.gridwidth = 3;
108 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
109 gridBagConstraints.weightx = 1.0;
110 gridBagConstraints.weighty = 1.0;
111 gridBagConstraints.insets =
new java.awt.Insets(5, 5, 5, 5);
114 paddingPanel.setMaximumSize(
new java.awt.Dimension(32767, 0));
116 javax.swing.GroupLayout paddingPanelLayout =
new javax.swing.GroupLayout(paddingPanel);
117 paddingPanel.setLayout(paddingPanelLayout);
118 paddingPanelLayout.setHorizontalGroup(
119 paddingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
120 .addGap(0, 0, Short.MAX_VALUE)
122 paddingPanelLayout.setVerticalGroup(
123 paddingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
124 .addGap(0, 0, Short.MAX_VALUE)
127 gridBagConstraints =
new java.awt.GridBagConstraints();
128 gridBagConstraints.gridx = 0;
129 gridBagConstraints.gridy = 1;
130 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
131 gridBagConstraints.weightx = 1.0;
132 getContentPane().add(paddingPanel, gridBagConstraints);
134 org.openide.awt.Mnemonics.setLocalizedText(
acceptButton,
org.openide.util.NbBundle.getMessage(
EULADialog.class,
"EULADialog.acceptButton.text"));
136 acceptButton.addActionListener(
new java.awt.event.ActionListener() {
137 public void actionPerformed(java.awt.event.ActionEvent evt) {
141 gridBagConstraints =
new java.awt.GridBagConstraints();
142 gridBagConstraints.gridx = 2;
143 gridBagConstraints.gridy = 1;
144 gridBagConstraints.insets =
new java.awt.Insets(0, 0, 5, 5);
147 org.openide.awt.Mnemonics.setLocalizedText(cancelButton,
org.openide.util.NbBundle.getMessage(
EULADialog.class,
"EULADialog.cancelButton.text"));
148 cancelButton.addActionListener(
new java.awt.event.ActionListener() {
149 public void actionPerformed(java.awt.event.ActionEvent evt) {
153 gridBagConstraints =
new java.awt.GridBagConstraints();
154 gridBagConstraints.gridx = 1;
155 gridBagConstraints.gridy = 1;
156 gridBagConstraints.insets =
new java.awt.Insets(0, 5, 5, 5);
157 getContentPane().add(cancelButton, gridBagConstraints);
163 acceptPressed =
true;
void acceptButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JPanel viewablePanel
static final Logger LOGGER
void cancelButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JButton acceptButton
EULADialog(java.awt.Frame parent, boolean modal)
synchronized static Logger getLogger(String name)
static final String EULA_RESOURCE