我有一个主要JFrame
由 3 个小的组成,JPanel
它们根据用户的选择进行切换。
问题是我必须保存插入到JPanel
数据库中的数据,但我无法直接访问其中的元素JPanel
。那么我该如何接受这些。
当在主框架中单击 ACCEPT 按钮时,DB 中的条目就完成了。请帮忙
if(Selected==Credit Card){
Select Credit Card Panel;
}
if(Selected==Debit Card){
Select Debit Card Panel;
}
if(Selected==Cash on Delivery){
Select Cash on Delivery Panel;
}
onAccept(){
if(Selected==Credit Card){
get data from Credit Card panel and store in Database; (variables like cc number, cvv)
}
if(Selected==Debit Card){
get data from Debit Card panel and store in Database;
}
if(Selected==Cash on Delivery){
get data from Cash on Delivery Card panel and store in Database;
}
}