0
我想知道,如果有可能,每JObjects保存在一個類和another.Something使用這樣的:保存JObjects在一個類和另一個使用(初級)
這是mainc類:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
public class Main extends JFrame implements ActionListener {
public static void main(String[] args){
new Main();
}
public Main(){
field = new JTextField(12);
button = new JButton("Click");
add(field);
add(button)
setTitle("main");
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(920, 420);
setLocation(100, 100);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent ae) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
和第二類另存:
// all imports
public class Save{
public JTextField field;
public JButton button;
}
明白了很多 –