Should swing JFrame - I use threads or JDialogBox (or both!)?
HelloI create a game in which several pieces may be on a site, and when you click on this square, I want a pop up window and allow the user to select from a list of parts.
The list of the selected pieces would return to the main program when the window is closed. When the window is opened, I would like to suspend the execution of the program.
So, copy the following code essentially illustrates the basics of my dilemma.
public class JBegin {
public static void main(String[] args){
customFrame newFrame= new customFrame(0);
}
}
(code}
to import java.awt.Dimension;import java.awt.event.MouseEvent;
java.awt.event.MouseListener import;
to import javax.swing.JFrame;
public class customFrame extends JFrame implements {MouseListener
int x = 0, y = 2, z;
public customFrame (int layer) {}
z = + 1 layer.
addMouseListener (this);
this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
this.setVisible (true);
this.setSize (New Dimension (1000, 1000));
}
@Override
{} public void mouseClicked (MouseEvent arg0)
TODO self-generating method stub
subset of customFrame = new customFrame (z);
freeze the previous window
wait customFrame close
get the values of subset.
x = y * 2 + z;
}
@Override
{} public void mouseEntered (MouseEvent arg0)
TODO self-generating method stub
}
@Override
{} public void mouseExited (MouseEvent arg0)
TODO self-generating method stub
}
@Override
{} public void mousePressed (MouseEvent arg0)
TODO self-generating method stub
}
@Override
{} public void mouseReleased (MouseEvent arg0)
TODO self-generating method stub
}
}
In the customFrame class, after the mouse button has been clicked, I want the code to wait for the new customFrame window to be closed before evaluating the equation.
I've done some reading, and I've heard that JDialog will accomplish most things a JFrame will (Though I haven't been able to find any tutorials on how to paint in JDialog). I also may be hesitant because I have some classes which are configured wonderfully for a JFrame.
In any case, would threads or a JDialog box be a more appropriate way to solve this problem? And if it is the JDialog option, do you know of a good JDialog painting tutorial (as, obviously, I've been having trouble finding one)?
Thanks for all your time and advice
Thus, it seems that JDialog is not slow down the progression of the code.
Yes, he does, that's why I suggested it. Of course he could help if I spelled "modal" OK, if you could watch the API to see what method you use to define a modal dialog box.
You can also use a JOptionPane, which simply creates a JDialog formatted for you.
The choice is yours.
Tags: Java
Similar Questions
-
Should what format I use for my external hard drive?
I have an external drive that I wish I could use (writing) from my Mac and my PC, but without the limitations of + 4 GB files.
Is this possible or am I pasted with limiting the size? If so should what format I use on my external hard drive? and it has all the other notes aside I should know?
Thank you!
Hi Filabaca:
If you want to use a hard drive external Mac and PC options are:
1. format the drive in Mac as exFat
2. format the drive to NTFS on a Windows PC and use a program like Paragon NTFS for Mac. https://www.Paragon-Software.com/home/NTFS-Mac/
Paragon NTFS for Mac allows you to use a disc formatted in NTFS by a Windows PC.
Here is an article showing the difference between FAT32, exFAT and NTFS. http://www.howtogeek.com/235596/whats-the-difference-between-fat32-exfat-and-ntf s /
Kim
-
Should what format I use for my external drive for time machine? I have a WD 2 TB that is formatted for PC new drive. When I got to disk utilities to erase, and then reformat the options are
1 mac OS extended (journaled)
2 mac OS extended (journaled, encrypted)
3 mac OS Extended (respect for case-sensitive, journaled)
4 mac OS extended (case-sensitive, journaled, encrypted)
See the information below If you can not back up or restore your Mac with the help of Time Machine - Apple Support
When you select a drive to use with Time Machine, your Mac automatically prompts you if you need to reformat the drive.
- If you are using an external drive connected to your Mac, use disk utility to make sure that your backup disk is formatted in HFS + extended (journaled) and is the partition type GUID Partition Table (GPT).
- If you use a time Capsule, formatting the drive for Time Machine preferences automatically formats the drive as HFS + Extended (respect for case-sensitive, journaled) with a GUID Partition Table (GPT).
-
Should which library I use to remove old photos? iPhoto or Photos?
If you migrated a library iPhoto to Photos and you want to release the storage, you should remove the pictures of these two libraries.
Related photos storage only comes out, after that the last linked file has been deleted. If you do not use more of the iPhoto library, move it to a backup drive. Then simply delete the photos of your new photo library.
-
should what software I use to burn the iso file of windows xp?
should what software I use to burn the iso file of windows xp?
I like ImgBurn.
-
should this progam I use to run my rocket
should this progam I use to run my rocket
help pliz
Or if you want to sync, you can use Windows Media Player, Media Monkey, Rhapsody, Winamp.
-
What should I do to use the Windows Fax and Scan of my computer at home for my work fax #?
What should I do to use the Windows Fax and Scan of my computer at home for my work fax #?
Original title: Windows Fax and Scan
What should I do to use the Windows Fax and Scan of my computer at home for my work fax #?
A piece of hardware called a Fax Modem, installed in or connected to your computer with the appropriate device drivers from the manufacturer of the device, you have installed in or connected to your computer. And a telephone line.
-
In CS3, I used command * to place an image in color on top a text. In trying to do the same thing in CS6, nothing happens. Should what command I use?
Hi lennarta,
Please refer to place an Image in text with Photoshop CS6 and follow the process.
Let us know if that helps.
Kind regards
Assani
-
Should what action I use to get back into the time line?
Hello guys.
I have this slide containing a video, and I wish have a button that brings the student to the point 0 of the chronology of the slide.
Should what action I use? I read something about Javascript, but was hoping that might be an easier way.
Can someone help me pls:
To replay a blade, I use this tip action:
Expression cpCmndGotoSlide = cpInfoCurrentSlide-1
Finally, you must add the command continue, depends on the configuration of the slide.
-
I'm on Photoshop CC and I want to use the 3D on a police/Word tool, but can't (it is grayed out/unclickable). What should I do to use it?
Hi fabianao84983383,
Greetings.
- Make sure that your computer meets the minimum system requirements - system requirements | Photoshop
- And if he then checks the below mentioned things.
- Image must be in RGB color profile
- Check in the preferences - performance graphics card use is checked under Advanced mode of drawing that you have selected.
Concerning
Rohit
-
Hello, I need to know how to buy video editor adobe first pro? should which card I use? Live ARGENTINA and VISA rejects me. Please answer, thank you!
The country store & the Adobe ID, payment details must be same.
If your Adobe ID is associated with the wrong country, please see this link:
Change the country associated with your Adobe ID
You can see the locations that creative cloud is available here:
http://www.Adobe.com/content/dam/Adobe/en/products/creativecloud/CC/PDFs/CC-availability-m atrix.pdf
-
Should what product I use to create and present a series of modules with text, audio and video? As a super duper powerpoint?
I think you could use DW, but it would be browser based and you need to understand a lot about html, css and javascript to do. Adobe Captivate seems closer to what you want: http://www.adobe.com/cfusion/search/index.cfm?term=buy+captivate&loc=en_us
Is not part of the subscription of cloud creative and is 1000 US $ or $29.99 / month on its own...
-
Should what procedure I use to replace a secondary storage SATA?
Should what procedure I use to replace a secondary storage SATA?
I have a SATA secondary drive that is too small. There nothing critical in this regard. If I'm asking the domain controller to replace it with a larger, they shut down the server, remove the small drive, put in the largest and start the server up. My questions are:
1 how the ESXi 4 will react when he sees the missing original disc and a vacuum?
2. How can I get the new drive back under the control of ESXi 4?
Thank you!
1 how the ESXi 4 will react when he sees the missing original disc and a vacuum?
You must just rescan the HBAS and set up a new store of data on this drive.
2. How can I get the new drive back under the control of ESXi 4?
Even as before it should appear after a restart.
-
Is it useful to download the soft both CC and CC 2014 versions or do I keep only the version of CC2014 and uninstall the CC version?
Because it is heavy enough to keep both versions of all the apps.
Thanks in advancefor your answer
If there are features you need, and who were dropped on CC2014, such as the filter of painting with oil, then by all means install both. Personally, I uninstalled CC and CS 6 and earlier versions. I can always reinstall if I need them. Because a single installed version makes interprogramme operations much more simple, as the operating system knows just what program to use to open a. PSD, for example.
-
Work on iMac and laptop. Anyone know if I can use my creative cloud on both applications by logging in?
I had a technician COMPUTER to my work that has been able to use one of this cloud of creative Adobe apps on another computer whenever it has disconnected from her account on her computer. He also said that he could create other accounts.
I am able to use my apps on my laptop and my computer cloud creatives?
Like a cloud member you are entitled to activate the software to be used on up to two computers at any time (Mac or PC, no matter), provided you use only one at a time. No required registration of entry/exit.
Maybe you are looking for
-
How to block offered ads that appear on the blank page?
I put not to remember the history and delete cookies when you close Firefox. When I restart Firefox the white page is filled with advertising.
-
When I click on the shortcut, my opens Firefox with anything else that the top bar with the logo of Firefox and the close, minimize and resize buttons. I don't then right-click, use the commands Alt + (key) or Ctrl + (key) orders. I have no address b
-
HP 14-d037TU HDMI and VGA does not not for WIN7 64 bit
Hello I came across another issue I solved all the problems of driver for laptop HP 14-d037TU. However, the HDMI and VGA is not working. Help, please. PCI\VEN_8086 & DEV_0F31 & SUBSYS_218D103C & REV_0APCI\VEN_8086 & DEV_0F31 & SUBSYS_218D103CPCI\VEN_
-
HP 240 G4 - drivers HP does not
Hello You have a HP 240 G4 Notebook PC here, P/N: K9Y49LT Try a clean installation on an SSD. I have 7 unknown devices. Several drivers on the HP site do not work.All Intel drivers give me an error message:"This platform is not supported.or:"This sys
-
Satellite C850-1j1 not boot not
my PC laptop Satellite C850-1j1 unbootable.He arrived after the partition is changed. Displays an error screen telling me that the computer must be repaired with recoverymedia. I have a work hirens boot cd and usb (tested on other COMP.), but the lap