passing data to another class

i have the following class(frame), this frame has some feilds i have to pass the value which is filled at these feild to another class, i try set and get methods but when i pass data i receive null, so please how can i solve this problem?

package project;

publicclass configextends javax.swing.JFrame{

String s,port;

int i;

//count c=new count();

/** Creates new form config */

public config(){

initComponents();

setSize(400,450);

}

/** This method is called from within the constructor to

* initialize the form.

* WARNING: Do NOT modify this code. The content of this method is

* always regenerated by the Form Editor.

*/

// <editor-fold defaultstate="collapsed" desc=" Generated Code ">

privatevoid initComponents(){

namel =new javax.swing.JLabel();

jRadioButton1 =new javax.swing.JRadioButton();

jLabel2 =new javax.swing.JLabel();

num =new javax.swing.JTextField();

jRadioButton2 =new javax.swing.JRadioButton();

jRadioButton3 =new javax.swing.JRadioButton();

jRadioButton4 =new javax.swing.JRadioButton();

jRadioButton5 =new javax.swing.JRadioButton();

jRadioButton6 =new javax.swing.JRadioButton();

namef =new javax.swing.JTextField();

jSeparator1 =new javax.swing.JSeparator();

jSeparator2 =new javax.swing.JSeparator();

help =new javax.swing.JButton();

apply =new javax.swing.JButton();

cancel =new javax.swing.JButton();

ext =new javax.swing.JButton();

getContentPane().setLayout(null);

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("Configuration");

namel.setText("Name:");

getContentPane().add(namel);

namel.setBounds(30, 30, 50, 14);

jRadioButton1.setText("Unlimited");

jRadioButton1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));

jRadioButton1.setMargin(new java.awt.Insets(0, 0, 0, 0));

jRadioButton1.addActionListener(new java.awt.event.ActionListener(){

publicvoid actionPerformed(java.awt.event.ActionEvent evt){

jRadioButton1ActionPerformed(evt);

}

});

getContentPane().add(jRadioButton1);

jRadioButton1.setBounds(60, 90, 70, 15);

jLabel2.setText("Maximum number:");

getContentPane().add(jLabel2);

jLabel2.setBounds(60, 120, 130, 14);

getContentPane().add(num);

num.setBounds(180, 120, 50, 20);

jRadioButton2.setText("COM1");

jRadioButton2.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));

jRadioButton2.setMargin(new java.awt.Insets(0, 0, 0, 0));

getContentPane().add(jRadioButton2);

jRadioButton2.setBounds(60, 200, 70, 15);

jRadioButton3.setText("COM2");

jRadioButton3.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));

jRadioButton3.setMargin(new java.awt.Insets(0, 0, 0, 0));

getContentPane().add(jRadioButton3);

jRadioButton3.setBounds(60, 220, 80, 15);

jRadioButton4.setText("COM3");

jRadioButton4.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));

jRadioButton4.setMargin(new java.awt.Insets(0, 0, 0, 0));

getContentPane().add(jRadioButton4);

jRadioButton4.setBounds(60, 240, 70, 15);

jRadioButton5.setText("COM4");

jRadioButton5.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));

jRadioButton5.setMargin(new java.awt.Insets(0, 0, 0, 0));

getContentPane().add(jRadioButton5);

jRadioButton5.setBounds(60, 260, 70, 15);

jRadioButton6.setText("COM5");

jRadioButton6.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));

jRadioButton6.setMargin(new java.awt.Insets(0, 0, 0, 0));

getContentPane().add(jRadioButton6);

jRadioButton6.setBounds(60, 280, 70, 15);

getContentPane().add(namef);

namef.setBounds(70, 30, 230, 19);

jSeparator1.setBorder(javax.swing.BorderFactory.createTitledBorder(null,"Maximim number of visiters", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION,new java.awt.Font("Tahoma", 0, 11),new java.awt.Color(0, 0, 255)));

getContentPane().add(jSeparator1);

jSeparator1.setBounds(20, 70, 360, 90);

jSeparator2.setBorder(javax.swing.BorderFactory.createTitledBorder(null,"Choose suitable Port", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION,new java.awt.Font("Tahoma", 0, 11),new java.awt.Color(0, 0, 255)));

getContentPane().add(jSeparator2);

jSeparator2.setBounds(20, 180, 360, 140);

help.setText("Help");

help.addActionListener(new java.awt.event.ActionListener(){

publicvoid actionPerformed(java.awt.event.ActionEvent evt){

helpActionPerformed(evt);

}

});

getContentPane().add(help);

help.setBounds(260, 210, 70, 23);

apply.setText("Apply");

apply.addActionListener(new java.awt.event.ActionListener(){

publicvoid actionPerformed(java.awt.event.ActionEvent evt){

applyActionPerformed(evt);

}

});

getContentPane().add(apply);

apply.setBounds(40, 340, 80, 23);

cancel.setText("Cancel");

