copy to clipboard next system name
This commit is contained in:
@@ -2,6 +2,8 @@ package ru.trader;
|
|||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.input.Clipboard;
|
||||||
|
import javafx.scene.input.ClipboardContent;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import org.apache.log4j.PropertyConfigurator;
|
import org.apache.log4j.PropertyConfigurator;
|
||||||
import org.controlsfx.control.action.Action;
|
import org.controlsfx.control.action.Action;
|
||||||
@@ -114,5 +116,11 @@ public class Main extends Application {
|
|||||||
return Main.class.getResource("/view/"+filename);
|
return Main.class.getResource("/view/"+filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void copyToClipboard(String string){
|
||||||
|
final Clipboard clipboard = Clipboard.getSystemClipboard();
|
||||||
|
final ClipboardContent content = new ClipboardContent();
|
||||||
|
content.putString(string);
|
||||||
|
clipboard.setContent(content);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import javafx.scene.control.Label;
|
|||||||
import javafx.scene.control.ListView;
|
import javafx.scene.control.ListView;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import ru.trader.KeyBinding;
|
import ru.trader.KeyBinding;
|
||||||
|
import ru.trader.Main;
|
||||||
import ru.trader.model.*;
|
import ru.trader.model.*;
|
||||||
import ru.trader.view.support.ViewUtils;
|
import ru.trader.view.support.ViewUtils;
|
||||||
import ru.trader.view.support.cells.OfferListCell;
|
import ru.trader.view.support.cells.OfferListCell;
|
||||||
@@ -94,6 +95,7 @@ public class HelperController {
|
|||||||
missions.setItems(entry.missions());
|
missions.setItems(entry.missions());
|
||||||
stations.setItems(FXCollections.observableArrayList(route.getStations(index)));
|
stations.setItems(FXCollections.observableArrayList(route.getStations(index)));
|
||||||
sellOffers.setItems(FXCollections.observableArrayList(route.getSellOffers(index)));
|
sellOffers.setItems(FXCollections.observableArrayList(route.getSellOffers(index)));
|
||||||
|
Main.copyToClipboard(system.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@@ -121,6 +123,11 @@ public class HelperController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void copy(){
|
||||||
|
Main.copyToClipboard(system.getText());
|
||||||
|
}
|
||||||
|
|
||||||
private void bindKeys(){
|
private void bindKeys(){
|
||||||
KeyBinding.bind(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD4, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK), k -> ViewUtils.doFX(this::previous));
|
KeyBinding.bind(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD4, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK), k -> ViewUtils.doFX(this::previous));
|
||||||
KeyBinding.bind(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD6, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK), k -> ViewUtils.doFX(this::next));
|
KeyBinding.bind(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD6, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK), k -> ViewUtils.doFX(this::next));
|
||||||
|
|||||||
@@ -48,5 +48,8 @@
|
|||||||
<Button prefWidth="30" onAction="#next">
|
<Button prefWidth="30" onAction="#next">
|
||||||
<graphic><Glyph text="FontAwesome|ARROW_RIGHT"/></graphic>
|
<graphic><Glyph text="FontAwesome|ARROW_RIGHT"/></graphic>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button prefWidth="30" onAction="#copy">
|
||||||
|
<graphic><Glyph text="FontAwesome|COPY"/></graphic>
|
||||||
|
</Button>
|
||||||
</HBox>
|
</HBox>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
|||||||
Reference in New Issue
Block a user