Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get a String from a Jframe (textfield) and put on another jFrame (txtArea)? - Netbeans - Well Explained
    primarykey
    data
    text
    <p>it's my first post in here, but you have been helping me indirectly in many ways. But this kind of thing, like the title says, I still can't figure out. I think I don't need to say I'm a noob in such a thing, and any kind of help would be great =] .. By the way, I'm using netbeans (Java).</p> <p>So, here's my problem: </p> <ul> <li>I have a jFrame1 with 3 textFields.</li> <li>Also, in this jFrame1, I have a button that should do the following: +Look through the whole 3 textFields and only select the words that are between "" and/or between **. Other words should not be used. Also, this button should redirect me to jFrame2.</li> <li>In the other jFrame2, the 'special' words found in the 3 textFields (jFram1), should be put in there, inside a jTextArea1.</li> </ul> <p>And that's where I'm lost. Because I can't find a way to get these 'special' words and throw them in there.</p> <p>Let me post the code in here, so you guys can take a closer look to what I'm doing right/wrong:</p> <p>//Below, the Jframe1</p> <pre><code>public class JFrame1 extends javax.swing.JFrame { public TxtFieldsQuotationMarks tfqm = new TxtFieldsQuotationMarks(); public TxtFieldsAsterisk tfa = new TxtFieldsAsterisk(); public JFrame1() { initComponents(); } </code></pre> <p>//Below, the classes I created to support the textFields in JFrame1</p> <pre><code>public class TxtFieldsQuotationMarks { public String field1; public String field2; public String field3; } public class TxtFieldsAsterisk { public String field1; public String field2; public String field3; } </code></pre> <p>//Bellow, the function that should do the trick (of finding those 'special words')</p> <pre><code>private String Get_Fields_FindWords()(String Value) { if (Value.isEmpty()) { return ""; } else { String AuxStr = Value.substring(Value.indexOf('"'),Value.length()); return AuxStr.substring(1, AuxStr.indexOf('"')); } } private String Get_Fields_Asterisk_FindWords(String Value) { if (Value.isEmpty()) { return ""; } else { String AuxStr = Value.substring(Value.indexOf('*'),Value.length()); return AuxStr.substring(1, AuxStr.indexOf('*')); } } </code></pre> <p>//Below, the button in JFrame1, that should find the words and open the JFrame2 for me with those words (Quotation Marks on top and Asterisks below it)</p> <pre><code>private void btnJFrame1ActionPerformed(java.awt.event.ActionEvent evt) { Get_Fields_FindWords(); Get_Fields_Asterisks_FindWords(); JFrame2 jf2 = new JFrame2(); jf2.setVisible(true); } </code></pre> <p>//Below, the methods I tried to implement, in order to save the 'special words' in the textFields (this is also in the JFrame1)</p> <pre><code>public void Get_Fields() { fields.field1 = Return_StringQuotationMarks(txtField1.getText()); fields.field2 = Retorna_StringAspas(txtField2.getText()); fields.field3 = Retorna_StringAspas(txtField3.getText()); } public void Get_Fields_Asterisk() { fields_asterisk.field1 = Return_StringAsterisk(txtField1.getText()); fields_asterisk.field2 = Return_StringAsterisk(txtField2.getText()); fields_asterisk.field3 = Return_StringAsterisk(txtField3.getText()); } </code></pre> <p>//Finally, here's the second JFrame (Jframe2), with the textArea (textArea)</p> <pre><code>public class JFrame2 extends javax.swing.JFrame { TxtFieldsQuotationMarks tfqm = new TxtFieldsQuotationMarks(); TxtFieldsAsterisk tfa = new TxtFieldsAsterisk(); public JFrame2() { initComponents(); } } </code></pre> <hr> <p>That's pretty much it, guys. I hope you can understand what I'm trying to do and can help me somehow. I really need this thing done as soon as possible.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload