jdialog

Java setLocation() mishap

大城市里の小女人 提交于 2020-01-03 17:09:58
问题 I'm in the beginning stages of creating a program to operate an Employee/Customer system, right now I have just created the Login GUI, but I am having a little bit of a problem with the setLocation(); method. I set it to 250, 250, but it makes the height of my GUI go absolutely nuts. My code is below if anyone would be able to fix this. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Main extends JFrame { private static final int HEIGHT = 1003; private static

Is there a way to change the owner of a JDialog?

一个人想着一个人 提交于 2020-01-03 09:10:10
问题 I have a very specific problem, and I wanted to know if there is a way to change the owner of a JDialog (it can be set using the constructor). I suppose there is no "official" possibility (other than a hack), but I wanted to make sure I didn't miss something. Any ideas or hints on the topic would be helpful, thanks already... 回答1: If your question is about how to reuse dialogs during your application lifecycle, then a better way is to: define all your dialog contents as JPanel subclasses and

How do I create a JOptionPane.showOptionDialog box in Java (Swing) with custom JButtons?

守給你的承諾、 提交于 2020-01-02 11:03:10
问题 After reading through all the Dialog tutorials for a while, there seems to be no apparent way to do this. The closest thing seems to be JOptionPane.showOptionDialog , but I am limited by the optionType parameter here. EDIT: I figured out the problem, but have a new one. It seems that the options parameter being specified in showOptionDialog needs to be fairly simple objects (strings or just 'objects', not JButton or the like). I was trying to put an array of custom-factory-created JButtons

How to make a modal JDialog execute code immediately upon being shown

微笑、不失礼 提交于 2020-01-02 07:41:41
问题 Ok, I have a list of objects. I need to show a Modal JDialog and then pass it this list of objects and have it act on them. The problem is that when I call .show() it hijacks the EDT. The ideal situation would be to be able to pass the list in to the constructor and then when the dialog is shown, execute the function in question. In C# I'd use the Loaded event for this, but how to do it a JDialog escapes me. Thoughts? 回答1: JDialog dialog = new JDialog(...); ... dialog.addComponentListener(new

How to figure out on which screen a JDialog is shown

会有一股神秘感。 提交于 2020-01-01 09:32:10
问题 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, ...

JDialog Stops execution of parent JFrame

孤街醉人 提交于 2019-12-31 05:40:47
问题 I have a gif animation image that is showing infinite circle loading progress inside a jDialog...But problem is when i load this jDialog the parent frame codes is halt.? how to do this..here is my code.. ProgressDialouge pbDialog = new ProgressDialouge(this); pbDialog.setVisible(true); pbDialog.toFront(); postPairs.add(new BasicNameValuePair("PATH","authenticateUser.idoc")); postPairs.add(new BasicNameValuePair("user_email",email)); postPairs.add(new BasicNameValuePair("user_password"

show two dialogs on top of each other using java swing

落花浮王杯 提交于 2019-12-31 04:50:10
问题 i have a situation where i show a dialog where user has to fill some menus and then press OK. It works fine, but now i have another button on this dialog that if user wants to add some certain value, i want another dialog to popup where user fills the additional value and while pressing ok, this dialog disappears and user comes back to the main dialog. I have tried this, but every time i call the new dialog, the focus does not go away from the main dialog, how can i do such a task. Is there

How to hide JDialog from JApplet when user switch browser tab?

╄→гoц情女王★ 提交于 2019-12-30 22:59:56
问题 Problem: user starts long operation from applet; JDialog with progress bar is displayed. User open/switch to another browser tab - JDialog is still displayed (and annoys user). JDialog should be hidden when user switch to another tab; and displayed again, when user switch back. Note: I saw question with similar problem, where solution was add windowActivated/deactivated listener. It doesn't work for me, because there are multiple frames in window, and one of them contains applet. When user

When creating a dialog with jquery, how do I hide the dialog div?

倖福魔咒の 提交于 2019-12-28 13:46:10
问题 I am creating a dialog like in this page: http://jqueryui.com/demos/dialog/#modal-confirmation (click view source) on the bottom is the div that gets placed in the dialog. The dialog works perfect when called by the javascript but the dialog is apparent at the bottom of the page when it loads. (minus all the styling that gets applied when it is called by the javascript function) How can I hide the div and still allow the dialog to use it? I have tried setting style="visibility:hidden" but

How can I return a value from a JDialog box to the parent JFrame?

情到浓时终转凉″ 提交于 2019-12-28 08:07:09
问题 I have created a modal JDialog box with a custom drawing on it and a JButton. When I click the JButton, the JDialog box should close and a value should be returned. I have created a function in the parent JFrame called setModalPiece, which receives a value and sets it to a local JFrame variable. The problem is that this function is not visible from the JDialog box (even though the JDialog box has a reference to the parent JFrame). Two questions: 1) Is there a better way to return a value from