Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there any default java class for a Popup JDialog?
    primarykey
    data
    text
    <p>I have been using this code to implement a <code>Popup</code> <code>JDialog</code> of sorts, like what you see when your anti-virus is scanning your system or updates itself:</p> <pre><code>import java.awt.*; import javax.swing.JDialog; import javax.swing.JLabel; public class PopupDialog extends JDialog { public PopupDialog() throws HeadlessException { createUI(); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { PopupDialog popupDialog = new PopupDialog(); popupDialog.setVisible(true); } }); } private void createUI() { setTitle("Popup Dialog"); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); addComponentsToFrame(); //This call will give screens viable area, which takes into account the taskbar, which could be at the bottom, top,left or right of the screen. Rectangle maxBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); //get screen size int sWidth = maxBounds.width, sHeight = maxBounds.height; setSize(275, 225);//set frame size Dimension appDim = getSize(); //get app size int aWidth = appDim.width, aHeight = appDim.height; //set location like a tooltip would be except its a custom dialog like an AV setLocation(sWidth - aWidth, (sHeight - aHeight)); } private void addComponentsToFrame() { JLabel label = new JLabel("Popup Dialog"); getContentPane().add(label, BorderLayout.CENTER); } } </code></pre> <p>But my question is: is there any class or package in java that will do this for me? and if not how would I go about allowing the JDialog to <code>slide</code> up from the taskbar (or offscreen)? or somehow become visible in a slow manner like a <code>ToolTip</code> Popup would from the system tray. Thanks.</p> <p>EDIT The reason i want to use a JDialog or Frame is because i want to be able to fully skin the Popup window, using <code>setUndecorated(true);</code> and adding custom exit icons, backgrounds etc</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.
 

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