1 2 3 4 5 6 | ajax.naam = "Ajax"; ajax.punten = -1; ClubRij[0] = ajax; //etc... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | A basic extension of the java.applet.Applet class */ import java.awt.*; import java.applet.*; public class VoetbalApplet extends Applet { public class Club { private String naam; private int punten; public Club(String naam, int punten){ this.naam = naam; this.punten = punten; } public String getNaam(){ return naam; } public int getPunten(){ return punten; } public String toString(){ return naam+" - "+punten; } } public void init() { // Take out this line if you don't use symantec.itools.net.RelativeURL or symantec.itools.awt.util.StatusScroller symantec.itools.lang.Context.setApplet(this); // This code is automatically generated by Visual Cafe when you add // components to the visual environment. It instantiates and initializes // the components. To modify the code, only use code syntax that matches // what Visual Cafe can generate, or Visual Cafe may be unable to back // parse your Java file into its visual environment. //{{INIT_CONTROLS setLayout(null); setSize(711,663); add(EenVeld); EenVeld.setBounds(180,84,160,42); label1.setText("Vul je eerste club in : "); add(label1); label1.setFont(new Font("Dialog", Font.BOLD, 12)); label1.setBounds(36,84,132,36); label2.setText("Vul je tweede club in : "); add(label2); label2.setFont(new Font("Dialog", Font.BOLD, 12)); label2.setBounds(24,156,132,36); label3.setText("Vul je derde club in : "); add(label3); label3.setFont(new Font("Dialog", Font.BOLD, 12)); label3.setBounds(36,216,132,36); label4.setText("Vul je vierde club in : "); add(label4); label4.setFont(new Font("Dialog", Font.BOLD, 12)); label4.setBounds(36,300,132,36); add(TweeVeld); TweeVeld.setBounds(180,144,160,42); add(DrieVeld); DrieVeld.setBounds(180,216,160,42); add(VierVeld); VierVeld.setBounds(180,288,160,42); label5.setText("Naam Club :"); add(label5); label5.setFont(new Font("Dialog", Font.BOLD, 12)); label5.setBounds(192,24,121,25); label6.setText("Aantal Punten :"); add(label6); label6.setFont(new Font("Dialog", Font.BOLD, 12)); label6.setBounds(372,24,121,25); add(Punt1Veld); Punt1Veld.setBounds(396,84,52,36); add(Punt2Veld); Punt2Veld.setBounds(396,144,51,36); add(Punt3Veld); Punt3Veld.setBounds(396,216,51,36); add(Punt4Veld); Punt4Veld.setBounds(396,288,51,36); add(EindLijst); EindLijst.setBounds(72,360,195,160); NaamButton.setLabel("Sorteer op naam"); add(NaamButton); NaamButton.setBackground(java.awt.Color.lightGray); NaamButton.setFont(new Font("Dialog", Font.BOLD, 12)); NaamButton.setBounds(300,372,193,48); SorteerPunt.setLabel("Sorteer op punten"); add(SorteerPunt); SorteerPunt.setBackground(java.awt.Color.lightGray); SorteerPunt.setFont(new Font("Dialog", Font.BOLD, 12)); SorteerPunt.setBounds(300,444,193,48); add(WinnaarLabel); WinnaarLabel.setBounds(312,540,187,37); label7.setText("En de kampioen op basis van punten is : "); add(label7); label7.setFont(new Font("Dialog", Font.BOLD, 12)); label7.setBounds(24,540,252,40); DobbelButton.setLabel("Dobbel : "); add(DobbelButton); DobbelButton.setBackground(java.awt.Color.lightGray); DobbelButton.setFont(new Font("Dialog", Font.BOLD, 12)); DobbelButton.setBounds(528,408,135,49); label8.setText("En de kampioen op basis van dobbelen is :"); add(label8); label8.setFont(new Font("Dialog", Font.BOLD, 12)); label8.setBounds(12,612,252,40); add(DobbelLabel); DobbelLabel.setBounds(300,612,187,37); DobbelLabel.setVisible(false); VoegButton.setLabel("Voeg toe"); add(VoegButton); VoegButton.setBackground(java.awt.Color.lightGray); VoegButton.setFont(new Font("Dialog", Font.BOLD, 12)); VoegButton.setBounds(492,132,174,68); //}} //{{REGISTER_LISTENERS SymAction lSymAction = new SymAction(); VoegButton.addActionListener(lSymAction); NaamButton.addActionListener(lSymAction); SorteerPunt.addActionListener(lSymAction); DobbelButton.addActionListener(lSymAction); //}} } //{{DECLARE_CONTROLS java.awt.TextField EenVeld = new java.awt.TextField(); java.awt.Label label1 = new java.awt.Label(); java.awt.Label label2 = new java.awt.Label(); java.awt.Label label3 = new java.awt.Label(); java.awt.Label label4 = new java.awt.Label(); java.awt.TextField TweeVeld = new java.awt.TextField(); java.awt.TextField DrieVeld = new java.awt.TextField(); java.awt.TextField VierVeld = new java.awt.TextField(); java.awt.Label label5 = new java.awt.Label(); java.awt.Label label6 = new java.awt.Label(); java.awt.TextField Punt1Veld = new java.awt.TextField(); java.awt.TextField Punt2Veld = new java.awt.TextField(); java.awt.TextField Punt3Veld = new java.awt.TextField(); java.awt.TextField Punt4Veld = new java.awt.TextField(); java.awt.List EindLijst = new java.awt.List(4); java.awt.Button NaamButton = new java.awt.Button(); java.awt.Button SorteerPunt = new java.awt.Button(); java.awt.Label WinnaarLabel = new java.awt.Label(); java.awt.Label label7 = new java.awt.Label(); java.awt.Button DobbelButton = new java.awt.Button(); java.awt.Label label8 = new java.awt.Label(); java.awt.Label DobbelLabel = new java.awt.Label(); java.awt.Button VoegButton = new java.awt.Button(); //}} class SymAction implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent event) { Object object = event.getSource(); if (object == VoegButton) VoegButton_ActionPerformed(event); else if (object == NaamButton) NaamButton_ActionPerformed(event); else if (object == DobbelButton) DobbelButton_ActionPerformed(event); else if (object == SorteerPunt) SorteerPunt_ActionPerformed(event); } void VoegButton_ActionPerformed(java.awt.event.ActionEvent event) { EindLijst.clear(); EindLijst.addItem(EenVeld.getText()+" - "+ Punt1Veld.getText()); EindLijst.addItem(TweeVeld.getText()+" - "+ Punt2Veld.getText()); EindLijst.addItem(DrieVeld.getText()+" - "+ Punt3Veld.getText()); EindLijst.addItem(VierVeld.getText()+" - "+ Punt4Veld.getText()); } void NaamButton_ActionPerformed(java.awt.event.ActionEvent event) {int lengte =EindLijst.getItemCount(); // pakt de lengte for ( int aantal = lengte; aantal >1; aantal--)// Als aantal gelijk is aan lengte for (int index =0; index < aantal-1; index++)//gaat ie verder, index moet kleiner zijn dan aantal-1 { String dit_element = EindLijst.getItem(index);//pakt het element if(dit_element.compareTo(EindLijst.getItem(index+1)) > 0)//vergelijkt 2 elementen uit de lijst { EindLijst.remove(index);// verwijderd het tijdelijk EindLijst.add(dit_element, index+1);// voegt het op de juiste plaats toe } } // to do: code goes here. } } void DobbelButton_ActionPerformed(java.awt.event.ActionEvent event) { int getal = (int)Math.floor(Math.random()*3 + 1); DobbelLabel.setVisible(true); if (getal == 1){ DobbelLabel.setText(EenVeld.getText()); } else if (getal == 2){ DobbelLabel.setText(TweeVeld.getText()); } else if (getal == 3){ DobbelLabel.setText(DrieVeld.getText()); } else if ( getal ==4){ DobbelLabel.setText(VierVeld.getText()); } } void SorteerPunt_ActionPerformed(java.awt.event.ActionEvent event) { } public void sortpunten (Club[ ] array) { int i, j; String s; Club temp; for ( i = 1; i < array.length; i++ ) for ( j = 0; j < array.length-i; j++ ) if ( array[j].getPunten() > array[j+1].getPunten()) { temp = array[j]; array[j] = array[j+1]; array[j+1] = temp; } EindLijst.clear(); for (i = 0; i < array.length; i++) { if (array[i].getNaam() != null) { s = array[i].getNaam() + " - " + array[i].getPunten(); EindLijst.add(s); } } } } //zie commentaar van de namen van de actionpeformed hierboven, alleen de variabele namen //zijn gewijzigd. // to do: code goes here. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | A basic extension of the java.applet.Applet class */ import java.awt.*; import java.applet.*; public class VoetbalApplet extends Applet { private int MAXAANTAL =4; private Club[] ClubRij = new Club[MAXAANTAL]; public class Club { private String naam; private int punten; public Club(String naam, int punten){ this.naam = naam; this.punten = punten; } public String getNaam(){ return naam; } public void setNaam(){ this.naam = naam; } public int getPunten(){ return punten; } public void setPunten(){ this.punten = punten; } public String toString(){ return naam+" - "+punten; } } int teller = 0; public void init() { setLayout(null); setSize(711,663); add(EenVeld); EenVeld.setBounds(180,84,160,42); label1.setText("Vul je eerste club in : "); add(label1); label1.setFont(new Font("Dialog", Font.BOLD, 12)); label1.setBounds(36,84,132,36); label2.setText("Vul je tweede club in : "); add(label2); label2.setFont(new Font("Dialog", Font.BOLD, 12)); label2.setBounds(24,156,132,36); label3.setText("Vul je derde club in : "); add(label3); label3.setFont(new Font("Dialog", Font.BOLD, 12)); label3.setBounds(36,216,132,36); label4.setText("Vul je vierde club in : "); add(label4); label4.setFont(new Font("Dialog", Font.BOLD, 12)); label4.setBounds(36,300,132,36); add(TweeVeld); TweeVeld.setBounds(180,144,160,42); add(DrieVeld); DrieVeld.setBounds(180,216,160,42); add(VierVeld); VierVeld.setBounds(180,288,160,42); label5.setText("Naam Club :"); add(label5); label5.setFont(new Font("Dialog", Font.BOLD, 12)); label5.setBounds(192,24,121,25); label6.setText("Aantal Punten :"); add(label6); label6.setFont(new Font("Dialog", Font.BOLD, 12)); label6.setBounds(372,24,121,25); add(Punt1Veld); Punt1Veld.setBounds(396,84,52,36); add(Punt2Veld); Punt2Veld.setBounds(396,144,51,36); add(Punt3Veld); Punt3Veld.setBounds(396,216,51,36); add(Punt4Veld); Punt4Veld.setBounds(396,288,51,36); add(EindLijst); EindLijst.setBounds(72,360,195,160); NaamButton.setLabel("Sorteer op naam"); add(NaamButton); NaamButton.setBackground(java.awt.Color.lightGray); NaamButton.setFont(new Font("Dialog", Font.BOLD, 12)); NaamButton.setBounds(300,372,193,48); SorteerPunt.setLabel("Sorteer op punten"); add(SorteerPunt); SorteerPunt.setBackground(java.awt.Color.lightGray); SorteerPunt.setFont(new Font("Dialog", Font.BOLD, 12)); SorteerPunt.setBounds(300,444,193,48); add(WinnaarLabel); WinnaarLabel.setBounds(312,540,187,37); label7.setText("En de kampioen op basis van punten is : "); add(label7); label7.setFont(new Font("Dialog", Font.BOLD, 12)); label7.setBounds(24,540,252,40); DobbelButton.setLabel("Dobbel : "); add(DobbelButton); DobbelButton.setBackground(java.awt.Color.lightGray); DobbelButton.setFont(new Font("Dialog", Font.BOLD, 12)); DobbelButton.setBounds(528,408,135,49); label8.setText("En de kampioen op basis van dobbelen is :"); add(label8); label8.setFont(new Font("Dialog", Font.BOLD, 12)); label8.setBounds(12,612,252,40); add(DobbelLabel); DobbelLabel.setBounds(300,612,187,37); DobbelLabel.setVisible(false); VoegButton.setLabel("Voeg toe"); add(VoegButton); VoegButton.setBackground(java.awt.Color.lightGray); VoegButton.setFont(new Font("Dialog", Font.BOLD, 12)); VoegButton.setBounds(492,132,174,68); //}} //{{REGISTER_LISTENERS SymAction lSymAction = new SymAction(); VoegButton.addActionListener(lSymAction); NaamButton.addActionListener(lSymAction); SorteerPunt.addActionListener(lSymAction); DobbelButton.addActionListener(lSymAction); //}} } //{{DECLARE_CONTROLS java.awt.TextField EenVeld = new java.awt.TextField(); java.awt.Label label1 = new java.awt.Label(); java.awt.Label label2 = new java.awt.Label(); java.awt.Label label3 = new java.awt.Label(); java.awt.Label label4 = new java.awt.Label(); java.awt.TextField TweeVeld = new java.awt.TextField(); java.awt.TextField DrieVeld = new java.awt.TextField(); java.awt.TextField VierVeld = new java.awt.TextField(); java.awt.Label label5 = new java.awt.Label(); java.awt.Label label6 = new java.awt.Label(); java.awt.TextField Punt1Veld = new java.awt.TextField(); java.awt.TextField Punt2Veld = new java.awt.TextField(); java.awt.TextField Punt3Veld = new java.awt.TextField(); java.awt.TextField Punt4Veld = new java.awt.TextField(); java.awt.List EindLijst = new java.awt.List(4); java.awt.Button NaamButton = new java.awt.Button(); java.awt.Button SorteerPunt = new java.awt.Button(); java.awt.Label WinnaarLabel = new java.awt.Label(); java.awt.Label label7 = new java.awt.Label(); java.awt.Button DobbelButton = new java.awt.Button(); java.awt.Label label8 = new java.awt.Label(); java.awt.Label DobbelLabel = new java.awt.Label(); java.awt.Button VoegButton = new java.awt.Button(); //}} class SymAction implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent event) { Object object = event.getSource(); if (object == VoegButton) VoegButton_ActionPerformed(event); else if (object == NaamButton) NaamButton_ActionPerformed(event); else if (object == DobbelButton) DobbelButton_ActionPerformed(event); else if (object == SorteerPunt) SorteerPunt_ActionPerformed(event); } void VoegButton_ActionPerformed(java.awt.event.ActionEvent event) { String naam = EenVeld.getText(); int punten = Integer.parseInt(Punt1Veld.getText()); Club eersteClub = new Club(naam, punten); ClubRij[0] = eersteClub; naam = TweeVeld.getText(); punten = Integer.parseInt(Punt2Veld.getText()); Club tweedeClub = new Club(naam, punten); ClubRij[1] = tweedeClub; naam = DrieVeld.getText(); punten = Integer.parseInt(Punt3Veld.getText()); Club derdeClub = new Club(naam, punten); ClubRij[2] = derdeClub; naam = VierVeld.getText(); punten = Integer.parseInt(Punt4Veld.getText()); Club vierdeClub = new Club(naam, punten); ClubRij[3] = vierdeClub; EindLijst.removeAll(); for(int i=0; i<ClubRij.length; i++){ EindLijst.add(ClubRij[i].toString()); } } void NaamButton_ActionPerformed(java.awt.event.ActionEvent event) { int lengte =EindLijst.getItemCount(); // pakt de lengte for ( int aantal = lengte; aantal >1; aantal--)// Als aantal gelijk is aan lengte for (int index =0; index < aantal-1; index++)//gaat ie verder, index moet kleiner zijn dan aantal-1 { String dit_element = EindLijst.getItem(index);//pakt het element if(dit_element.compareTo(EindLijst.getItem(index+1)) > 0)//vergelijkt 2 elementen uit de lijst { EindLijst.remove(index);// verwijderd het tijdelijk EindLijst.add(dit_element, index+1);// voegt het op de juiste plaats toe } } // to do: code goes here. } } void DobbelButton_ActionPerformed(java.awt.event.ActionEvent event) { int getal = (int)Math.floor(Math.random()*3 + 1); DobbelLabel.setVisible(true); if (getal == 1){ DobbelLabel.setText(EenVeld.getText()); } else if (getal == 2){ DobbelLabel.setText(TweeVeld.getText()); } else if (getal == 3){ DobbelLabel.setText(DrieVeld.getText()); } else if ( getal ==4){ DobbelLabel.setText(VierVeld.getText()); } } void SorteerPunt_ActionPerformed(java.awt.event.ActionEvent event) { sortpunten(ClubRij); // to do: code goes here. } public void sortpunten (Club[] array) { int i, j; String s; Club temp; for ( i = 1; i < array.length; i++ ) for ( j = 0; j < array.length-i; j++ ) if ( array[j].getPunten() > array[j+1].getPunten()) { temp = array[j]; array[j] = array[j+1]; array[j+1] = temp; } EindLijst.clear(); for (i = 0; i < array.length; i++) { if (array[i].getNaam() != null) { s = array[i].getNaam() + " - " + array[i].getPunten(); EindLijst.add(s); } } } //zie commentaar van de namen van de actionpeformed hierboven, alleen de variabele namen //zijn gewijzigd. } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | MessageDigest digest = null; try{ /* MessageDigest object verkrijgen dat gebruik maakt van het MD5 algoritme */ digest = MessageDigest.getInstance("MD5"); } catch(java.security.NoSuchAlgorithmException error){ /* Exception loggen met bijv. Log4J */ } try{ /* De plaintext String converteren naar een UTF-8 gecodeerde byte array */ byte[] utf8Bytes = plaintext.getBytes("UTF-8"); /* De digest updaten met deze byte array */ digest.update(utf8Bytes); } catch(java.io.UnsupportedEncodingException error){ /* Exception loggen met bijv. Log4J */ } /* De hash operatie uitvoeren */ byte rawDigest[] = digest.digest(); /* Base64 (sun.misc.*) encoding toepassen en de byte array terug omzetten naar een String */ BASE64Encoder base64 = new BASE64Encoder(); String hash = base64.encode(rawDigest); return hash; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | RMISecurityManager ingesteld Geen verbinding kunnen maken met remote-objecten java.security.AccessControlException: access denied (java.net.SocketPermission 1 27.0.0.1:1099 connect,resolve) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkConnect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.<init>(Unknown Source) at java.net.Socket.<init>(Unknown Source) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S ource) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S ource) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) at sun.rmi.server.UnicastRef.newCall(Unknown Source) at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at java.rmi.Naming.lookup(Unknown Source) at Centrale.main(Centrale.java:28) |
Ik neem aan dat die policy alleen tijdens ontwikkeling en testen gaat gebruiken?quote:Op donderdag 9 november 2006 16:06 schreef _Xbox_Master_ het volgende:
heel simpel
grant {
permission java.security.AllPermissions;
};
Ik ga er morgen weer verder mee, ik heb echt genoeg code gezien vandaag
Het is een schoolopdrachtquote:Op donderdag 9 november 2006 16:22 schreef FallenAngel666 het volgende:
[..]
Ik neem aan dat die policy alleen tijdens ontwikkeling en testen gaat gebruiken?
1 2 3 | and/or sourcepath Error(12,35): class Robot not found in class sample.MyFirstRobot |
Niemand heeft meer problemen blijkbaarquote:Op woensdag 7 maart 2007 22:17 schreef PietjePuk007 het volgende:
*kick*
Is java ineens uit de aandacht van iedereen? Geen vragen meer?
|
Forum Opties | |
---|---|
Forumhop: | |
Hop naar: |