jdialog

can I make JDialog to be modal using native system window as a parent?

早过忘川 提交于 2019-12-11 03:17:59
问题 I have a JDialog window. I need to make it modal, but the parent is not Java window, but native Windows OS window. Is it possible? 回答1: No, you can't. You cannot even achieve reference not only to native windows but even to windows created by java application running in other JVM. But you can create dummy window (Window, not Frame or JFrame), set its size as 0 and use it as an parent to any dialog. I do not know what is your concrete problem but sometimes the way I mentioned may help. 来源:

JDialog: Remove titlebar, keep border

China☆狼群 提交于 2019-12-11 02:54:06
问题 Is it possible to remove the title bar from a JDialog, but keeping the border? The base SSCCE looks like this: package test; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.SwingUtilities; public class SSCCE extends JFrame { private JDialog dialog; public SSCCE() { dialog = new JDialog(); dialog.setSize(100, 100); dialog.add(new JList<>(new String[] { "One", "Two", "Three" })); dialog.setUndecorated(true); setSize(300, 200);

Java GUI - JOptionPane/JDialog customization issue

℡╲_俬逩灬. 提交于 2019-12-11 02:35:59
问题 So I'm trying to make a simple dialog where the user can input some information... My problem is that I'm trying to make the whole background white; I got MOST of it, but there's a gray line behind the buttons that I don't know how to fix (make white as well). How can I fix it? :( What it looks like: What I want: Code: JPanel all = new JPanel(); all.setLayout(new BorderLayout()); all.add(names, BorderLayout.NORTH); all.add(academic, BorderLayout.CENTER); all.setBackground(Color.WHITE); all

How to completely remove an icon from JDialog?

喜你入骨 提交于 2019-12-11 02:29:25
问题 I am creating a dialog for showing a progress of files' copying. What I want to do is to completely remove dialog's icon image. I created such kind of dialogs before providing an application's instance of FrameView as an argument for JDialog 's constructor like this: public class MyAppView extends FrameView { // ... @Action public void showOptionsDialog() { // Creating modal options' dialog JDialog optionsDialog = new JDialog(this, true); // ... } } So, as I can see, I need a parent component

Java Fullscreen Modal Dialogs

匆匆过客 提交于 2019-12-10 22:14:07
问题 How does one create a custom modal JDialog that can be used as an internal dialog? For use in FullscreenExclusiveMode. I have a JScrollPane (with a huge scrollbar) full of huge buttons like so: +----------------------+------+ | FOO | /\ | |______________________+------+ | |______| | BAR | | |______________________| == | | |______| | BIZ | | +______________________+------+ | | \/ | |----------------------+------+ I need the user to use the giant scrollbar to scroll through and tap a particular

JDialog.setAlwaysOnTop(true) brings all dialogs to the front under Windows

我是研究僧i 提交于 2019-12-10 18:11:56
问题 I create two dialogs: DialogA: setVisible(true) called only once. DialogB: setVisible(true) and setAlwaysOnTop(true) called every 1,5 sec Windows: Each call to dialogB.setAlwaysOnTop(true) brings dialogA AND dialogB to the front. OSX: Each call to dialogB.setAlwaysOnTop(true) brings only dialogB to the front. (Expected Behaviour) Test Case (Windows): 1 I start the application from my IDE. 2 I see DialogA. 3 I click in the IDE and DialogA disappears. 4 After one second DialogA and DialogB will

Setting JDialog opacity by Timer

浪尽此生 提交于 2019-12-10 15:45:29
问题 I am using the following code to fade-in a JDialog with a javax.swing.Timer : float i = 0.0F; final Timer timer = new Timer(50, null); timer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (i == 0.8F){ timer.stop(); } i = i + 0.1F; setOpacity(i); } }); timer.start(); The Dialog is nicely faded-in with the desired effect but at last, an IllegalArgumentException Occurs saying that: The value of opacity should be in the range [0.0f .. 1.0f] But

`WindowListener` acting up, perpetual firing

对着背影说爱祢 提交于 2019-12-10 14:53:49
问题 I have an application with an abstract class that extends JDialog . The class as an abstract void onClose() , and, in the class's constructor, the following code is added: addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { onClose(); } } The event is fired when expected, but then a strange thing happens. When a concrete extension of this class has code to create a new JDialog in the onClose() method, and this JDialog 's defaultCloseOperation is JDialog

Can I make ProgressMonitor dialog modal?

对着背影说爱祢 提交于 2019-12-10 03:15:00
问题 is there a way to make the dialog from ProgressMonitor modal? EDIT: The ProgressMonitor class in JAVA API will bring a dialog which is on the top but not Modal. User still has access to the background GUI. I am looking for a Modal dialog to show the progress and also allow user to stop the task in the middle. 回答1: As discussed in How to Use Progress Monitors, a number of factors should be considered when Deciding Whether to Use a Progress Bar or a Progress Monitor. As an implementation detail

Undecorated JDialog border

情到浓时终转凉″ 提交于 2019-12-09 16:55:29
问题 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! 回答1: You need to change the Border