currently i am facing a problem for these method. when my program copying or cutting a selected text and paste to another selected area, unexpected result, it paste the selected text to all of the fields and areas of my program.
is there anyway to check current selected area or maybe there is other way out to solve this problem?
*equipmentArea and area are objects of JTextArea
* the rest are objects of JTextField
MainTabbed mPane = new MainTabbed();
.
.
.
.
class CopyActionAdapter implements ActionListener{
UIAFrame adaptee;
//JTextArea jTextArea = new JTextArea(textArea);
CopyActionAdapter(UIAFrame adaptee){
this.adaptee = adaptee;
}
public void actionPerformed( ActionEvent e )
{
mPane.locField.copy();
mPane.area.copy();
mPane.dateField.copy();
mPane.ndBuddyField.copy();
mPane.depthField.copy();
mPane.firstBuddy.copy();
mPane.weightField.copy();
mPane.timeInField.copy();
mPane.tOutField.copy();
mPane.startTimeField.copy();
mPane.sTimeField.copy();
mPane.bTimeField.copy();
mPane.startField.copy();
mPane.finishField.copy();
mPane.airField.copy();
mPane.surfaceField.copy();
mPane.bottomField.copy();
mPane.equipmentArea.copy();
mPane.waterTypeField.copy();
mPane.visiField.copy();
mPane.diveLogField.copy();
mPane.diveNoField.copy();
}
}
class PasteActionAdapter implements ActionListener{
UIAFrame adaptee;
//JTextArea jTextArea = new JTextArea(textArea);
PasteActionAdapter(UIAFrame adaptee){
this.adaptee = adaptee;
}
public void actionPerformed( ActionEvent e )
{
mPane.area.paste();
mPane.locField.paste();
mPane.dateField.paste();
mPane.ndBuddyField.paste();
mPane.depthField.paste();
mPane.firstBuddy.paste();
mPane.weightField.paste();
mPane.timeInField.paste();
mPane.tOutField.paste();
mPane.startTimeField.paste();
mPane.sTimeField.paste();
mPane.bTimeField.paste();
mPane.startField.paste();
mPane.finishField.paste();
mPane.airField.paste();
mPane.surfaceField.paste();
mPane.bottomField.paste();
mPane.equipmentArea.paste();
mPane.waterTypeField.paste();
mPane.visiField.paste();
mPane.diveLogField.paste();
mPane.diveNoField.paste();
}
}