Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在同一个包中的另一个类中使用一个类中的 JTextFields 的值。
我该怎么做?
请改写你的问题!!我希望你想在其他类的文本字段中访问一个类的文本字段的值。
class Class1 { JTextField field1; public String getFieldText() { return field1.getText(); } } class Class2 { JTextField field2; Class2(Class1 c1) { field2.setText(c1.getFieldText()); } }