jdialog

JDialog disposing another window

一曲冷凌霜 提交于 2019-12-11 17:54:44
问题 I'm currently working on a java game which opens up with a "start screen" frame. In the startscreen, I have a button called buttonLogin. Once you press buttonLogin, a login dialog launched by a LoginDialog class will pop up asking you for a username and password. In the dialog there are two buttons, login and cancel. Once you press login, my game will open, but the start screen is still visible. My problem is that I do not know how to write code in the actionPerformed method of my LoginDialog

How to call a jdialog from a jinternalframe

最后都变了- 提交于 2019-12-11 13:17:47
问题 I have an internalframe, i want to create an evenet private void errorTableMouseClicked(java.awt.event.MouseEvent evt) { PaneDialog dlg = new PaneDialog(**this**,true); } now the PaneDialog is an JDialog, i cant put the constructor "this" cus "this" is InternalFrame so Netbeans shows an error incompatible types, PaneDiaglog can not be converted to Frame, how i call the JDialog in internalframe? 回答1: Maybe you can use one of the JOptionPane.showInternal???(...) methods since they only need a

JDialog fails to pack(), only sometimes

瘦欲@ 提交于 2019-12-11 12:46:35
问题 I have written a nifty thing in Java with a GUI that includes a JDialog that starts out rather small and then uses pack() to accommodate things the progam later puts in it. All of this is going on before the JDialog renders. Then, to my surprise, about 80% of the time, when I run it, the window fails to resize. It seems to be entirely random, as it's theoretically doing exactly the same thing every time. Why on Earth would it do something different with the same code on the same machine five

Modal Window on top of Modal Window in java swing?

懵懂的女人 提交于 2019-12-11 09:47:54
问题 I have the following problem: I have a main application window (JFrame) that fills the whole screen. When a button is clicked, a smaller window appears, to let the user input some Data. While the User does this, the main window should neither jump in front of it, nor allow interaction. Solution to that: open a modal JDialog. Lets call that Dialog 1. But when a button within this Dialog is clicked, a NEW window (yes/no-dialog) is supposed to pop up.. and, again, needs to act modal on the

Get height of JDialog title bar?

柔情痞子 提交于 2019-12-11 08:30:43
问题 How can I get the height of JDialog title bar? I've tried with getInsets().top , but it returns 0 . 回答1: I don't know if, if you're using OS's own window manager, this may not be possible. The reason is that, the title bar is drawn outside Java. If you really need this information you will probably need to use JNI. However, if you are using internal frames, you can do the following JInternalFrame mydialog = new JInternalFrame(); ((BasicInternalFrameUI)mydialog.getUI()).getNorthPane()

In Model-View-Controller, Why change in model, doesn't trigger the change in view?

为君一笑 提交于 2019-12-11 08:23:39
问题 I am currently developing my own minesweeper. Swing follows Model-View-Controller design pattern. In MVC , I learnt whenever there is a change in model, the controller will trigger that change in view too . But In this example, I cannot trace how to make the changes in setTitle and setInfo to get reflected in view. Here, when I set the title of the Dialog box, the actual content(model) is getting changed, But there is no corresponding change in the output(view). //InfoDisplayer is inner class

JTextField in JDialog retaining value after dispose

十年热恋 提交于 2019-12-11 08:19:20
问题 I'm having a JTextField problem. I am needing to get text from a JTextField and modify it later in a JDialog. I am using the same variable for the JTextField. As long as you don't enter the dialog, the string printed is whatever you entered in the text field. If you enter a string in the dialog, it will only print that string until you change it again in the dialog (renders the primary text field useless). I can fix this by adding a separate variable, but would like to try to avoid

Pressing Yes/No on embedded JOptionPane has no effect

南楼画角 提交于 2019-12-11 07:54:45
问题 I'm trying to add an exit confirmation check to JFrame but I want the dialog to be undecorated. I've figured I need to use custom JDialog and custom JOptionPane. frame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { JDialog dialog = new JDialog(); dialog.setUndecorated(true); JOptionPane pane = new JOptionPane("Are you sure that you want to exit?", JOptionPane.QUESTION_MESSAGE,JOptionPane.YES_NO_OPTION);

Java applet JTextField inaccesible after JDialog on Ubuntu

。_饼干妹妹 提交于 2019-12-11 04:02:47
问题 I have 2 problems with java on Ubuntu: JTextField gets inaccessible and you cant type anything in it. To reproduce you have to click on label ('Click this label') it will open my extended JDialog. After closing it with Cancel button JTextField gets inaccessible. The problem is that it doesen't happen all the time. I think around 1 on 10 tries. When it happens you have to click somewhere else on browser window or open dialog one more time. Second problem is that when ubuntu opens JDialog it

JDialog modal problem java gui

不问归期 提交于 2019-12-11 03:54:53
问题 I have this code which runs without any errors but it isn't running the way I planned. I'm trying to figure out why my "Continue" button is not being displayed when I click the button labeled "important!!". The only thing which is being displayed is a blank pop up window which is part of the code JDialog and it set to modal and visible. I just can't figure it out. If anyone can help me I would appreciate it a lot. JPanel hehePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT,10,20)); JDialog