Java Execution Pops a New Window and Immediately Disappears

Application closes immediately after opening

You never call setVisible(true) on a top level window, the ServerFrame.this JFrame, and so the event thread is never really started.

After adding all your components to the ServerFrame, simply call setVisible(true) on it. ..... or in the main method, do:

new ServerFrame().setVisible(true);

Another issue: While null layouts and setBounds() might seem to Swing newbies like the easiest and best way to create complex GUI's, the more Swing GUI'S you create the more serious difficulties you will run into when using them. They won't resize your components when the GUI resizes, they are a royal witch to enhance or maintain, they fail completely when placed in scrollpanes, they look gawd-awful when viewed on all platforms or screen resolutions that are different from the original one.

Also, be sure to start your GUI on the Swing event thread, otherwise you risk running into occasional and hard to debug threading errors. e.g.,

public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
new ServerFrame().setVisible(true);
});
}

JSF-dialog disappears instantly

Could it be that the page is refreshing right after the dialog is shown? I would suggest trying to use the primefaces commandLink rather than the native jsf commandLink since the primefaces commandLink has ajax=true set by default I believe.

change <h:commandLink... to <p:commandLink...

Command line Java run from the terminal on Mac pops up Java window in the Mac dashboard which disappears after the jobs is done

I figured it out. On a Mac it looks like I have to add this to the command line:

-Dapple.awt.UIElement=true

Which allows it to be run headless and will not pop up the java window in the dashboard.

How to make the main GUI thread 'wait' until a separate pop-up window is disappeared

Don't use a separate JFrame for this is what modal dialogs were built for. Use either a JOptionPane or a modal JDialog.

Eclipse opens and then immediately closes after graphic appears

Step 1: Open Command Prompt as Administrator

Step 2: Change Your Directory to eclipse folder

Run

Step 3: eclipse -clean -clearPersistedState

Done!



Related Topics



Leave a reply



Submit