I have a frame that contains a "Compute" button, When I click on the button compute there is a treatment that opens a dialog and a frame. But are below the first frame.
I tried to add setAlwaysOnTop(true) but the frame and dialog that opens remain in the foreground, and the user is forced to close them to return to the previous frame.
Here below the Compute action :
public T compute(){
//Some code
HistogramView hv = new HistoGramView(owner, graph);
AdjustDepthMapDialogVarioMap admap = new AdjustDepthMapDialogVarioMap(owner,text);
}
public class HistogramView extends OwnerJFrame{
//Code
}
public class OwnerJFrame extends JFrame{
//Code
}
public class AdjustDepthMapDialogVarioMapextends OwnerJDialog{
//Code
}
public class OwnerJDialog extends JDialog{
//Code
}
Here is the constructor of HistogramView class :
public HistogramView(Component parent, Graph graph) {
super("Histogram View");
graphPanel = new GraphPanel (graph);
setLocationRelativeTo(parent);
setTitle("Histogram ");
setSize(550, 850);
pack();
setVisible(true);
}
Here is the constructor of AdjustDepthMapDialogVarioMap class :
public AdjustDepthMapDialogVarioMap(Component parent, String text){
try {
text= text;
pack();
setVisible(true);
}
when the dialogue opens, it must actually open in the foreground. On the other hand, we d'ont want to force it to remain in the foreground (the user must be able to hide it by another dialog if he wishes).
There is a solution without this use of setAlwaysOnTop ?
this.setAlwaysOnTop(false); new HistogramView().setVisible(true);. You may want to consider a design change and open your windows within the parent JFrame in which case you may want to consider using JInternalFrame's.