Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I've a Job with 2 Tjava at the end. In those Tjava I've written some custom code that will check some data in given tables and if I encounter an anomlay, I've set up to display a message box using Jpane. The problem rises when the msgbox is not showed in the first layer, but is instead overlayed by all the windows.
Since I've got a plenty of this cheks, I've used some routines to semplify the process of using lot of tmsgBox.
Is there a way to let the message appear in front of all the windows?
Thanks
Hello @matteo marchesi
I can't tell why the JPanel is being overlayed by all other windows without looking at your code, but what I usually do is use a JPanel inside a JFrame and it works pretty well. Here's an example:
JFrame frame = new JFrame("Window");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//frame.setLayout(new GridLayout(7, 2, 10, 10)); // 7 rows, 2 columns, with gaps
// Create a JPanel with a BorderLayout
JPanel panel = new JPanel(new BorderLayout());
panel.setLayout(new GridLayout(7, 2, 10, 10));
frame.add(panel);
//panel content goes here
frame.pack();
frame.setLocationRelativeTo(null); // center the window
frame.setVisible(true);
frame.setSize(400, 300); //set window size
frame.setResizable(false);
I hope it helps.
Best regards,
Anselmo
Hello @matteo marchesi
I can't tell why the JPanel is being overlayed by all other windows without looking at your code, but what I usually do is use a JPanel inside a JFrame and it works pretty well. Here's an example:
JFrame frame = new JFrame("Window");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//frame.setLayout(new GridLayout(7, 2, 10, 10)); // 7 rows, 2 columns, with gaps
// Create a JPanel with a BorderLayout
JPanel panel = new JPanel(new BorderLayout());
panel.setLayout(new GridLayout(7, 2, 10, 10));
frame.add(panel);
//panel content goes here
frame.pack();
frame.setLocationRelativeTo(null); // center the window
frame.setVisible(true);
frame.setSize(400, 300); //set window size
frame.setResizable(false);
I hope it helps.
Best regards,
Anselmo
Thank you @Anselmo Peixoto, I've missed the "frame.setVisible(true);" line.
Using that, now my panel is showed with priority over the other windows.
Thanks