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 | A basic extension of the java.applet.Applet class */ import java.awt.*; import java.applet.*; import com.symantec.itools.javax.swing.JCurrencyTextField; import com.symantec.itools.javax.swing.JWrappingLabel; import com.symantec.itools.javax.swing.actions.JActionButton; import com.symantec.itools.javax.swing.JBorderlessButton; public class Applet1 extends Applet { 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); setBackground(java.awt.Color.lightGray); setSize(637,413); add(TellerVeld); TellerVeld.setBounds(120,48,193,62); add(NoemerVeld); NoemerVeld.setBounds(120,180,193,62); add(UitkomstVeld); UitkomstVeld.setBounds(120,300,193,62); try { JWrappingLabel1.setText("Invoer Teller : "); } catch(java.beans.PropertyVetoException e) { } try { JWrappingLabel1.setTextAlignment(javax.swing.SwingConstants.CENTER); } catch(java.beans.PropertyVetoException e) { } add(JWrappingLabel1); JWrappingLabel1.setFont(new Font("Dialog", Font.PLAIN, 20)); JWrappingLabel1.setBounds(12,48,84,60); try { JWrappingLabel2.setText("Invoer noemer : "); } catch(java.beans.PropertyVetoException e) { } try { JWrappingLabel2.setTextAlignment(javax.swing.SwingConstants.CENTER); } catch(java.beans.PropertyVetoException e) { } add(JWrappingLabel2); JWrappingLabel2.setFont(new Font("Dialog", Font.PLAIN, 20)); JWrappingLabel2.setBounds(12,180,84,72); try { JWrappingLabel3.setText("Uitkomst : "); } catch(java.beans.PropertyVetoException e) { } try { JWrappingLabel3.setTextAlignment(javax.swing.SwingConstants.CENTER); } catch(java.beans.PropertyVetoException e) { } add(JWrappingLabel3); JWrappingLabel3.setFont(new Font("Dialog", Font.PLAIN, 20)); JWrappingLabel3.setBounds(12,312,84,36); PlusButton.setText("+"); add(PlusButton); PlusButton.setBounds(360,312,51,53); MinButton.setText("-"); add(MinButton); MinButton.setBounds(432,312,51,53); MaalButton.setText("X"); add(MaalButton); MaalButton.setBounds(504,312,51,53); DeelButton.setText(":"); add(DeelButton); DeelButton.setBounds(576,312,51,53); //}} //{{REGISTER_LISTENERS SymAction lSymAction = new SymAction(); TellerVeld.addActionListener(lSymAction); NoemerVeld.addActionListener(lSymAction); PlusButton.addActionListener(lSymAction); MinButton.addActionListener(lSymAction); MaalButton.addActionListener(lSymAction); DeelButton.addActionListener(lSymAction); //}} } //{{DECLARE_CONTROLS com.symantec.itools.javax.swing.JCurrencyTextField TellerVeld = new com.symantec.itools.javax.swing.JCurrencyTextField(); com.symantec.itools.javax.swing.JCurrencyTextField NoemerVeld = new com.symantec.itools.javax.swing.JCurrencyTextField(); com.symantec.itools.javax.swing.JCurrencyTextField UitkomstVeld = new com.symantec.itools.javax.swing.JCurrencyTextField(); com.symantec.itools.javax.swing.JWrappingLabel JWrappingLabel1 = new com.symantec.itools.javax.swing.JWrappingLabel(); com.symantec.itools.javax.swing.JWrappingLabel JWrappingLabel2 = new com.symantec.itools.javax.swing.JWrappingLabel(); com.symantec.itools.javax.swing.JWrappingLabel JWrappingLabel3 = new com.symantec.itools.javax.swing.JWrappingLabel(); com.symantec.itools.javax.swing.JBorderlessButton PlusButton = new com.symantec.itools.javax.swing.JBorderlessButton(); com.symantec.itools.javax.swing.JBorderlessButton MinButton = new com.symantec.itools.javax.swing.JBorderlessButton(); com.symantec.itools.javax.swing.JBorderlessButton MaalButton = new com.symantec.itools.javax.swing.JBorderlessButton(); com.symantec.itools.javax.swing.JBorderlessButton DeelButton = new com.symantec.itools.javax.swing.JBorderlessButton(); //}} class SymAction implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent event) { Object object = event.getSource(); if (object == TellerVeld) TellerVeld_actionPerformed(event); else if (object == NoemerVeld) NoemerVeld_actionPerformed(event); else if (object == PlusButton) PlusButton_actionPerformed(event); else if (object == MinButton) MinButton_actionPerformed(event); else if (object == MaalButton) MaalButton_actionPerformed(event); else if (object == DeelButton) DeelButton_actionPerformed(event); } } void TellerVeld_actionPerformed(java.awt.event.ActionEvent event) { // to do: code goes here. } void NoemerVeld_actionPerformed(java.awt.event.ActionEvent event) { // to do: code goes here. } void PlusButton_actionPerformed(java.awt.event.ActionEvent event) { String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n + t; UitkomstVeld.setText("" + u); // Hij doet de noemer + de teller en geeft de uitslag. } void MinButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n - t; UitkomstVeld.setText("" + u); // Hij doet de noemer - de teller en geeft vervolgens de uitslag. } void MaalButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n * t; UitkomstVeld.setText("" + u); // Hij vermenigvuldigd de noemer met de teller, en geeft vervolgens de uitslag. } void DeelButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n / t; UitkomstVeld.setText("" + u); // Hij deelt de noemer door de teller. en geeft vervolgens de uitslag. } } |
Ja, code is idd niks maja, da's Visual Cafe eigenquote:Op vrijdag 24 februari 2006 22:33 schreef gelly het volgende:
Maar is dat de code die VisualCafe ervan maakt joh ? Wat een zooi.
Heb je niet toevallig een vinkje aangezet (of wat aanstond) toen je de velden neerzette? Want nu hebben al die velden de eigenschap dat ze currency velden zijn terwijl je eigenlijk gewone textfields wilt. Je zou dit handmatig kunnen veranderen maar is er niet in de lijst met opties die je bij zo'n veld hebt een vinkje wat je uit kan zetten om dat te veranderen?quote:Op vrijdag 24 februari 2006 22:50 schreef Messenga het volgende:
Ik zou het het liefst ook anders doen, maar dat mag niet.
hoe los ik het nu op?
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 | // to do: code goes here. } void PlusButton_actionPerformed(java.awt.event.ActionEvent event) { String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n + t; UitkomstVeld.setText("" + u); // Hij doet de noemer + de teller en geeft de uitslag. } void MinButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n - t; UitkomstVeld.setText("" + u); // Hij doet de noemer - de teller en geeft vervolgens de uitslag. } void MaalButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n * t; UitkomstVeld.setText("" + u); // Hij vermenigvuldigd de noemer met de teller, en geeft vervolgens de uitslag. } void DeelButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n / t; UitkomstVeld.setText("" + u); // Hij deelt de noemer door de teller. en geeft vervolgens de uitslag. } } |
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 | A basic extension of the java.applet.Applet class */ import java.awt.*; import java.applet.*; import com.symantec.itools.javax.swing.JBox; import com.symantec.itools.javax.swing.JCurrencyTextField; import com.symantec.itools.javax.swing.JMaskedTextField; import com.symantec.itools.javax.swing.JBorderlessButton; import com.symantec.itools.javax.swing.JWrappingLabel; import com.symantec.itools.javax.swing.actions.JActionButton; public class Applet1 extends Applet { 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(623,504); add(NoemerVeld); NoemerVeld.setBounds(144,228,144,36); try { JWrappingLabel1.setText("Invoer Teller"); } catch(java.beans.PropertyVetoException e) { } try { JWrappingLabel1.setTextAlignment(javax.swing.SwingConstants.CENTER); } catch(java.beans.PropertyVetoException e) { } add(JWrappingLabel1); JWrappingLabel1.setFont(new Font("Dialog", Font.BOLD, 20)); JWrappingLabel1.setBounds(24,84,85,72); try { JWrappingLabel2.setText("Invoer Noemer"); } catch(java.beans.PropertyVetoException e) { } try { JWrappingLabel2.setTextAlignment(javax.swing.SwingConstants.CENTER); } catch(java.beans.PropertyVetoException e) { } add(JWrappingLabel2); JWrappingLabel2.setFont(new Font("Dialog", Font.BOLD, 20)); JWrappingLabel2.setBounds(36,216,85,72); try { JWrappingLabel3.setText("Uitkomst"); } catch(java.beans.PropertyVetoException e) { } try { JWrappingLabel3.setTextAlignment(javax.swing.SwingConstants.CENTER); } catch(java.beans.PropertyVetoException e) { } add(JWrappingLabel3); JWrappingLabel3.setFont(new Font("Dialog", Font.BOLD, 20)); JWrappingLabel3.setBounds(24,372,95,42); add(UitkomstVeld); UitkomstVeld.setBounds(144,360,144,48); add(TellerVeld); TellerVeld.setBounds(132,108,144,36); MinButton.setText("-"); add(MinButton); MinButton.setBounds(432,360,48,48); MaalButton.setText("X"); add(MaalButton); MaalButton.setBounds(492,360,48,48); DeelButton.setText(":"); add(DeelButton); DeelButton.setBounds(552,360,48,48); PlusButton.setText("+"); add(PlusButton); PlusButton.setBounds(360,360,48,48); add(NoemerVeld); //}} } //{{DECLARE_CONTROLS com.symantec.itools.javax.swing.JCurrencyTextField NoemerVeld = new com.symantec.itools.javax.swing.JCurrencyTextField(); com.symantec.itools.javax.swing.JWrappingLabel JWrappingLabel1 = new com.symantec.itools.javax.swing.JWrappingLabel(); com.symantec.itools.javax.swing.JWrappingLabel JWrappingLabel2 = new com.symantec.itools.javax.swing.JWrappingLabel(); com.symantec.itools.javax.swing.JWrappingLabel JWrappingLabel3 = new com.symantec.itools.javax.swing.JWrappingLabel(); com.symantec.itools.javax.swing.JCurrencyTextField UitkomstVeld = new com.symantec.itools.javax.swing.JCurrencyTextField(); com.symantec.itools.javax.swing.JCurrencyTextField TellerVeld = new com.symantec.itools.javax.swing.JCurrencyTextField(); com.symantec.itools.javax.swing.JBorderlessButton MinButton = new com.symantec.itools.javax.swing.JBorderlessButton(); com.symantec.itools.javax.swing.JBorderlessButton MaalButton = new com.symantec.itools.javax.swing.JBorderlessButton(); com.symantec.itools.javax.swing.JBorderlessButton DeelButton = new com.symantec.itools.javax.swing.JBorderlessButton(); com.symantec.itools.javax.swing.JBorderlessButton PlusButton = new com.symantec.itools.javax.swing.JBorderlessButton(); //}} void TellerVeld_actionPerformed(java.awt.event.ActionEvent event) { // to do: code goes here. } void NoemerVeld_actionPerformed(java.awt.event.ActionEvent event) { // to do: code goes here. } void PlusButton_actionPerformed(java.awt.event.ActionEvent event) { String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n + t; UitkomstVeld.setText("" + u); // Hij doet de noemer + de teller en geeft de uitslag. } void MinButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n - t; UitkomstVeld.setText("" + u); // Hij doet de noemer - de teller en geeft vervolgens de uitslag. } void MaalButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n * t; UitkomstVeld.setText("" + u); // Hij vermenigvuldigd de noemer met de teller, en geeft vervolgens de uitslag. } void DeelButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n / t; UitkomstVeld.setText("" + u); // Hij deelt de noemer door de teller. en geeft vervolgens de uitslag. } } |
1 |
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 | A basic extension of the java.applet.Applet class */ import java.awt.*; import java.applet.*; import com.symantec.itools.javax.swing.JBox; import com.symantec.itools.javax.swing.JCurrencyTextField; import com.symantec.itools.javax.swing.JMaskedTextField; import com.symantec.itools.javax.swing.JBorderlessButton; import com.symantec.itools.javax.swing.JWrappingLabel; import com.symantec.itools.javax.swing.actions.JActionButton; public class Applet1 extends Applet { 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(623,504); try { JWrappingLabel1.setText("Invoer Teller"); } catch(java.beans.PropertyVetoException e) { } try { JWrappingLabel1.setTextAlignment(javax.swing.SwingConstants.CENTER); } catch(java.beans.PropertyVetoException e) { } add(JWrappingLabel1); JWrappingLabel1.setFont(new Font("Dialog", Font.BOLD, 20)); JWrappingLabel1.setBounds(24,84,85,72); try { JWrappingLabel2.setText("Invoer Noemer"); } catch(java.beans.PropertyVetoException e) { } try { JWrappingLabel2.setTextAlignment(javax.swing.SwingConstants.CENTER); } catch(java.beans.PropertyVetoException e) { } add(JWrappingLabel2); JWrappingLabel2.setFont(new Font("Dialog", Font.BOLD, 20)); JWrappingLabel2.setBounds(36,216,85,72); try { JWrappingLabel3.setText("Uitkomst"); } catch(java.beans.PropertyVetoException e) { } try { JWrappingLabel3.setTextAlignment(javax.swing.SwingConstants.CENTER); } catch(java.beans.PropertyVetoException e) { } add(JWrappingLabel3); JWrappingLabel3.setFont(new Font("Dialog", Font.BOLD, 20)); JWrappingLabel3.setBounds(24,372,95,42); MinButton.setText("-"); add(MinButton); MinButton.setBounds(432,360,48,48); MaalButton.setText("X"); add(MaalButton); MaalButton.setBounds(492,360,48,48); DeelButton.setText(":"); add(DeelButton); DeelButton.setBounds(552,360,48,48); PlusButton.setText("+"); add(PlusButton); PlusButton.setBounds(360,360,48,48); add(TellerVeld); TellerVeld.setBounds(144,84,205,56); add(NoemerVeld); NoemerVeld.setBounds(144,216,205,56); add(UitkomstVeld); UitkomstVeld.setBounds(132,360,205,56); //}} } //{{DECLARE_CONTROLS com.symantec.itools.javax.swing.JWrappingLabel JWrappingLabel1 = new com.symantec.itools.javax.swing.JWrappingLabel(); com.symantec.itools.javax.swing.JWrappingLabel JWrappingLabel2 = new com.symantec.itools.javax.swing.JWrappingLabel(); com.symantec.itools.javax.swing.JWrappingLabel JWrappingLabel3 = new com.symantec.itools.javax.swing.JWrappingLabel(); com.symantec.itools.javax.swing.JBorderlessButton MinButton = new com.symantec.itools.javax.swing.JBorderlessButton(); com.symantec.itools.javax.swing.JBorderlessButton MaalButton = new com.symantec.itools.javax.swing.JBorderlessButton(); com.symantec.itools.javax.swing.JBorderlessButton DeelButton = new com.symantec.itools.javax.swing.JBorderlessButton(); com.symantec.itools.javax.swing.JBorderlessButton PlusButton = new com.symantec.itools.javax.swing.JBorderlessButton(); com.symantec.itools.javax.swing.JMaskedTextField TellerVeld = new com.symantec.itools.javax.swing.JMaskedTextField(); com.symantec.itools.javax.swing.JMaskedTextField NoemerVeld = new com.symantec.itools.javax.swing.JMaskedTextField(); com.symantec.itools.javax.swing.JMaskedTextField UitkomstVeld = new com.symantec.itools.javax.swing.JMaskedTextField(); //}} void TellerVeld_actionPerformed(java.awt.event.ActionEvent event) { // to do: code goes here. } void NoemerVeld_actionPerformed(java.awt.event.ActionEvent event) { // to do: code goes here. } void PlusButton_actionPerformed(java.awt.event.ActionEvent event) { String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n + t; UitkomstVeld.setText("" + u); // Hij doet de noemer + de teller en geeft de uitslag. } void MinButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n - t; UitkomstVeld.setText("" + u); // Hij doet de noemer - de teller en geeft vervolgens de uitslag. } void MaalButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n * t; UitkomstVeld.setText("" + u); // Hij vermenigvuldigd de noemer met de teller, en geeft vervolgens de uitslag. } void DeelButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n / t; UitkomstVeld.setText("" + u); // Hij deelt de noemer door de teller. en geeft vervolgens de uitslag. } } |
Visual cafequote:Op maandag 27 februari 2006 18:56 schreef gelly het volgende:
[ code verwijderd ]
![]()
Maakt VisualCafe dat ervan of jij ?
Dat is het nare, die troep geeft die standaardquote:Op maandag 27 februari 2006 19:01 schreef gelly het volgende:
Kun je enkel die Symantec componenten gebruiken bij het ontwerpen of ook gewoon de standaard API zoals java.awt of javax.swing ?
Daar zit het probleem namelijk, je probeert een string uit zo'n veld om te zetten naar int, en dat wil niet omdat er alfanummerieke tekens in staan.
Probeer hetquote:Op maandag 27 februari 2006 19:02 schreef gelly het volgende:
Ik zou bijna dat rottige VC downloaden om het te bekijken
Maar in het componentenmenu kun je niet kiezen uit AWT of Swing componenten ? Dat lijkt me toch sterk..quote:Op maandag 27 februari 2006 19:04 schreef Messenga het volgende:
[..]
Dat is het nare, die troep geeft die standaard.
[..]
Serieus?quote:
Dat klopt, van de lerares leren we dan standaard AWT Applet aan te klikkenquote:Op maandag 27 februari 2006 19:06 schreef gelly het volgende:
[..]
Maar in het componentenmenu kun je niet kiezen uit AWT of Swing componenten ? Dat lijkt me toch sterk..
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 | A basic extension of the java.applet.Applet class */ import java.awt.*; import java.applet.*; public class Applet1 extends Applet { 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(632,522); add(TellerVeld); TellerVeld.setBounds(36,60,319,71); add(NoemerVeld); NoemerVeld.setBounds(36,168,319,71); add(UitkomstVeld); UitkomstVeld.setBounds(36,324,192,71); PlusButton.setLabel("+"); add(PlusButton); PlusButton.setBackground(java.awt.Color.lightGray); PlusButton.setBounds(300,324,72,72); MinButton.setLabel("-"); add(MinButton); MinButton.setBackground(java.awt.Color.lightGray); MinButton.setBounds(396,324,60,72); MaalButton.setLabel("X"); add(MaalButton); MaalButton.setBackground(java.awt.Color.lightGray); MaalButton.setBounds(480,324,60,72); DeelButton.setLabel(":"); add(DeelButton); DeelButton.setBackground(java.awt.Color.lightGray); DeelButton.setBounds(564,324,60,72); //}} } //{{DECLARE_CONTROLS java.awt.TextField TellerVeld = new java.awt.TextField(); java.awt.TextField NoemerVeld = new java.awt.TextField(); java.awt.TextField UitkomstVeld = new java.awt.TextField(); java.awt.Button PlusButton = new java.awt.Button(); java.awt.Button MinButton = new java.awt.Button(); java.awt.Button MaalButton = new java.awt.Button(); java.awt.Button DeelButton = new java.awt.Button(); //}} void TellerVeld_actionPerformed(java.awt.event.ActionEvent event) { // to do: code goes here. } void NoemerVeld_actionPerformed(java.awt.event.ActionEvent event) { // to do: code goes here. } void PlusButton_actionPerformed(java.awt.event.ActionEvent event) { String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n + t; UitkomstVeld.setText("" + u); // Hij doet de noemer + de teller en geeft de uitslag. } void MinButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n - t; UitkomstVeld.setText("" + u); // Hij doet de noemer - de teller en geeft vervolgens de uitslag. } void MaalButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n * t; UitkomstVeld.setText("" + u); // Hij vermenigvuldigd de noemer met de teller, en geeft vervolgens de uitslag. } void DeelButton_actionPerformed(java.awt.event.ActionEvent event) {String noemer = NoemerVeld.getText(); String teller = TellerVeld.getText(); int n = Integer.parseInt(noemer); int t = Integer.parseInt(teller); int u = n / t; UitkomstVeld.setText("" + u); // Hij deelt de noemer door de teller. en geeft vervolgens de uitslag. } |
Zover was ik nog welquote:Op maandag 27 februari 2006 21:00 schreef CrustyClown het volgende:
Onder de knop hang je een action listener die de het getal uit het boxje leest. Deze kun je nog controleren met isNumeric (weet de precieze methode niet). Vervolgens laat je dit getal in een for loopje in de listbox weergeven. Dat is de code die je wilt programmeren. NU de java uitwerking nog
1 2 3 4 5 6 7 8 9 10 | int basis = Integer.parseInt(invoerVeld.getText()); for (int i=1; i <= 10; i++ ) { uitvoerTextVeld.append("" + i + " * " + basis +" = " + (basis * i)); } } |
1 2 3 | (*) ("" + n + " * " + m + " = " n*m) } |
1 2 3 | (*) ("" + n*m) } |
Werkt bijnaquote:
quote:Error: D:\VisualCafeSE\bin\TempPrj0\Applet1.java(64): Method append(java.lang.String) not found in class java.awt.TextField.
UitvoerVeld.append("" + i + " * " + basis +" = " + (basis * i));
^
1 error
Build Failed
Ah okequote:Op maandag 27 februari 2006 21:17 schreef gelly het volgende:
Het moet ook een textArea zijn he..
hehe, het werkt nuquote:Op maandag 27 februari 2006 21:19 schreef gelly het volgende:
Of had je het tekstveld uit zitten rekken om het zo groot te krijgen
uitvoerTextVeld.append("" + i + " * " + basis +" = " + (basis * i)+"\n");quote:Op maandag 27 februari 2006 21:21 schreef Messenga het volgende:
[..]
hehe, het werkt nu
Maar nu krijg ik dit soort :
1 * 5 = 52 * 5 = 103 * 5 = 154 * 5 = 205 * 5 = 256 * 5 = 307 * 5 = 358 * 5 = 409 * 5 = 4510 * 5 = 50
Terwijl ik gewoon een lijstje moet hebebn van :
1*5 =5
2*5=10
etc
Forum Opties | |
---|---|
Forumhop: | |
Hop naar: |