Mercurial > hg > Database > Christie
changeset 226:218ad6b9ba87
tweak
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 27 Dec 2019 17:33:16 +0900 |
parents | 401981622a1e |
children | 371c8492753e |
files | src/main/java/christie/test/topology/paxos/StartLocalPaxos.java src/main/java/christie/textEditor/textFrame.java |
diffstat | 2 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/christie/test/topology/paxos/StartLocalPaxos.java Fri Dec 27 16:09:10 2019 +0900 +++ b/src/main/java/christie/test/topology/paxos/StartLocalPaxos.java Fri Dec 27 17:33:16 2019 +0900 @@ -14,13 +14,13 @@ } - public static void main(String args[]){ + public static void main(String args[], int learnersNum1){ int proposerPort = 10000; int proposersNum = 2; int acceptorPort = proposerPort + proposersNum; int acceptorsNum = 3; int learnerPort = acceptorPort + acceptorsNum; - int learnersNum = 1; + int learnersNum = learnersNum1; List<CodeGearManager> proposers = new ArrayList<>(proposersNum); List<CodeGearManager> acceptors = new ArrayList<>(acceptorsNum);
--- a/src/main/java/christie/textEditor/textFrame.java Fri Dec 27 16:09:10 2019 +0900 +++ b/src/main/java/christie/textEditor/textFrame.java Fri Dec 27 17:33:16 2019 +0900 @@ -28,9 +28,11 @@ public boolean send = false; + private String inserted_string; + private int sendLoc = 0; - public boolean canWrite = true; + private boolean canWrite = true; StyleContext sc = new StyleContext(); @@ -90,8 +92,8 @@ } } - public void insertText(){ - textArea.insert("send", 0); + public void insertText(int pos, String str){ + textArea.insert(str, pos); } public boolean SendPermission(){ @@ -106,7 +108,9 @@ return sendLoc; } + public void prohibitDL(){canWrite = false;} + public String returnString(){return inserted_string;} public class MyDocumentListener implements DocumentListener { public void insertUpdate(DocumentEvent e) { @@ -115,14 +119,15 @@ loc = e.getOffset(); sendLoc = loc; - //System.out.println("location = " + loc); try { + inserted_string = doc.getText(loc, 1); System.out.print("string = " + doc.getText(loc, 1) + "\n"); - } catch (BadLocationException e1){ + } catch (BadLocationException e1) { e1.printStackTrace(); } send = true; - + } + canWrite = true; /* SwingUtilities.invokeLater(new Runnable() { @Override @@ -138,8 +143,6 @@ } }); */ - - } } @Override