https://github.com/dmlloyd/openjdk
Here, I will try to create an aplication for delegating SP to another user using java Netbeans IDE. This aplication contains a form to input the destination and number of SP to be delegated. When user press the delegate button, a new window will appear where the user is that required to login using steemconnect. For more details, you can see in the picture below.
open Netbeans IDE software then create new project
Add new JFrame Form
Add JLabel, JTextField, JButton like following screenshot
Double click on button in form design
add some method, here I use delegate() method.
Left Click on hint simbol then double click on create method "delegate"
go to delegate() method
delegate() methodString receiveUser=user.getText();
String sp=amount.getText();
getText() is a method to get text from user input. Data that taken using getText() mehtod are in String form
final JFrame frame=new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setSize(1280,720);
frame the variable name for new JFrame. setDefaultCloseOperation is method to set the the exit button on right-top corner. setSize() is method to set the width and height of the new frame
Note : before adding the code above, you need to import package javax.swing.JFrame;
final JFXPanel fxpanel=new JFXPanel();
frame.add(fxpanel);
Platform.runLater(new Runnable(){
@Override
public void run() {
WebEngine engine;
WebView wv =new WebView();
engine=wv.getEngine();
fxpanel.setScene(new Scene(wv));
engine.load("https://steemconnect.com/sign/delegateVestingShares?delegator=&delegatee="+receiveUser+"&vesting_shares="+sp+"%20SP");
}
});
frame.setVisible(true);
Platform.runLateris method to run some task on JFXpanel
@Overrideto implement all abstract method
public void run()is run method.
WebEngine engine;Inisialize web engine
WebView wv =new WebView();inssialize web view
engine=wv.getEngine();get view from web engine
fxpanel.setScene(new Scene(wv));set scene on JFXpanel
engine.load("https://steemconnect.com/sign/delegateVestingShares?delegator=&delegatee="+receiveUser+"&vesting_shares="+sp+"%20SP");load the url
Here we need steemconnect URL, and this url we need to modify. steemconnect URL for delegating steem power : https://steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=[UserDestination]&vesting_shares=0%[amount]SP
We modify [UserDestination] and [amount] as variable that get data from user input. So the RL become like this : "https://steemconnect.com/sign/delegateVestingShares?delegator=&delegatee="+receiveUser+"&vesting_shares="+sp+"%20SP"
Save the project and Click the play button to run the project
https://gist.github.com/team2dev/cad5b352ce9d51725d83008e91b72ebc