jdialog

Java, how can I popup a dialog box as only an image?

风流意气都作罢 提交于 2019-12-04 10:01:34
I'm trying to find a way to replace all the contents of a JDialog to simply an image. It's for the about page of a project I'm working on and I want when the user clicks on the About section, an image to popup in the style of a JDialog(and to disappear when focus is lost). Example: http://www.tecmint.com/wp-content/uploads/2012/08/About-Skype.jpg There Skype displays only an image they've created as their "About" page. How can I make an "image dialog" in Java(swing)? How can I make an "image dialog" in Java(swing)? Use an undecorated JDialog with a JLabel containing an ImageIcon: JDialog

Insert JDialog before frameview or main frame

China☆狼群 提交于 2019-12-04 06:22:05
问题 i want to add Jdialog before frameview...my frameview consist of my main page of application. i just want to add Jdialog which get password from user and then enter in the Main frame. can any one tell me how can i achieve this in java swing?? 回答1: MyMainPanel mainPanel = new MyMainPanel(); LoginPanel loginPanel = new LoginPanel(); JFrame mainApp = new JFrame(); mainApp.add( mainPanel ); mainApp.pack(); mainApp.setVisible(true); JDialog dialog = new JDialog( mainApp, true ); dialog.add(

Undecorated JDialog border

本秂侑毒 提交于 2019-12-04 05:13:20
I have a question regarding the border around an undecorated JDialog using the Metal L&F . Look at this picture to see the border that is on this window: I'm trying to figure out how to either get rid of or change the color of the blue border around the very outside of the JDialog . I looked at the UI defaults for the Look & Feel but I wasn't able to come up with any that worked for this. Does anybody have any ideas on how to get rid of that border? Thanks! camickr You need to change the Border of the root pane: getRootPane(). setBorder( BorderFactory.createLineBorder(Color.RED) ); If you want

Set dynamic JLabel text in a JDialog by timer

你。 提交于 2019-12-04 05:10:29
问题 Im trying to make a JDialog that will show the user a dynamic message on a JLabel. The message should be a count from 1 to 10 (and it should be changing a number every second). the thing is , when im debugging it - it's stops right after the "dia.setVisible(true);" , and will not proceed unless i will close the JDialog . is there any possible way of fixing it? Thanks. Take a look at the code : @Override public void run() { dia = new JDialog(parentDialog, true); dia.setLocationRelativeTo

How to figure out on which screen a JDialog is shown

ぐ巨炮叔叔 提交于 2019-12-04 04:57:51
I have a really big application which has multiple dialogs. My task is to make sure that a dialog, which is not completely visible (because the user pulled it out of the visible screen area) is moved back to the center of the screen. That's no problem when I'm dealing with one screen only. It works just fine ... however, most users of this application have two screens on their desktop ... When I try to figure out on which screen the dialog is shown and center it on that specific screen, ... well, it actually DOES center, but on the primary screen (which may not be the screen the dialog is

Disable JFrame when a new JFrame is opened

烈酒焚心 提交于 2019-12-04 03:39:48
问题 I am trying to disable the "main" JFrame when the new frame pops up. I want it so you can not click or drag anything on that frame. I tried making the new frame a JDialog , but that did not disable the other frame. I also looked at the other post about this, which suggested to make it a JDialog but it still does not work. I really need help doing this please. thanks. This is the codeIi am using to make the JDialog , is their any problems with it? editDialog=new JDialog(IntroScreen.frame);

java expandable JDialog

为君一笑 提交于 2019-12-03 20:29:35
For my application I have a JDialog which contains a JPanel with some basic JTextFields and JButtons . The idea is to have a button which expands the JDialog to reveal a second JPanel which contains some "advance" settings. I have achieved this with calling setPreferredSize() and pack() , but this isn't very elegant. An "elegant" solution would be to set the second Panel to be somehow null and therefore to get ignored by pack() when the toggle state is in "retracted". Sorry that I can't provide you with code (that thing is about 700 lies) but all it is like I said basically two JPanels in a

How can Swing dialogs even work?

有些话、适合烂在心里 提交于 2019-12-03 15:23:17
问题 If you open a dialog in Swing, for example a JFileChooser, it goes somewhat like this pseudocode: swing event thread { create dialog add listener to dialog close event { returnValue = somethingFromDialog } show dialog (wait until it is closed) return returnValue } My question is: how can this possibly work? As you can see the thread waits to return until the dialog is closed. This means the Swing event thread is blocked. Yet, one can interact with the dialog, which AFAIK requires this thread

What is the difference between a JFrame and a JDialog?

自作多情 提交于 2019-12-03 09:11:21
问题 What is the difference between a JFrame and a JDialog ? Why can't we use setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE); for a JDialog? 回答1: JFrame is a normal window with its normal buttons (optionally) and decorations. JDialog on the other side does not have a maximize and minimize buttons and usually are created with JOptionPane static methods, and are better fit to make them modal (they block other components until they are closed). But both inherit from Window, so they share much

How can Swing dialogs even work?

此生再无相见时 提交于 2019-12-03 04:58:51
If you open a dialog in Swing, for example a JFileChooser, it goes somewhat like this pseudocode: swing event thread { create dialog add listener to dialog close event { returnValue = somethingFromDialog } show dialog (wait until it is closed) return returnValue } My question is: how can this possibly work? As you can see the thread waits to return until the dialog is closed. This means the Swing event thread is blocked. Yet, one can interact with the dialog, which AFAIK requires this thread to run. So how does that work? It's the AWT's thread, not Swing's. Anyway, AWT runs the dispatch loop