本文整理匯總了Java中javafx.scene.input.MouseEvent.getClickCount方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseEvent.getClickCount方法的具體用法?Java MouseEvent.getClickCount怎麽用?Java MouseEvent.getClickCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.input.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.getClickCount方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: clickItem
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
public void clickItem(MouseEvent event) throws IOException
{
if (event.getClickCount() == 2) {
stage = (Stage) label.getScene().getWindow();
FXMLLoader loader = new FXMLLoader(getClass().getResource("/callib/Views/BorrowedDetails.fxml"));
Stage modal = new Stage();
modal.initModality(Modality.APPLICATION_MODAL);
modal.setScene(
new Scene((Pane) loader.load())
);
modal.setX(stage.getX() + 50);
modal.setY(stage.getY() + 50);
BorrowedDetailsController controller = (BorrowedDetailsController) loader.getController();
controller.initData(table.getSelectionModel().getSelectedItem().getId());
modal.showAndWait();
this.displayData();
}
}
示例2: clickItem
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
private void clickItem(MouseEvent event) throws IOException {
if (event.getClickCount() == 2) {
stage = (Stage) label.getScene().getWindow();
FXMLLoader loader = new FXMLLoader(getClass().getResource("/callib/Views/SearchDetails.fxml"));
Stage modal = new Stage();
modal.initModality(Modality.APPLICATION_MODAL);
modal.setScene(
new Scene((Pane) loader.load())
);
modal.setX(stage.getX() + 50);
modal.setY(stage.getY() + 50);
SearchDetailsController controller = (SearchDetailsController) loader.getController();
controller.initData(table.getSelectionModel().getSelectedItem().getId());
modal.showAndWait();
this.displayData();
}
}
示例3: handleMouseClicked
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
private void handleMouseClicked(MouseEvent mouseEvent) {
if(mouseEvent.getClickCount() == 1){
try{
TreeItem<String> item = treeview.getSelectionModel().getSelectedItem();
Fx1.CurrDirName = item.getValue();
System.out.println("Selected Text : " + item.getValue());
Fx1.CurrDirFile = new File(Fx1.FindAbsolutePath(item,item.getValue()));
Fx1.CurrDirStr = Fx1.CurrDirFile.getAbsolutePath();
label.setText(Fx1.CurrDirStr);
Fx2.tableview.getItems().clear();
Fx2.CreateTableView();
Fx3.CreateTiles();
/**tableview.getItems().clear();
CreateTableView();
/**call some other function to activate createtableview() in corres controller */
}catch(Exception x){
System.out.println(x.getMessage());
}
}
//Fx2.tableview.getItems().clear();
//Fx2.CreateTableView();
}
示例4: tbvDepartamentos_onMouseClicked
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
void tbvDepartamentos_onMouseClicked(MouseEvent event) {
DepartamentoEntity ent = (DepartamentoEntity) tbvDepartamentos.getSelectionModel().getSelectedItem();
if (ent != null) {
txtNovoNomeDep.setText(ent.getNome());
txtNovaSiglaDep.setText(ent.getSigla());
chbChefeDep.getSelectionModel().select(ent.getChefe());
txtObs.setText(ent.getObservacao());
btnAlterar.setDisable(false);
btnExcluir.setDisable(false);
}
if (event.getClickCount() > 1) {
tbpDepartamento.getSelectionModel().select(tabGerenciarDepartamento);
txtNovaSiglaDep.setDisable(true);
txtNovoNomeDep.setDisable(true);
chbChefeDep.setDisable(true);
txtObs.setDisable(true);
btnNovoChefeDep.setDisable(true);
btnConfirmar.setDisable(true);
}
}
示例5: onTreeClick
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private void onTreeClick(MouseEvent event)
{
if (event.getClickCount() == 2)
{
if (onFileDoubleClicked != null)
{
Pair<Project, ASMFile> selection = getActiveSelection();
if (selection == null)
return;
ASMFile selectedFile = selection.getValue();
if (selectedFile != null)
onFileDoubleClicked.accept(selectedFile);
}
}
}
示例6: createEntry
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private void createEntry(MouseEvent evt) {
if (evt.getButton().equals(MouseButton.PRIMARY) && evt.getClickCount() == 2) {
LoggingDomain.VIEW.fine("create entry mouse event received inside control: " + dateControl.getClass().getSimpleName());
ZonedDateTime time = ZonedDateTime.now();
if (dateControl instanceof ZonedDateTimeProvider) {
ZonedDateTimeProvider provider = (ZonedDateTimeProvider) dateControl;
time = provider.getZonedDateTimeAt(evt.getX(), evt.getY());
}
Optional<Calendar> calendar = dateControl.getCalendarAt(evt.getX(), evt.getY());
if (time != null) {
dateControl.createEntryAt(time, calendar.orElse(null));
}
}
}
示例7: performSelection
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private void performSelection(MouseEvent evt) {
if ((evt.getButton().equals(PRIMARY) || evt.isPopupTrigger()) && evt.getClickCount() == 1) {
Entry<?> entry;
EntryViewBase<?> view = null;
if (evt.getTarget() instanceof EntryViewBase) {
view = (EntryViewBase<?>) evt.getTarget();
}
if (view == null) {
return;
}
String disableFocusHandlingKey = "disable-focus-handling"; //$NON-NLS-1$
view.getProperties().put(disableFocusHandlingKey, true);
view.requestFocus();
entry = view.getEntry();
if (entry != null) {
if (!isMultiSelect(evt) && !getSelections().contains(entry)) {
clearSelection();
}
if (isMultiSelect(evt) && getSelections().contains(entry)) {
getSelections().remove(entry);
} else if (!getSelections().contains(entry)) {
getSelections().add(entry);
}
}
view.getProperties().remove(disableFocusHandlingKey);
}
}
示例8: recordClick2
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@Override public void recordClick2(final RFXComponent r, MouseEvent e, boolean withCellInfo) {
final JSONObject event = new JSONObject();
event.put("type", "click");
int button = e.getButton() == MouseButton.PRIMARY ? java.awt.event.MouseEvent.BUTTON1 : java.awt.event.MouseEvent.BUTTON3;
event.put("button", button);
event.put("clickCount", e.getClickCount());
event.put("modifiersEx", buildModifiersText(e));
double x = e.getX();
double y = e.getY();
Node source = (Node) e.getSource();
Node target = r.getComponent();
Point2D sts = source.localToScreen(new Point2D(0, 0));
Point2D tts = target.localToScreen(new Point2D(0, 0));
x = e.getX() - tts.getX() + sts.getX();
y = e.getY() - tts.getY() + sts.getY();
event.put("x", x);
event.put("y", y);
if (withCellInfo) {
event.put("cellinfo", r.getCellInfo());
}
final JSONObject o = new JSONObject();
o.put("event", event);
fill(r, o);
if (e.getClickCount() == 1) {
clickTimer = new Timer();
clickTimer.schedule(new TimerTask() {
@Override public void run() {
sendRecordMessage(o);
}
}, timerinterval.intValue());
} else if (e.getClickCount() == 2) {
if (clickTimer != null) {
clickTimer.cancel();
clickTimer = null;
}
sendRecordMessage(o);
}
}
示例9: tblClientes_mouseClicked
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
void tblClientes_mouseClicked(MouseEvent event) {
ClienteEntity ent = tblClientes.getSelectionModel().getSelectedItem();
if (ent != null) {
txtNome.setText(ent.getNome());
txtEmail.setText(ent.getEmail());
txtTelefone.setText(ent.getTelefone());
habilitarEdicao(false);
}
if (event.getClickCount() > 2)
tbpCliente.getSelectionModel().select(tabEdicao);
}
示例10: mousePressed
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
protected void mousePressed(MouseEvent me) {
if (me.isPrimaryButtonDown() && me.getClickCount() == 1 && !me.isAltDown() && !me.isMetaDown() && !me.isControlDown()) {
mouseButton1Pressed(me);
} else {
recorder.recordClick2(this, me, true);
}
}
示例11: handleMouseClick
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
/**
* Handles mouse click actions for the scene
*
* @param e
*/
private void handleMouseClick (MouseEvent e) {
if (e.getButton() == MouseButton.PRIMARY && e.getClickCount() == DOUBLE_CLICK) {
myController.uploadNewBackground();
myRenderer.updateNewTiles();
updateBitMap();
render();
}
}
示例12: playOnDoubleClick
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private void playOnDoubleClick (MouseEvent mouseEvent, IGame game) {
if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
if (mouseEvent.getClickCount() == 2) {
new GamePlayer(game);
}
}
}
示例13: handleDoubleClick
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
private void handleDoubleClick(MouseEvent e) {
if (e.getClickCount() == 2) {
SelectionModel selectionModel = treeView.getSelectionModel();
CustomTreeItem item = (CustomTreeItem) selectionModel.getSelectedItem();
if (!item.isDirectory() && lengthOfOpenTabPathLessThanOne(item)) {
tabUpdater.addObjectToTab(item);
}
}
}
示例14: notifyClickEvent
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
/**
* Use this method to process a click event and send a special GUI event by the means of the message system.
* @param event MouseEvent. A click event
*/
void notifyClickEvent(MouseEvent event) {
if (!event.isStillSincePress()) {
return;
}
Map<String, Object> m = new HashMap<>();
m.put("screenX", event.getScreenX());
m.put("screenY", event.getScreenY());
m.put("nodeX", event.getScreenX() - sender.getLayoutX());
m.put("nodeY", event.getScreenY() - sender.getLayoutY());
m.put("nodeWidth", sender.getLayoutBounds().getWidth());
m.put("nodeHeight", sender.getLayoutBounds().getHeight());
StringBuilder eventMessage = new StringBuilder("gui-events:").append(senderName).append("-");
if (event.getButton() == MouseButton.PRIMARY) {
if (event.getClickCount() == 2) {
eventMessage.append("double");
} else {
eventMessage.append("left");
}
} else if (event.getButton() == MouseButton.SECONDARY) {
eventMessage.append("right");
} else if (event.getButton() == MouseButton.MIDDLE) {
eventMessage.append("middle");
} else {
return;
}
eventMessage.append("-click");
Main.getInstance().getPluginProxy().sendMessage(eventMessage.toString(), m);
}
示例15: handleModification
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private void handleModification(MouseEvent evt) {
if (evt.getClickCount() == 2) {
if (modifyHandler != null) {
ObservableRequirement obsReq = table.getSelectionModel().getSelectedItem();
if (obsReq != null) {
modifyHandler.handle(CUDEvent.generateModificationEvent(new ActionEvent(evt.getSource(), evt.getTarget()), TargetEntity.REQUIREMENT, obsReq));
}
}
}
}