jdialog

Is really not possible remove on Runtime any of JDialog or JWindow [closed]

为君一笑 提交于 2019-12-08 13:33:03
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . as I tried, looks like as that isn't possible, without success as I tried, or exist there another way? import java.awt.*; import java.awt.event.WindowEvent; import java.util.logging.Level; import java.util

JTextArea-Dialog as JTable-CellEditor misses first typed character

允我心安 提交于 2019-12-08 06:01:28
问题 We need a CellEditor for a JTable for editing a large multiline-text. We tried using a popup visually extending the TableCell , which was overlapping the cells to the right and bottom. This led to various problems if the cell was in the right bottom corner, near the screen-boundaries, etc. Then we decided to use a modal JDialog for editing the cell-value. So the users could move the dialog around, and we could persist its size and position. Now the problems started ;-) We are not able to

JInternalFrame As Modal

狂风中的少年 提交于 2019-12-07 18:07:28
I Have the following code: import java.awt.AWTEvent; import java.awt.ActiveEvent; import java.awt.Component; import java.awt.EventQueue; import java.awt.MenuComponent; import java.awt.event.MouseEvent; import javax.swing.JInternalFrame; import javax.swing.SwingUtilities; public class modalInternalFrame extends JInternalFrame { // indica si aquest es modal o no. boolean modal = false; @Override public void show() { super.show(); if (this.modal) { startModal(); } } @Override public void setVisible(boolean value) { super.setVisible(value); if (modal) { if (value) { startModal(); } else {

Swing modal dialog refuses to close - sometimes!

▼魔方 西西 提交于 2019-12-07 04:38:01
问题 // This is supposed to show a modal dialog and then hide it again. In practice, // this works about 75% of the time, and the other 25% of the time, the dialog // stays visible. // This is on Ubuntu 10.10, running: // OpenJDK Runtime Environment (IcedTea6 1.9) (6b20-1.9-0ubuntu1) // This always prints // setVisible(true) about to happen // setVisible(false) about to happen // setVisible(false) has just happened // even when the dialog stays visible. package modalproblemdemo; import java.awt

wait for jdialog to close

て烟熏妆下的殇ゞ 提交于 2019-12-07 02:46:48
问题 I have a class FilePathDialog which extends JDialog and that class is being called from some class X. Here is a method in class X projectDialog = new FilePathDialog(); projectDialog.setVisible(true); projectDialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.out.println("Window closing"); try { doWork(); } catch (Throwable t) { t.printStackTrace(); } } public void windowClosed(WindowEvent e) { System.out.println("Window closed"); try { doWork(); }

JTextArea-Dialog as JTable-CellEditor misses first typed character

僤鯓⒐⒋嵵緔 提交于 2019-12-06 15:40:08
We need a CellEditor for a JTable for editing a large multiline-text. We tried using a popup visually extending the TableCell , which was overlapping the cells to the right and bottom. This led to various problems if the cell was in the right bottom corner, near the screen-boundaries, etc. Then we decided to use a modal JDialog for editing the cell-value. So the users could move the dialog around, and we could persist its size and position. Now the problems started ;-) We are not able to "forward" the first typed character to the Dialog. There are many examples on stack overflow, where this

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

若如初见. 提交于 2019-12-06 11:52:53
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 here, because they have a special rollover icon that I want to be using. What happens, though, is that

Dynamically change the width of JDialog

孤人 提交于 2019-12-06 10:59:47
I have created a JDialog which contains a JLabel. Because the length of text, which changes based on users' input, can contain a large number of characters, there is the need to dynamically change the length of the JDialog based on the size of length of the JDialog. I have tried the pack() method but it's not the case for it. Can anyone give me some tips? Thanks in advance! mKorbel getPreferredSize for JLabel - basically you have to get textLength from JLabel in pixels, there are 3 correct ways, but I love: SwingUtilities.computeStringWidth(FontMetrics fm, String str) Now you are able to

JDialog not showing minimize/close button

时间秒杀一切 提交于 2019-12-06 07:09:32
When researching the problem, it seems most people are wanting to do the opposite (i.e remove the minimize/close button). I've had no success using the reoccurrent setUndecorated and setDefaultCloseOperation Here is my code: private class TestDialog extends JDialog { public static final String title_ = "Test Dialog"; public TestDialog(JFrame parent) { super(parent,title_,true); setMinimumSize(new Dimension(500,500)); setLocationRelativeTo(null); setUndecorated(false); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); } } When I display the dialog I get the following: Other info: OS:

Java return from a ShowOptionDialog from an inner JPanel

China☆狼群 提交于 2019-12-06 02:41:36
I used JOptionPane.showOptionDialog(null, new MyPanel(), "Import", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{}, null); because I don't want the default buttons provided by the OptionDialog and I created my buttons inside the MyPanel extends JPanel So my problem is now how can I close that OptionDialog from inside the MyPanel fired by an ActionEvent ? I don't care the return value, as long as that dialog disappears. And I realize this might not be the best design but I've been working on this for a lot of times so I'd prefer a fix that involves as little change