Dialog help please

When i press the calculate button it will calculate a price depending on the options chosen and show the results in an OptionDialog.
I need help with the two buttons (New Quote and Close), I want it so that if i press New Quote it will return to the dialog box where i input values, and if i press Close it will exit the entire application. Is this possible? And if so how?
Thanks
package task2;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
public class task2Swing extends JDialog {
private JLabel jLabel1 = new JLabel();
private JTextField noDays = new JTextField();
private JLabel jLabel2 = new JLabel();
private JComboBox carType = new JComboBox();
private JButton calcButton = new JButton();
private JButton jButton2 = new JButton();
public task2Swing() {
this(null, "", false);
public task2Swing(Frame parent, String title, boolean modal) {
super(parent, title, modal);
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
private void jbInit() throws Exception {
this.setSize(new Dimension(309, 176));
this.getContentPane().setLayout( null );
jLabel1.setText("Input number of days to rent car:");
jLabel1.setBounds(new Rectangle(15, 5, 230, 30));
jLabel1.setFont(new Font("Verdana", 0, 13));
noDays.setBounds(new Rectangle(250, 5, 40, 35));
jLabel2.setText("Select type car to rent:");
jLabel2.setBounds(new Rectangle(15, 55, 165, 25));
jLabel2.setFont(new Font("Verdana", 0, 13));
carType.setBounds(new Rectangle(195, 55, 95, 30));
carType.insertItemAt("Economy", 0);
carType.insertItemAt("Intermediate", 1);
carType.insertItemAt("Full_Size", 2);
carType.insertItemAt("Luxury", 3);
calcButton.setText("Quote");
calcButton.setBounds(new Rectangle(45, 100, 80, 35));
calcButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
calcButton_actionPerformed(e);
jButton2.setText("Close");
jButton2.setBounds(new Rectangle(170, 100, 80, 35));
jButton2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton2_actionPerformed(e);
this.getContentPane().add(jButton2, null);
this.getContentPane().add(calcButton, null);
this.getContentPane().add(carType, null);
this.getContentPane().add(jLabel2, null);
this.getContentPane().add(noDays, null);
this.getContentPane().add(jLabel1, null);
public static void main(String[] args){
JFrame vJFrame = new JFrame("frame");
vJFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
vJFrame.setSize(300, 100);
vJFrame.setVisible(false);
task2Swing vAddOneDialog = new task2Swing(vJFrame, "Task 2", false);
vAddOneDialog.setVisible(true);
private void jButton2_actionPerformed(ActionEvent e) {
System.exit(0);
private void calcButton_actionPerformed(ActionEvent e) {
int quote = 0, economy = 50, intermediate = 60, fullsize = 75, luxury = 100;
String vMyNumberText = noDays.getText();
String val = carType.getSelectedItem().toString();
int vMyNumber = Integer.parseInt(vMyNumberText);
if(val.equals("Economy")){quote = vMyNumber * economy;}
if(val.equals("Intermediate")){quote = vMyNumber * intermediate;}
if(val.equals("Full_Size")){quote = vMyNumber * fullsize;}
if(val.equals("Luxury")){quote = vMyNumber * luxury;}
Object[] options = {"New Quote", "Close"};
JOptionPane.showOptionDialog (
null, "Your quote comes to $" + quote, "Quote for car rental",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, //do not use a custom Icon
options, //the titles of buttons
options[0]); //default button title
//System.exit (0); //ends the program
}

anyone?

Similar Messages

  • I m trying to import some picture from my iphoto library but element 12 don't show me the iphoto dialog box , as I can see on my classroom book and in many tutorial.any one can help please

    I m trying to import some picture from my iphoto library but element 12 don't show me the iphoto dialog box ,where i choose what i want to import,  as I can see on my classroom book and in many tutorial.any one can help please ? thanks

    I have the same problem... but the photo library is neither on my iPhone or my Computer!! Please help.. its taking too much space.

  • 'Error loading plugin: Plugin file not found' message on ONLY 5 sites, but all others OK.  Help, please!

    Hi Again!
    I posted this problem here before, but since I really need to access the sites that receive this error message in less than a month, I had to re-post; hopefully someone who didn't see it before will see it & have a solution for me.
    Here are the details:  I'm running windows 8.1 & I use Firefox 33.1.1, Pale Moon 25.1.0 or Opera 26.0 as my browsers, (I have IE installed & up-to-date, but I never use it).  I followed the 10-point checklist on Adobe & everything was done, except for "uncheck Hardware Acceleration" in Flash 'Settings'; I tried to uncheck it on this site, where it's indicated, as well as in my 4 browsers when I'm doing something that uses Flash, but no matter how hard I try, I can't 'uncheck' the check mark in that tiny box!  Since this error problem only affects 5 web sites, & I can watch streaming media on all other sites, I don't think it's an issue. 
    Here's how this problem began:  I was watching a live, streaming nest-cam on 5/09/14 around 11:00AM, (yes, I DO know the exact time & date, because it happened so suddenly while I was watching this website that I'd been watching since the end of February, 2014), when my screen went black.  I thought it was probably an Adobe Crash, but when the usual Crash Report window didn't show up, I just closed Firefox & reopened it, expecting to resume watching the nest-cam.  When I went back to the site, I got the black screen with the "Error loading plugin: Plugin file not found" message.  The chat portion on the site still works, though. I know there are other sites with this nest-cam feed, so I started trying them, but it took several tries for me to find one that didn't get the error message! I posted this problem on "Windows BBS" forum, & someone else posted that the same thing happened to them AND on the same sites!  They didn't have a solution, either.  I cleared my cache, rebooted my PC & even did a System Restore, but whatever happened in that brief second made using ONLY 5 sites impossible.  Here are the sites that receive the error message:
    http://pixcontroller.com/eagles, (but I CAN go to http://pixcontroller.com, but there isn't any streaming media)
    http://cbslocal.com/eagles
    http://westmorelandconservancy.org/BlueBirdwebcam-1.htm
    http://wildearth.tv/cam/pittsburgh-bald-eagles, (I get the error message on ALL cams on this site)
    http://aviary.org/BE-NestCam1 (I get the error message on ALL cams on this site)
    Now if any videos from the 5 websites above are uploaded to YouTube, I can watch them perfectly...no error message if I watch the videos elsewhere.  Luckily, I found Ustream, & they have most of the nest cams I watch, but I need to fix this issue, because it's nearing nesting time!  I'm an amateur nest-watcher & it's vital that I have access to these 5 sites, so if anyone knows how to fix this, PLEASE tell me!
    Thanks for taking the time to read my post.
    All suggestions/solutions are gratefully accepted.
    Thanks in advance for your help!
    DogPal 

    File Not Found Error in Welcome Screen
    07-Nov-2013 10:25
    Tags: #dreamweaver_cs6_update
    Help please!
    Live preview also not working.
    I have exactly the exact problem described below but do not have a folder with the same name as the volume created under the volume. Please can someone help - I've tried everything. This problem only happened when I upgraded to Dreaweaver CC!
    "On launching Dreamweaver on your Macintosh if your Welcome Screen is not loading and if you see a "File not found" error, please check if you have a folder with the same name as your volume created under the volume. For more info on this please go through the attached pdf document. Other dialogs/panels in dreamweaver that will be blank due to this issue are Jquery Swatches panel, Adobe Edge Webfonts tab in Manage Fonts dialog,W3c Error Info dialog, Externalise Javascript dialog and svn revert dialog. After following the changes mentioned in the attached document please check all the affected dialogs/panels to confirm everything is working as expected."
    Thanks,
    Martin Bond
    [personal information removed by moderator]

  • I need to export a photo at around 1meg file size,and dont seem to be able to do it in the presets can anyone help please ,I shoot on a canon 5d

    I need to export a photo at around 1meg file size,and dont seem to be able to do it in the presets can anyone help please ,I shoot on a canon 5d

    I believe Frank is referring to the end use (e.g., for print or on-screen use).
    Until he returns, I can tell you that I ran a quick test using an image from the Aperture 3 training book library which was as follows:
    Camera = Canon EOS 5D Mark II
    Master resolution = 5616 x 3744 (21 MP)
    I was able to export to a JPEG with end file size of 1 MB as follows:
    Export Presets drop-down > select 'Edit' option
    Selected preset name 'JPEG - 50% of Original Size' > change percentage value to 40% > change DPI value to '300' > click OK to set as current default > Export version to desktop.
    The exported JPEG has a resolution of 2246 x 1498 and appears on screen to have the same image quality of the original in Aperture.
    Note - I did not change the default Image Quality slider in the Export Preset dialog (which left it at 10).
    Basically, you will need to play around with the settings until you find the appropriate values to arrive at an image version you want.

  • Help Please - having difficulties creating af link from the text to an attached file i acrobat

    I have been reading the help, but it just wonn't work when I try.
    I have tried as followed (I am working with a danish version, and hope to matched the same word as in the english version of Acrobat Xpro):
    1. From the toolbox i choose content and then 'hyperlink'
    2. I mark the text from which i wish to make a link
    3. Acrobat respond with an popup picture 'create a link'
    4. From the popup I mark 'Open a side' and push 'next'
    5. Acrobat respond with a new popup picture 'create / go to a side'
    6. I go to the navigator and open the list with attached file's that I have embedded in my acrobat file.
    7. I mark the to which i wish to make a link to
    8. In the popup 'create / go to a side' that stilll is open, i push 'Mark hyperlink'
    Then I hoped that I have created a link from the acrobat text to the attached file. In stead Acrobat has made a link to the same sidenumber that respond to the text from which i wish to make a link . F.ex. the linktext is on side 10 - then the link goes to side 10.
    How do i do it right?
    Please help.

    Hello Bernd
    Thanks for a quick respond.
    This corresponds to the text I have tried myself, but apparently I do something wrong
    1.      Open a PDF that contains a PDF file attachment – done
    2.      Go to where you want to create a link. If that location is in the file attachment, click the Attachments button in the navigation pane, select the file attachment, and click open.
    Here I go to side number 10 from which I wish to make a link from (I am not open the attachment file at this moment, as the location not is inside the file attachment).
    (I earlier also tried to  mark the attachment file and click open, and It result that the attached file just opened normally without creating a link to the file).
    3.      Choose Tools > Content > link, and select the area for the link
    Here  I mark the text on side 10 from which I wish to make a link to a attached file
    4.      In the Create Link dialog box, set the link appearance, select Go To A Page View, and then click Next
    Here I have selected ‘Go to a page view’ as told and I click Next
    5.      Set the page number and view magnification you want, either in the parent PDF document or in the file attachment, and then click set link.
    Here I go to the navigation pane and mark the attached file from the file list (the files in the list hasn’t any side number in the list) and then I click Set Link.
    Then I hoped that I have created a link from the acrobat text to the attached file. In stead Acrobat has made a link to the same sidenumber that respond to the text from which i wish to make a link . F.ex. the linktext is on side 10 - then the link goes to side 10.
    What do I do wrong.?
    Med venlig hilsen
    Mogens Pedersen
    Specialkonsulent
    T 33 63 13 07
    F 33 63 10 11
    [email protected]<mailto:[email protected]>
    Fra: Bernd Alheit [email protected]
    Sendt: 2. marts 2012 13:11
    Til: Mogens Pedersen
    Emne: Help Please - having difficulties creating af link from the text to an attached file i acrobat
    Re: Help Please - having difficulties creating af link from the text to an attached file i acrobat
    created by Bernd Alheit<http://forums.adobe.com/people/Bernd+Alheit> in Creating, Editing & Exporting PDFs - View the full discussion<http://forums.adobe.com/message/4241290#4241290

  • Macbook stuck on white screen with apple logo. help please

    I have a macbook (black model) and while I was surfing on internet it is frozen. so I shut it down and restarted. When I restarted, it stuck on white screen with gray apple logo and seems like booting but nothing happens.
    after that, I restarted again and put installation disc (leopard) without pressing any key and it opened normally. I backed up os with time machine but in one hour it is frozen again.
    restarted again but this time it did not boot normally. so i tried booting from cd with c key, it opened installation screen. I have opened disk utility top repair disk, but when I click on disc image, repair / verify disk buttons are unavailable to click and S.M.A.R.T status is not supported.
    After all, I tried to erase and install system several times, but after language section when I click agree to terms and conditions, mac freeze again.
    So, I do not know what to do. Any help please?
    Note: I already tried PRM and Safe Mode. (after safe mode it took me to installation screen again and nothing changed.)
    Any help would be much appreciated!
    Uptade: Also, opened system profiler and clicked on Serial-ATA, it seems loading but do not show any info. stucked again! help please
    Message was edited by: burakbey

    HI,
    *"I have opened disk utility top repair disk, but when I click on disc image, repair / verify disk buttons are unavailable to click and S.M.A.R.T status is not supported."*
    You need to select "MacintoshHD 10.5.8 not "disc image" in order to run Disk Utility and Verify and if necessary, Repair the disk.
    That's why you are seeing this dialog.
    *are unavailable to click and S.M.A.R.T status is not supported.*
    Also, run the Apple Hardware Test.
    http://abclocal.go.com/kgo/video?id=7011117
    Carolyn

  • I want to make all my caller id pics full screen how do i do that? When i download a picture from my phone it makes it full screen then it goes back to the small photo in the upper right hand corner how do i make them stay full screen help please:-)

    I want to make all my caller id pics full screen how do i do that? When i download a picture from my phone it makes it full screen then it goes back to the small photo in the upper right hand corner how do i make them stay full screen help please:-)

    @Naiks, having suffered through unsuccessful synching attempts for Calendar and Contacts myself, l would suggest you try the following:
    UNINSTALL iCloud control panel from your PC. Seems silly, but do it.
    Go into Outlook, and look at the very top menu. Click FILE, then ACCOUNT SETTINGS, then click the popup box.
    You will see a list of all your email accounts. Make sure that ONE of them has a checkmark against it. If not, select the account your want as your default, and click "set as default.
    Exit out of Outlook and reboot your machine.
    Now reinstall iCloud, check CALENDAR and CONTACTS, and do as instructed when prompted.
    Reboot for good luck and now launch OUTLOOK. All that remains is to locate your iCloud Contacts and Calendar files, and make them your default.
    IMPORTANT: Don't panic if you can't find your contacts -- they're there. Click CONTACTS and you'll see you have several available contact files. Locate the one label "iCloud" in grey type. Right-click on it, select PROPERTIES, then click the Outlook Address Book tab. Check the box that says something like "Make this my default Outlook Address Book." Keep clicking "apply" and "okay" until you've exited out of the dialog box maze.
    You may have to do something similar with your Calendar files. I dd not, but if you need to, do it.
    Everything should now sync pretty seamlessly.
    I didn't have the exact same problem as you, but my dilemma was close enough. Good luck!
    Arthur P. Johnson

  • Firmware help please

    Now, I have tried to get my AEBS N2 installed and no luck. I bought it from the Apple Store on Monday 4/13. I give this info because in the Airport Utility it shows the firmware version as 7.4 NOT 7.4.1. I have tried to rollback to 7.3.2 by using instructions from this website, but I am given the option of finding a firmware version on my HD thru the Windows Open dialog box or "Current". The airport utility can see the AE when I connect via ethernet and when I first tried to set it up, I did so manually to a green light, but no intenet connection. I am stuck, can anyone help, please!

    Never mind, finally got it. Tried to access it from Google's 'Chrome' browser, which was nice enough to show me the URL it was unseccessfully trying to get - used an FTP tool to dl it, installed no problem...

  • JFilechooser .....help please

    hi,
    while opening file "OPEN" or "SAVE" dialog using JFilechooser, in those dialog, can we have our desired icon instead of Java Application at left most corner in the dialog??
    any help please????

    setIconImage
    public void setIconImage(Image image)Sets the image to be displayed in the minimized icon for this frame. Not all platforms support the concept of minimizing a window.
    Parameters:
    image - the icon image to be displayed. If this parameter is null then the icon image is set to the default image, which may vary with platform.
    See Also:
    getIconImage()
    That may work...

  • TS3988 I am receiving email that I should verify my password for iCloud but I can't see the link that I should start. HELP please!!!!!!

    I am receiving email that I should verify my password for iCloud but I can't see the link that I should start. HELP please!!!!!!

    You select the desired file (tick the square box on the left of the file name).
    You click on the "share"/"send" icon (the envelope with the arrow that points up and to the right).
    You are presented with the share/send dialog.
    Here you select the "Send To" choice.
    This is done by placing a tick in the box beside either "Public Link (create a public link for anyone to view)"
    OR
    "Personalizdd Link (send email invitations to individuals)"
    NOTE: The second choice is only available if you have a subscription to Adobe Send service.
    So, for a free "Files" account in Adobe's cloud you'd tick "Public Link".
    At the bottom left you'll observe the "Create Link" button.
    Click it.
    You are presented with a new dialog that informs you that the Public Link has been generated and that link is provided in a field within the dialog.
    You can copy the link to a text file for future copy-paste into a post to a forum or bulletin board or you can provide the link to otheres via an email.
    Be well...

  • Color help please!

    Color help please!
    When I view a file in CS5, the colors are vastly different than when I view the same file from any other program on my computer.  I calibrate regularly and want to be viewing as per the calibration on CS5- are there setting I need to change in CS5 or are those accurate and I need to change the settings in my control panel??  Thank you!!

    So that you can be better helped,what OS/version are you running,what software/hardware do you calibrate your monitor with,and what are the Color Preference settings in Photoshop?  That can be accessed with Ctrl + Shift + k in Photoshop. If you can manage a screenshot of just that Preference dialog,it will help a lot.
    I'll add that Windows applications are not color managed as Photoshop is. Windows and many files you see on the web are sRGB. If Photoshop's Color Workspace  is set to either Adobe RGB or Pro-Photo, a regular color graphics file  will show up with the colors saturated. That's because most color files do not have a tag telling Photoshop what color space it came from and Photoshop if set to other than sRGB will not display it properly.
    You could set Photoshop's Working space to sRGB (North American General Defaults 2) if your pictures are intended for the web, or if you must use Adobe RGB (commercial press work),then you must tag or Assign an sRGB profile if your file has no profile assigned. If it already has a tag other than sRGB, then you make a copy and Convert it to sRGB to display properly in Windows apps.
    That's a rough guess as to why your files do not display properly in CS5. Assign Profile and Convert to Profile are both under PS's Edit Menu.
    Gene

  • HELP please! iphone not working because of 2.02 update!

    So my phone is not working. AT ALL.
    It just shows that I need to plug in my iphone cord and then an arrow that points to the iTunes icon. Then I've been doing that, but it prompts me in iTunes that I need to Restore. So I click restore and it says "contacting the iPhone software update server..." for 15 MINUTES now.
    I am absolutely furious because I haven't been able to use my phone for 3 hours now and this is taking forever. It came out of nowhere.
    I also have a stable internet connection. Is the iTunes store messed up right now? someone help please!

    Sorry to hear about your problems...iTunes Store appears to be working properly right now. Did you already have the 2.0.2 update on the iPhone? If so, you should have the backup file in your computer under Users/(your user)/Library/iTunes/iPhoneSoftwareUpdates. If it isn't there, you should be able to download it from the apple site (I think). If not, you can install ANY version of the software by holding down the 'option' key while clicking 'Restore' (not sure which modifier key to hold in Windows)...this will bring you to a dialog box that will let you select a file...navigate to the above mentioned folder and choose the latest software you have. Good luck!!!

  • I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!

    I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!

    There are no updates to either OS 10.5.8 or Safari 5.0.6.
    If you need a later version of Safari you must first upgrade your operating system to a later version of OS X.

  • At the end of my IMovie I want to write some text: as in" Happy Birthday Mandy we had a great time with you. etc..  How do I go about this? Which icon in IMovie lets me have a place to write text?? help please

    Please see my ? above: Im making an IMovie and need the last frame to just be text (can be on a color). I don't know how to go about doing this.  Ive already done all my photos and captions. Need to have it ready for TOMORROW: Friday May 23rd. Help please!
    Thanks

    You can choose a background for the text from Maps and Backgrounds.  Just drag a background to the end of the timeline, adjust to desired duration then drag title above it.
    Geoff.

  • I have just updated my PC with version11.14. I can no longer connect to my Bose 30 soundtouch via media player Can anyone help please

    I have a Bose soundtouch system .Until today I could play my iTunes music through it via air  player . .I have just uploaded the latest upgrade from iTunes and now I am unable to connect to the Bose system . Can anyone help please? I can connect via my iPad and by using the Bose app so it is not the Bose at fault

    @puebloryan, I realize this thread is a bit old, but I have encountered a similr problem and wondered if you had found a solution. I've been using home sharing from itines on my PCs for years, but two days ago, it suddenly stopped. I can share from my Macs, but not from the ONE PC library where I keep all my tunes. I tried all the usual trouble-shooting measures.
    After turning home sharing off on the PC's iTunes, turning it back on and turning some other settings off and on, my Macs and Apple TV could briefly "see" the PC library, but as soon as I try to connect -- the wheel spins for a bit and then the connection vanishes. It's as if they try and then give up.
    Since this sounds so similar to your problem, I was hoping you finally found a solution. I am also starting a new thread. Thanks!

Maybe you are looking for

  • Record group query question

    Just wondering if we need to check :system.mode = query or normal in the query for record groups or oracle forms handles it automatically Thanks

  • Reaction is very slow playing games?

    Reaction is very slow playing games?

  • Does SES has a driver for Sirit IN510 interrogator?

    Hi, do you know of anyone who has done an implementation of SES with Sirit IN510 interrogators? Thanks

  • Definition of target costs

    Hello Can somebody give me a clear definition of target costs? I suggest it planned costs per unit (of material , activity , etc )* actual quantity produced thanks

  • External call to weblogic

    How can I invoke code to weblogic through a external process? We have           another module that runs external from weblogic which at any time make           changes to the data base and we need to refresh the code set on           weblogic.