Note that there are some explanatory texts on larger screens.

plurals
  1. POModal JFrame on top of full screened JFrame
    primarykey
    data
    text
    <pre><code>package javaapplication1; import java.awt.Color; import java.awt.DisplayMode; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class JavaApplication1 { /** * @param args the command line arguments */ public static void main(String[] args) { final JFrame frame = new JFrame(); final NewJPanel p = new NewJPanel(); frame.setTitle("Frame"); frame.setSize(300, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); device.setFullScreenWindow(frame); device.setDisplayMode(new DisplayMode(800, 600, 32, 60)); JButton btn = new JButton(); btn.setText("Button"); JPanel panel = new JPanel(); panel.add(btn); frame.add(panel); btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFrame f = new JFrame(); JPanel p = new JPanel(); f.setSize(300, 300); p.setBackground(Color.red); f.add(p); f.setLocationRelativeTo(null); f.setAlwaysOnTop(true); f.setVisible(true); } }); } } </code></pre> <p>I wanted the <code>f.setVisible(true);</code> pops out inside the full screened JFrame which is set to be modal when I clicked the button. How can I do that? Because in that code, when I click the button, the <code>f.setVisible(true);</code> shows outside the full screen JFrame. Looking forward for your answers.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload