I am working on a barcode application which has in its main GUI a tabbed pane that contains many panels where one of this panels is for the cashier, the problem is that when the cashier panel is displayed i need to always set focus on the textfield where the barcode must be inserted.
requestFocusInWindow()
or requestFocus()
does not work since I am in the same jframe
and in the same jTabbedPane
but i am choosing panels inside this tabbedpane
what i need is when i move to a specific panel which is "cashier panel" is always to set focus on a certain textfield
thanks.
private void MainTabbedPaneStateChanged(javax.swing.event.ChangeEvent evt) {
if(CashierPanel.isShowing()){
Barcode_txt.requestFocus();
}
}