jdialog

java expandable JDialog

一曲冷凌霜 提交于 2019-12-21 06:17:03
问题 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

Set location of JDialog relative to JFrame

≡放荡痞女 提交于 2019-12-20 10:57:20
问题 Is there a way to set a dialog location relative to a JFrame ? I would like to center the dialog to the frame that houses my GUI, instead the dialog often appears in the center of the screen rather than within the GUI. 回答1: Is there a way to set a location relative to another JFrame You can: pass JFrame as argument for JDialog.setLocationRelativeTo(Component c) set to desired Point from JFrame to JDialog.setLocation(Point p) EDIT all Swing code must be done on EventDispatchThread, meaning

JFrame Glasspane is also over JDialog but shouldn't

谁都会走 提交于 2019-12-20 06:28:27
问题 I have a JFrame (undecorated) with a Glasspane. This Frame opens a JDialog (also undecorated and has also a glassPane) and hides itself (setVisible(false)). The Glasspanes are set with .setGlassPane(). The Dialog is opened with the Frame as owner. The GlassPane extends a JPanel and implements AWTEventListener. I use it for resizing the Frames and Dialogs, so it knows it's parent (the Frame/Dialog) - this is called "target". The Events inside the GlassPane are handled like this: public void

Make Java Swing Modal Dialog Behave Like Mac OSX Dialogs

风格不统一 提交于 2019-12-20 05:46:21
问题 I am writing a small app that requires a ProgressBar to appear centred under the frame's TitleBar as is often seen in Mac OSX apps. I have two problems: 1 . I have managed the positioning but I had to hard code the parent Frame's TitleBar height. Is there a 'soft' way to get the TitleBar's height? In the Dialog's constructor: Dimension dimensionParentFrame = parent.getSize(); Dimension dimensionDialog = getSize(); int x = parent.getX() + ((dimensionParentFrame.width - dimensionDialog.width)/2

Using JCalendar in a JDialog

巧了我就是萌 提交于 2019-12-20 05:45:23
问题 My program uses JDialog s to open up forms and in the form I want to use JCalendar for the user to select a date and for me to use it for other methods afterwards. I have downloaded JCalendar library. I read some example codes but still not sure how to do it. I have an idea that in the form you press a button (Select Date) and like a small window opens with that JCalendar and when the date is selected it is displayed in the form as a TextField. Can someone recommend me some method of doing

showOptionDialog buttons on separate lines

穿精又带淫゛_ 提交于 2019-12-20 03:01:13
问题 can't get the buttons in the OptionDialog to appear on a new line. They all appear in one row, but I'd like to have them on separate lines. I also tried setting up a frame to add to the OptionDialog (to set the max width), but it didn't work out for me either. Any ideas/help/suggestions appreciated. Object[] options = { "Button1", "Button2", "Button3", "Button4", "Button5 On a newLine\n\n", "Button 6", "Button 7" }; int x = JOptionPane.showOptionDialog(null, "Choose a button..", "Title",

How to check if a jframe is opened?

柔情痞子 提交于 2019-12-20 02:35:29
问题 My code below create a new array and sends it to chat(jFrame). String info1[]=new String[3]; // username , userid , userid2 are variables info1[0]=username4; info1[1]=""+userid; info1[2]=""+userid2; chat.main(info1); But i need to modify this code to work such a way that it , if the chat jframe was opened, then dont open a new jFrame .But instead open a new tab in chat jframe . The code for chat frame is : private void formWindowActivated(java.awt.event.WindowEvent evt) { JScrollPane panel2 =

Keep a jQuery dialog in a div

此生再无相见时 提交于 2019-12-20 01:12:02
问题 I am trying to create a number of jQuery dialogs but I would like to constrain their positions to inside a parent div. I am using the following code to create them (on a side note the oppacity option is not working either...): var d= $('<div title="Title goes here"></div>').dialog({ autoOpen: true, closeOnEscape: false, draggable: true, resizable: false, width: dx, height: dy }); d.draggable('option', 'containment', 'parent'); d.draggable('option', 'opacity', 0.45); $('#controlContent')

Font size of JDialog title

ⅰ亾dé卋堺 提交于 2019-12-19 18:57:10
问题 How do I set the font size of the title of a JDialog. I'm displaying JDialogs on extremely high resolution monitors (5 mega pixels), and the dialog titles are not legible. I need to do this on a per dialog basis because the application is multi-monitor, and some dialogs appear on lower resolution monitors, and some on higher resolution monitors. 回答1: You can play with setDefaultLookAndFeelDecorated() , but the title bar is not going to look native or like other normal dialogs, but you can try

Creating a custom blocking Java Swing prompt

与世无争的帅哥 提交于 2019-12-19 17:47:22
问题 This problem is solved. I'm am developing a Java Swing based projected, and the look & feel of the application is completely customized. We are trying to maintain a consistent appearance throughout the program, and the default Java dialog windows are not the same. The current issue requires a control blocking call to the user prompt. Similar to JOptionPane.showConfirmDialog() In this case, the static call produces a window, and halts the flow of the program until the user selects an option.