List of usage examples for javafx.scene.input MouseEvent getClickCount
public final int getClickCount()
From source file:com.github.technosf.posterer.controllers.impl.RequestController.java
/** * {@inheritDoc}/*from w w w. j a va 2 s . c o m*/ * * @see com.github.technosf.posterer.controllers.Controller#initialize() */ @Override public void initialize() { logger.debug("Initialization starts"); statusController = StatusController.loadController(statusWindow.textProperty()); certificateFileChooser.setRoot(getRoot()); certificateFileChooser.getChosenFileProperty().addListener(new ChangeListener<File>() { @Override public void changed(ObservableValue<? extends File> arg0, File oldValue, File newValue) { setCertificateFile(newValue); } }); propertiesTable.addEventFilter(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getClickCount() > 1 && event.getButton().ordinal() == 1) { loadRequest(propertiesTable.getSelectionModel().getSelectedItem()); } } }); propertiesTable.setItems(properties); endpointColumn.setCellValueFactory(new PropertyValueFactory<RequestData, String>("endpoint")); payloadColumn.setCellValueFactory(new PropertyValueFactory<RequestData, String>("payload")); methodColumn.setCellValueFactory(new PropertyValueFactory<RequestData, String>("method")); contentTypeColumn.setCellValueFactory(new PropertyValueFactory<RequestData, String>("contentType")); base64Column.setCellValueFactory(new PropertyValueFactory<RequestData, Boolean>("base64")); httpUserColumn.setCellValueFactory(new PropertyValueFactory<RequestData, String>("httpUser")); httpPasswordColumn.setCellValueFactory(new PropertyValueFactory<RequestData, String>("httpPassword")); processProperties(); /* * Bindings */ timeoutText.textProperty().bind(timeout.asString("%d")); timeout.bind(timeoutSlider.valueProperty()); useProxy.bindBidirectional(proxyToggle1.selectedProperty()); useProxy.bindBidirectional(proxyToggle2.selectedProperty()); useProxy.bindBidirectional(proxyToggle3.selectedProperty()); useProxy.bindBidirectional(proxyToggle4.selectedProperty()); useProxy.bindBidirectional(proxyToggle5.selectedProperty()); proxyToggle1.textProperty().bind(useProxyText); proxyToggle2.textProperty().bind(useProxyText); proxyToggle3.textProperty().bind(useProxyText); proxyToggle4.textProperty().bind(useProxyText); proxyToggle5.textProperty().bind(useProxyText); proxyportlabel.textFillProperty().bind(proxyhostlabel.textFillProperty()); proxyuserlabel.textFillProperty().bind(proxyhostlabel.textFillProperty()); proxypasswordlabel.textFillProperty().bind(proxyhostlabel.textFillProperty()); proxyhost.disableProperty().bind(useProxy.not()); proxyport.disableProperty().bind(useProxy.not()); proxyuser.disableProperty().bind(useProxy.not()); proxypassword.disableProperty().bind(useProxy.not()); /* * Preferences */ proxyhost.textProperty().set(requestModel.getProxyHost()); proxyport.textProperty().set(requestModel.getProxyPort()); proxyuser.textProperty().set(requestModel.getProxyUser()); proxypassword.textProperty().set(requestModel.getProxyPass()); try { homedir.textProperty().set(propertiesModel.getPropertiesDir()); } catch (IOException e) { store.setDisable(true); statusController.setStatus(INFO_PROPERTIES, e.getMessage()); } logger.debug("Initialization complete"); }
From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java
@FXML void onTableClicked(MouseEvent event) { if (event.getClickCount() != 2) return;// w ww . jav a 2 s . c om TableView tableView = ((TableView) event.getSource()); TableView.TableViewFocusModel focusModel = (TableView.TableViewFocusModel) tableView.focusModelProperty() .getValue(); TablePosition position = focusModel.getFocusedCell(); if (position.getTableColumn() == null) return; ObservableValue value = position.getTableColumn().getCellObservableValue(position.getRow()); String valueStr = value.getValue().toString(); Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setHeaderText(String.format("Value at ID:%d %s", ((LIMSData) tableView.getItems().get(position.getRow())).getId(), position.getTableColumn().getText())); if (valueStr.length() > 300) alert.setContentText(valueStr.substring(0, 300) + "..."); else alert.setContentText(valueStr); TextArea textArea = new TextArea(valueStr); textArea.setEditable(false); alert.getDialogPane().setExpandableContent(textArea); event.consume(); alert.show(); }
From source file:org.yccheok.jstock.gui.news.StockNewsJFrame.java
private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setAlwaysOnTop(true);/*from w w w . ja va 2 s. c om*/ setAutoRequestFocus(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosed(java.awt.event.WindowEvent evt) { } public void windowClosing(java.awt.event.WindowEvent evt) { NewsTask task = StockNewsJFrame.this.newsTask; if (task != null) { task.cancel(true); } } public void windowDeiconified(java.awt.event.WindowEvent evt) { } public void windowIconified(java.awt.event.WindowEvent evt) { } }); Platform.runLater(new Runnable() { @Override public void run() { // JFXPanel => Scene => SplitPane: // Left (news List) => StackPane => ListView / ProgressIndicator // Right (HTML content) => TabPane => Tab => StackPane => WebView / ProgressBar splitPane = new SplitPane(); scene = new Scene(splitPane); scene.getStylesheets() .add(StockNewsJFrame.class.getResource("StockNewsJFrame.css").toExternalForm()); jfxPanel.setScene(scene); // Left component: News List messages_o = FXCollections.observableArrayList(); newsListView = new ListView<>(messages_o); newsListView.setId("news-listview"); stackPane.setId("parent-stackPane"); stackPane.getChildren().addAll(newsListView, progressIn); splitPane.getItems().add(stackPane); SplitPane.setResizableWithParent(stackPane, Boolean.FALSE); // show progress indicator when loading progressIn.setMaxWidth(100); progressIn.setMaxHeight(100); progressIn.setVisible(true); newsListView.setVisible(true); newsListView.setCellFactory(new Callback<ListView<FeedItem>, ListCell<FeedItem>>() { @Override public ListCell<FeedItem> call(ListView<FeedItem> list) { return new DisplayNewsCard(); } }); // register event listener: add tab for news HTML content newsListView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getClickCount() >= 1) { final FeedItem msg = newsListView.getSelectionModel().getSelectedItem(); if (msg == null) { return; } final URL link = msg.getLink(); if (link == null || link.getHost() == null) { return; } if (stockNewsContent == null) { stackPane.setPrefWidth(stackPane.getWidth()); stackPane.setMaxWidth(stackPane.getWidth()); stackPane.setMinWidth(stackPane.getWidth() / 5); try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { // resize JFrame first StockNewsJFrame.this.setSize(fullSize.width, fullSize.height); java.awt.Insets in = StockNewsJFrame.this.getInsets(); jfxPanel.setSize(StockNewsJFrame.this.getWidth() - in.left - in.right, jfxPanel.getHeight()); java.awt.Insets in2 = jfxPanel.getInsets(); // calculate width & height, but not resize in AWT event dispatching thread // javafx.scene.control.SplitPane should only be accessed from JavaFX Application Thread splitPaneWidth = jfxPanel.getWidth() - in2.left - in2.right; splitPaneHeight = jfxPanel.getHeight() - in2.top - in2.bottom; } }); } catch (InterruptedException | InvocationTargetException ex) { log.error(null, ex); } // resize to full screen size of jfxPanel splitPane.resize(splitPaneWidth, splitPaneHeight); stockNewsContent = new StockNewsContent(); splitPane.getItems().add(stockNewsContent.tabPane); splitPane.setDividerPositions(0.5f); stockNewsContent.tabPane.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<Tab>() { @Override public void changed(ObservableValue<? extends Tab> observable, Tab oldTab, Tab newTab) { int i = stockNewsContent.tabPane.getSelectionModel() .getSelectedIndex(); if (i < 0) { return; } jFrameTitle = stockNewsContent.tabsInfo.get(i).second; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { StockNewsJFrame.this.setTitle(jFrameTitle); } }); } }); } stockNewsContent.addNewsTab(link, StringEscapeUtils.unescapeHtml(msg.getTitle())); } } }); retrieveNewsInBackground(); } }); this.add(jfxPanel, BorderLayout.CENTER); this.setVisible(true); }
From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java
@FXML protected void tblContexts_OnMouseClicked(MouseEvent mouseEvent) throws Exception { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { if (editor != null && arguments != null) { Context context = tblContexts.getSelectionModel().getSelectedItem(); if (context != null) { String argumentString = arguments; argumentString = argumentString.replace("%file", context.getFileName()); argumentString = argumentString.replace("%line", "" + context.getLineNumber()); argumentString = argumentString.replace("%column", "" + context.getColumnNumber()); String command = "\"" + editor + "\"" + argumentString; LOG.debug(command);/*w ww. j ava2 s .co m*/ Runtime.getRuntime().exec(command); } } } } }
From source file:poe.trade.assist.SearchPane.java
private void setupTableClickListener() { searchTable.addEventFilter(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() { @Override//from ww w.j a va 2s . c om public void handle(MouseEvent event) { if (event.getButton() == MouseButton.SECONDARY) { Search search = searchTable.getSelectionModel().getSelectedItem(); if (search != null) { search.markSeen(); } } } }); searchTable.addEventFilter(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getClickCount() > 1 && event.getButton() == MouseButton.PRIMARY) { Search search = searchTable.getSelectionModel().getSelectedItem(); if (search != null) { SwingUtil.openUrlViaBrowser(search.getUrl()); } } } }); }
From source file:com.exalttech.trex.ui.views.PacketTableView.java
/** * Handle table row click event/* www . ja va 2 s. c o m*/ * * @param event */ public void handleTableRowClick(MouseEvent event) { streamPacketTableView.setContextMenu(null); if (event.getClickCount() == 2 && streamPacketTableView.getSelectionModel().getSelectedItem() != null) { openStreamDialog(StreamBuilderType.EDIT_STREAM); } else if (event.getButton() == MouseButton.SECONDARY && streamPacketTableView.getSelectionModel().getSelectedItem() != null) { streamPacketTableView.setContextMenu(rightClickMenu); } }
From source file:Main.java
public static java.awt.event.MouseEvent toAwt(final MouseEvent event) { final EventType type = event.getEventType(); if (null == type) { return null; }//ww w .j a v a 2 s . c om final int id; if (MouseEvent.MOUSE_MOVED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_MOVED; } else if (MouseEvent.MOUSE_DRAGGED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_DRAGGED; } else if (MouseEvent.MOUSE_CLICKED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_CLICKED; } else if (MouseEvent.MOUSE_PRESSED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_PRESSED; } else if (MouseEvent.MOUSE_RELEASED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_RELEASED; } else if (MouseEvent.MOUSE_ENTERED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_ENTERED; } else if (MouseEvent.MOUSE_EXITED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_EXITED; } else { return null; } final int button; if (event.isPrimaryButtonDown()) { button = java.awt.event.MouseEvent.BUTTON1; } else if (event.isMiddleButtonDown()) { button = java.awt.event.MouseEvent.BUTTON2; } else if (event.isSecondaryButtonDown()) { button = java.awt.event.MouseEvent.BUTTON3; } else { button = java.awt.event.MouseEvent.NOBUTTON; } final long when = -1; final int modifiers = modifiers(event); final int x = (int) event.getX(); final int y = (int) event.getY(); final int xAbs = Integer.MAX_VALUE; final int yAbs = Integer.MAX_VALUE; final int count = event.getClickCount(); boolean popup = event.isPopupTrigger(); if (MouseEvent.MOUSE_CLICKED.equals(type) && event.isMetaDown()) { // mack books use meta flag for right-clicks popup = true; } return new java.awt.event.MouseEvent(empty, id, when, modifiers, x, y, xAbs, yAbs, count, popup, button); }
From source file:com.chart.SwingChart.java
/** * Add axis//from www .j a v a2s . c o m * @param name new axis name */ @Override public final void addAxis(String name) { boolean encontrado = false; for (AxisChart categoria : axes) { if (categoria.getName().equals(name)) { encontrado = true; break; } } if (!encontrado) { axes.add(new AxisChart((name))); } XYSeriesCollection dataset = new XYSeriesCollection(); NumberAxis ejeOrdenada = new NumberAxis(name); ejeOrdenada.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); ejeOrdenada.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); ejeOrdenada.setLabelFont(ejeOrdenada.getLabelFont().deriveFont(fontSize)); ejeOrdenada.setTickLabelFont(ejeOrdenada.getLabelFont().deriveFont(fontSize)); int i = datasetList.size(); datasetList.add(dataset); AxesList.add(ejeOrdenada); plot.setDataset(i, dataset); plot.setRangeAxis(i, ejeOrdenada); plot.setRangeAxisLocation(i, AxisLocation.BOTTOM_OR_LEFT); plot.mapDatasetToRangeAxis(i, i); XYItemRenderer renderer = new XYLineAndShapeRenderer(true, true); if (i == 0) { plot.setRenderer(renderer); } else { plot.setRenderer(i, renderer); } final LegendAxis le; final int indiceLeyenda = legendFrame.getChildren().size(); legendFrame.getChildren().add(le = new LegendAxis(name)); le.setOnMouseClicked((MouseEvent t) -> { if (le.selected && t.getClickCount() == 2) { setOrdinateRange(AxesList.get(indiceLeyenda)); } }); le.setOnMouseEntered((MouseEvent t) -> { le.setStyle("-fx-background-color:blue"); le.selected = true; AxesList.get(indiceLeyenda).setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web("blue"))); AxesList.get(indiceLeyenda).setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web("blue"))); }); le.setOnMouseExited((MouseEvent t) -> { le.setStyle("-fx-background-color:" + strBackgroundColor); le.selected = false; AxesList.get(indiceLeyenda).setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); AxesList.get(indiceLeyenda) .setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); }); }
From source file:com.chart.SwingChart.java
/** * //from w w w. j a va2 s .com * @param axis Axis name to wich the new series belongs * @param cs Series Coinfiguration */ @Override public final void addSeries(String axis, SimpleSeriesConfiguration cs) { for (int i = 0; i < axes.size(); i++) { if (axes.get(i).getName().equals(axis)) { String strColor; javafx.scene.paint.Color color; int indice = seriesList.size(); if (cs.getColor() == null) { color = getColor(indice); } else { color = cs.getColor(); } strColor = color.toString(); XYSeriesCollection dataset = datasetList.get(i); Series series = new Series(cs.getName(), "color: " + strColor + ";width: " + String.valueOf(cs.getLineWidth()) + ";shape: " + cs.getShapeName() + ";", i, dataset.getSeriesCount()); dataset.addSeries(series); XYItemRenderer renderer = plot.getRenderer(i); renderer.setSeriesPaint(dataset.getSeriesCount() - 1, scene2awtColor(color)); SeriesShape simb = new SeriesShape(cs.getShapeName(), javafx.scene.paint.Color.web(strColor.replace("#", "0x"))); if (cs.getLineWidth() > 0) { ((XYLineAndShapeRenderer) renderer).setSeriesLinesVisible(dataset.getSeriesCount() - 1, true); renderer.setSeriesStroke(dataset.getSeriesCount() - 1, new BasicStroke(cs.getLineWidth())); } else { ((XYLineAndShapeRenderer) renderer).setSeriesLinesVisible(dataset.getSeriesCount() - 1, false); } if (cs.getShapeName().equals("null")) { renderer.setSeriesShape(dataset.getSeriesCount() - 1, null); ((XYLineAndShapeRenderer) renderer).setSeriesShapesVisible(dataset.getSeriesCount() - 1, false); } else { renderer.setSeriesShape(dataset.getSeriesCount() - 1, simb.getShapeAWT()); ((XYLineAndShapeRenderer) renderer).setSeriesShapesVisible(dataset.getSeriesCount() - 1, true); if (cs.getShapeName().contains("empty")) { ((XYLineAndShapeRenderer) renderer).setSeriesShapesFilled(dataset.getSeriesCount() - 1, false); } else { ((XYLineAndShapeRenderer) renderer).setSeriesShapesFilled(dataset.getSeriesCount() - 1, true); } } if (i == 0) { plot.setRenderer(renderer); } else { plot.setRenderer(i, renderer); } seriesList.add(series); final LegendAxis le = getLegendAxis(axis); final Label label = new Label(cs.toString()); Platform.runLater(() -> { label.setStyle("fondo: " + strChartBackgroundColor + ";-fx-background-color: fondo;-fx-text-fill: ladder(fondo, white 49%, black 50%);-fx-padding:5px;-fx-background-radius: 5;-fx-font-size: " + String.valueOf(fontSize) + "px"); }); label.setOnMouseClicked((MouseEvent t) -> { if (t.getClickCount() == 2) { for (int i1 = 0; i1 < seriesList.size(); i1++) { if (seriesList.get(i1).getKey().toString().equals(label.getText())) { editSeries(seriesList.get(i1)); break; } } } }); label.setOnMouseExited((MouseEvent t) -> { label.setStyle( label.getStyle().replace("-fx-background-color: blue", "-fx-background-color: fondo")); }); label.setOnMouseEntered((MouseEvent t) -> { label.setStyle( label.getStyle().replace("-fx-background-color: fondo", "-fx-background-color: blue")); for (Node le1 : legendFrame.getChildren()) { if (le1 instanceof LegendAxis) { le1.setStyle("-fx-background-color:" + strBackgroundColor); ((LegendAxis) le1).selected = false; } } }); label.setStyle("fondo: " + strChartBackgroundColor + ";-fx-text-fill: white;-fx-background-color: fondo;-fx-padding:5px;-fx-background-radius: 5;-fx-font-size: " + String.valueOf(fontSize) + "px"); le.getChildren().add(label); label.setGraphic(simb.getShapeGraphic()); break; } } }
From source file:open.dolphin.client.MainWindowController.java
/** * Initializes the controller class.//w ww . j a va2s. com * * @param url * @param rb */ @Override public void initialize(URL url, ResourceBundle rb) { //- Init TableView ReceptView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); PatientSearchView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); PatientFutureView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); LabRecieverView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); // mainTab.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { // @Override // public void changed(ObservableValue<? extends Number> ov, Number oldValue, Number newValue) { // SingleSelectionModel<Tab> selectionModel = mainTab.getSelectionModel(); // if(mainTab.getTabs() != null){ // if(selectionModel.isSelected(0)){ // karteTabPane.getTabs().clear(); // } // } // } // }); // ????? TableColumn colId = new TableColumn("ID"); recept.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("recept")); visitTime.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("visitTime")); tableCellAlignRight(visitTime); clientId.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("clientId")); name.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("name")); sex.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("sex")); tableCellAlignCenter(sex); insurance.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("insurance")); birthDay.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("birthDay")); physicianInCharge.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("physicianInCharge")); clinicalDepartments .setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("clinicalDepartments")); reservation.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("reservation")); memo.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("memo")); status.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("status")); tableCellImageAlignCenter(status); // ???? ReceptView.getItems().setAll(fetchDataFromServer()); // ???(?) ReceptView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { System.out.println("Double clicked"); ReceptInfo selectedUser = ((TableView<ReceptInfo>) mouseEvent.getSource()) .getSelectionModel().getSelectedItem(); // ?????????? for (ReceptInfo info : receptList) { if (info.getName().equals(selectedUser.getName())) { return; } } System.out.println(selectedUser.getClientId()); receptList.add(selectedUser); // ?? final ContextMenu contextMenu = new ContextMenu(); MenuItem item1 = new MenuItem("?"); item1.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Reserve Karte?"); // ?? // e.getSource(); } }); MenuItem item2 = new MenuItem("???"); item2.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Close Tab and Preservation???"); karteTabPane.getTabs().remove(karteTabPane.getSelectionModel().getSelectedItem()); // ?? // e.getSource(); } }); MenuItem item3 = new MenuItem("?"); item3.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Close Tab?"); karteTabPane.getTabs().remove(karteTabPane.getSelectionModel().getSelectedItem()); // ?? // e.getSource(); } }); contextMenu.getItems().addAll(item1, item2, item3); Tab tab = new Tab(selectedUser.getName()); tab.setOnClosed(new EventHandler<Event>() { @Override public void handle(Event t) { Tab tab = (Tab) t.getSource(); for (int i = 0; i < receptList.size(); i++) { if (tab.getText().equals(receptList.get(i).getName())) { receptList.remove(i); } } System.out.println("Closed!"); } }); tab.setContextMenu(contextMenu); // Right-click mouse button menu try { // Loading content on demand Parent root = (Parent) new FXMLLoader() .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream()); tab.setContent(root); karteTabPane.getSelectionModel().select(tab); karteTabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS); karteTabPane.getTabs().add(tab); karteTabPane.setPrefSize(kartePane.getPrefWidth(), kartePane.getPrefHeight()); kartePane.getChildren().retainAll(); kartePane.getChildren().add(karteTabPane); } catch (IOException ex) { Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex); } } } } }); // ???? clientId1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("clientId1")); name1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("name1")); kana1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("kana1")); sex1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("sex1")); birthDay1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("birthDay1")); receiveDay1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("receiveDay1")); status1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("status1")); // dummy? PatientSearchView.getItems().setAll(fetchDataFromPatientInfo()); // ??(?) PatientSearchView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { System.out.println("Double clicked"); PatientSearchInfo selectedUser = ((TableView<PatientSearchInfo>) mouseEvent.getSource()) .getSelectionModel().getSelectedItem(); // ?????????? for (PatientSearchInfo info : patientSearchList) { if (info.getName1().equals(selectedUser.getName1())) { return; } } System.out.println(selectedUser.getKana1()); patientSearchList.add(selectedUser); // ?? final ContextMenu contextMenu = new ContextMenu(); MenuItem item1 = new MenuItem("?"); item1.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Reserve Karte?"); // ?? // e.getSource(); } }); MenuItem item2 = new MenuItem("???"); item2.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Close Tab and Preservation???"); karteTabPane1.getTabs().remove(karteTabPane1.getSelectionModel().getSelectedItem()); // ?? // e.getSource(); } }); MenuItem item3 = new MenuItem("?"); item3.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Close Tab?"); karteTabPane1.getTabs().remove(karteTabPane1.getSelectionModel().getSelectedItem()); // ?? // e.getSource(); } }); contextMenu.getItems().addAll(item1, item2, item3); Tab tab = new Tab(selectedUser.getName1()); tab.setOnClosed(new EventHandler<Event>() { @Override public void handle(Event t) { Tab tab = (Tab) t.getSource(); for (int i = 0; i < patientSearchList.size(); i++) { if (tab.getText().equals(patientSearchList.get(i).getName1())) { patientSearchList.remove(i); } } System.out.println("Closed!"); } }); tab.setContextMenu(contextMenu); // Right-click mouse button menu try { // Loading content on demand Parent root = (Parent) new FXMLLoader() .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream()); tab.setContent(root); karteTabPane1.getSelectionModel().select(tab); karteTabPane1.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS); karteTabPane1.getTabs().add(tab); karteTabPane1.setPrefSize(kartePane1.getPrefWidth(), kartePane1.getPrefHeight()); kartePane1.getChildren().retainAll(); kartePane1.getChildren().add(karteTabPane1); } catch (IOException ex) { Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex); } } } } }); // ???? clientId2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("clientId2")); name2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("name2")); kana2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("kana2")); insurance2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("insurance2")); sex2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("sex2")); birthDay2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("birthDay2")); physicianInCharge2 .setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("physicianInCharge2")); clinicalDepartments2 .setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("clinicalDepartments2")); karte2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("karte2")); // dummy? PatientFutureView.getItems().setAll(fetchDataFromPatientFutureInfo()); // ??(?) PatientFutureView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { System.out.println("Double clicked"); PatientFutureInfo selectedUser = ((TableView<PatientFutureInfo>) mouseEvent.getSource()) .getSelectionModel().getSelectedItem(); System.out.println(selectedUser.getName2()); // ?? final ContextMenu contextMenu = new ContextMenu(); MenuItem item1 = new MenuItem("?"); item1.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Reserve Karte?"); // ?? // e.getSource(); } }); MenuItem item2 = new MenuItem("???"); item2.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Close Tab and Preservation???"); karteTabPane2.getTabs().remove(karteTabPane2.getSelectionModel().getSelectedItem()); // ?? // e.getSource(); } }); MenuItem item3 = new MenuItem("?"); item3.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Close Tab?"); karteTabPane2.getTabs().remove(karteTabPane2.getSelectionModel().getSelectedItem()); // ?? // e.getSource(); } }); contextMenu.getItems().addAll(item1, item2, item3); Tab tab = new Tab(selectedUser.getName2()); tab.setContextMenu(contextMenu); // Right-click mouse button menu try { // Loading content on demand Parent root = (Parent) new FXMLLoader() .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream()); tab.setContent(root); karteTabPane2.getSelectionModel().select(tab); karteTabPane2.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS); karteTabPane2.getTabs().add(tab); karteTabPane2.setPrefSize(kartePane2.getPrefWidth(), kartePane2.getPrefHeight()); kartePane2.getChildren().retainAll(); kartePane2.getChildren().add(karteTabPane2); } catch (IOException ex) { Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex); } } } } }); // ????? lab3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("lab3")); clientId3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("clientId3")); kana3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("kana3")); karteKana3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("karteKana3")); sex3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("sex3")); karteSex3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("karteSex3")); sampleGetDay3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("sampleGetDay3")); register3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("register3")); status3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("status3")); // dummy? LabRecieverView.getItems().setAll(fetchDataFromLabRecieverInfo()); // ???(?) LabRecieverView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { System.out.println("Double clicked"); LabReceiverInfo selectedUser = ((TableView<LabReceiverInfo>) mouseEvent.getSource()) .getSelectionModel().getSelectedItem(); System.out.println(selectedUser.getKana3()); // ?? final ContextMenu contextMenu = new ContextMenu(); MenuItem item1 = new MenuItem("?"); item1.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Reserve Karte?"); // ?? // e.getSource(); } }); MenuItem item2 = new MenuItem("???"); item2.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Close Tab and Preservation???"); karteTabPane3.getTabs().remove(karteTabPane3.getSelectionModel().getSelectedItem()); // ?? // e.getSource(); } }); MenuItem item3 = new MenuItem("?"); item3.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { System.out.println("Close Tab?"); karteTabPane3.getTabs().remove(karteTabPane3.getSelectionModel().getSelectedItem()); // ?? // e.getSource(); } }); contextMenu.getItems().addAll(item1, item2, item3); Tab tab = new Tab(selectedUser.getKana3()); tab.setContextMenu(contextMenu); // Right-click mouse button menu try { // Loading content on demand Parent root = (Parent) new FXMLLoader() .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream()); tab.setContent(root); karteTabPane3.getSelectionModel().select(tab); karteTabPane3.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS); karteTabPane3.getTabs().add(tab); karteTabPane3.setPrefSize(kartePane3.getPrefWidth(), kartePane3.getPrefHeight()); kartePane3.getChildren().retainAll(); kartePane3.getChildren().add(karteTabPane3); } catch (IOException ex) { Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex); } } } } }); // ??5?????? Timer exeTimer = new Timer(); Calendar cal = Calendar.getInstance(); final int sec = cal.get(Calendar.SECOND); int delay = (60 - sec) * 1000; int interval = 5 * 1000; TimerTask task = new TimerTask() { @Override public void run() { if (!stopFlag) { System.out.println("this is called every 5 seconds on UI thread"); receptUpdate(); } else { this.cancel(); } } }; exeTimer.schedule(task, delay, interval); }