cancel.addActionListener(new java.awt.event.ActionListener(){

publicvoid actionPerformed(java.awt.event.ActionEvent evt){

cancelActionPerformed(evt);

}

});

getContentPane().add(cancel);

cancel.setBounds(150, 340, 90, 23);

ext.setText("Exit");

ext.addActionListener(new java.awt.event.ActionListener(){

publicvoid actionPerformed(java.awt.event.ActionEvent evt){

extActionPerformed(evt);

}

});

getContentPane().add(ext);

ext.setBounds(270, 340, 80, 23);

pack();

}// </editor-fold>

privatevoid cancelActionPerformed(java.awt.event.ActionEvent evt){

// TODO add your handling code here:

}

privatevoid extActionPerformed(java.awt.event.ActionEvent evt){

System.exit(0);

}

privatevoid applyActionPerformed(java.awt.event.ActionEvent evt){

setPort();

setName();

setMax();

System.out.println("listener"+getName()+";;;;"+s);

new count().show();

}

privatevoid helpActionPerformed(java.awt.event.ActionEvent evt){

// TODO add your handling code here:

}

privatevoid jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt){

if(jRadioButton1.isSelected()){

num.enable(false);

}else{

num.enable(false);

jLabel2.enable(false);

jLabel2.disable();

}

}

/*************************NAME***************************/

publicvoid setName(){

if(!namef.getText().equals(null)){

s=namef.getText();

}else{s="No Name";

}

}

public String getName(){

return s;

}

/*************************MAXIMUM NUMBER********************************/

publicvoid setMax(){

if(!num.getText().equals(null)){

i=Integer.parseInt(num.getText());

}else{i=0;

}

}

publicint getMax(){

return i;

}

/*********************COM_PORT*************************************/

publicvoid setPort(){

if(jRadioButton2.isSelected()){

port="COM1";

}elseif(jRadioButton3.isSelected()){

port="COM2";

}elseif(jRadioButton4.isSelected()){

port="COM3";

}elseif(jRadioButton5.isSelected()){

port="COM4";

}elseif(jRadioButton6.isSelected()){

port="COM5";

}else{

port="COM1";

}

}

public String getPort(){

return port;

}

/**

* @param args the command line arguments

*/

publicstaticvoid main(String args[]){

java.awt.EventQueue.invokeLater(new Runnable(){

publicvoid run(){

new config().setVisible(true);

}

});

}

// Variables declaration - do not modify

private javax.swing.JButton apply;

private javax.swing.JButton cancel;

private javax.swing.JButton ext;

private javax.swing.JButton help;

private javax.swing.JLabel jLabel2;

private javax.swing.JRadioButton jRadioButton1;

private javax.swing.JRadioButton jRadioButton2;

private javax.swing.JRadioButton jRadioButton3;

private javax.swing.JRadioButton jRadioButton4;

private javax.swing.JRadioButton jRadioButton5;

private javax.swing.JRadioButton jRadioButton6;

private javax.swing.JSeparator jSeparator1;

private javax.swing.JSeparator jSeparator2;

private javax.swing.JTextField namef;

private javax.swing.JLabel namel;

private javax.swing.JTextField num;

// End of variables declaration

}

[15924 byte] By [student14a] at [2007-11-27 1:54:48]
# 1
the code is so longsorry, i' have no time to read it
MadFroga at 2007-7-12 1:26:59 > top of Java-index,Java Essentials,New To Java...
# 2
>>the code is so long sorry, i' have no time to read itDon't reply with such answers please. If you have no reason to post, don't post at all.
lethalwirea at 2007-7-12 1:26:59 > top of Java-index,Java Essentials,New To Java...
# 3
my code is not soo long but its for the interface all what i need to see the set and get methods may they have some problems and i don't know,
student14a at 2007-7-12 1:26:59 > top of Java-index,Java Essentials,New To Java...
# 4

Frogger is just pointing out that if you posted a short (<1 page) *example*

program that demonstrated your problem, you would get a lot more forum

members looking at your code and helping you.

There's no requirement that you must post your actual code. Most of it is

irrelevant to your question, anyway. So it's up to you. If you want some

help, show us that you're willing to do your share of the work and create

an example program we can copy, compile and run.

DrLaszloJamfa at 2007-7-12 1:26:59 > top of Java-index,Java Essentials,New To Java...
# 5

well, over half of it start here:

/** This method is called from within the constructor to

* initialize the form.

* WARNING: Do NOT modify this code. The content of this method is

* always regenerated by the Form Editor.

*/

// <editor-fold defaultstate="collapsed" desc=" Generated Code ">

is netbeans ide init code so...

hkirsmana at 2007-7-12 1:26:59 > top of Java-index,Java Essentials,New To Java...
# 6

you could initialize another window like this:

new MySecondWindow(this);

And in your second window

public class MySecondWindow extends javax.swing.JFrame {

public MySecondWindow(config parent) {

// here you can access i with parent.i

}

....

....

....

public login parent;

}

hkirsmana at 2007-7-12 1:26:59 > top of Java-index,Java Essentials,New To Java...