Configuration frame pop out of the main frame - how to do (architecture) ?

Hi,
I have a main frame that upon it I have a config button I did.
This button pop open another frame in which the user config some variables which I need to use in the main frame actions.
What is the right way to do it? -
1. in the main frame constructor to create a config frame and save it as a data member in the main frame with setVisibility false, and when the user press the 'config' button I'll change the visibility to true
(and then if I want to take data from the config frame I'll take it from there)
2. To save only the config data in data members (this is a small window - 3 or 4 variables) and every time the 'config' button is pressed I'll build a config frame and in its' constructor I'll send the variables I saved in the main frame
and they will be shown in there (and ofcourse when the config frame will be closed I'll save the new variables in the data members and dispose the config frame)
Thanks,
Michael

I have a little problem.
I build my own class that extends JDialog (with check boxes, text areas etc.)
Then I Created a JOptionPane with OK_CANCEL buttons set it as my dialog content pane.
Now I see the the pane buttons at the top and all my components at the buttom, and its now good.
So Instead of JDialog i extends my class to JPanel and then called
'JOptionPane.showOptionDialog' , and set my panel as the message.
Now it looks good but i have another problem -
I want to do a validity check before the dialog is being closed.
Before I did with 'addPropertyChangeListener' method on my JOptionPane, but now I dont have an OptionPane because the 'showOptionDialog' is static.
So for conclusion -
How can I build a dialog thats:
1. Look like I want (text areas, check boxes, lables ...)
2. Has OK\Cancel button
3. Lets me do validity check after the ok was pressed (and if I want - wont close the dialog)
4. Return me values from the dialog (the text in the text area, the selection of the check box etc.)

Similar Messages

  • Drag JTabbedPane out of the main Frame and set scroll bars for the tabs

    hi ,
    Iam working on a Swing application . In it i have Six Tabs added to a single JTabbedPane. all the tabs are different class files . is it possible to drag any of the tabs out of the frame.
    how to add scroll bars for the tabs individually. i have tried adding JScrollPane to the main frame and add the JTabbedPane to the Scrollpane . the scroll bar was not visible and i have tried adding
    all the six tabs to the individual JScrollPanes and add the six scrollpanes to the TabbedPane .
    only the scroll arrows are visible , when i minimised or resized the application the scrollbars were not appearing .
    could any one help me to solve the above two problems.

    just trying.....
    public void mouseDragged(MouseMotionEvent e){
    // this event should be activated only when the Drag goes out of scope of the parent JFrame which i dont know how
    Component c=JTab.getComponentAt(JTab.getSelectedIndex());
    JFrameobj.getContentPane().add(c,"Center");
    }

  • When i open apps sometime its pop out to the main page

    hi...sometimes when i open an apps its just pop right out. lately i open my camera apps just about to took a photo its pop out again??...i wan to know can it be fix??

    Try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.
    If the Mail app still doesn't work after the iPad has restarted then try closing the app completely and see if it works when you re-open it : from the home screen (i.e. not with Mail 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.

  • My headphones are not clicking into my ipod touch 4g 64gb port, and are causing it to pop out at the smallest movement, how can i fix it?

    basically it's been a problem for a while now my sennheiser headphones are not clicking in correctly and are popping out at every movement causing it to pause my music, (very annoying) but it works fine if i hold it in, but can't do this all the time.I dom't know what the problem is or how i can fix.
    any help would be greatly recieved
    regards
    PD

    If it happens with another set of headphones then the headphone jack in the iPod needs replacing.  Apple will only exchange your iPod for a refurbished one for  this price:
    Apple - Support - iPod - Repair pricing
    A third-party place like this one is less expensive. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens

  • Button to frame | button going back to the main frame (please help)

    these are the codes, by clicking the "FCFS" button it will generate another frame and from that frame another button will be pressed "accept" and it will go to another frame....
    my problem is that i nid to put codes on the "back" button to go back to the main frame were it started... please help me... thnks
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Oscon extends JFrame
         private JButton fcfsB, priorityB, sjfB, rrB, exitB, creditsB;
         private fcfsButtonHandler fbHandler;
         private priorityButtonHandler pbHandler;
         private sjfButtonHandler sbHandler;
         private rrButtonHandler rbHandler;
         private exitButtonHandler ebHandler;
         private creditsButtonHandler cbHandler;     
         public Oscon()// main frame
              fcfsB = new JButton ("FCFS");
              fbHandler = new fcfsButtonHandler();
              fcfsB.addActionListener(fbHandler);
              priorityB = new JButton ("PRIORITY");
              pbHandler = new priorityButtonHandler();
              priorityB.addActionListener(pbHandler);
              sjfB = new JButton ("SJF");
              sbHandler = new sjfButtonHandler();
              sjfB.addActionListener(sbHandler);
              rrB = new JButton ("RR");
              rbHandler = new rrButtonHandler();
              rrB.addActionListener(rbHandler);
              exitB = new JButton ("EXIT");
              ebHandler = new exitButtonHandler();
              exitB.addActionListener(ebHandler);
              creditsB = new JButton ("CREDITS");
              cbHandler = new creditsButtonHandler();
              creditsB.addActionListener(cbHandler);
              setTitle("CPU SCHEDULING");
              Container pane =getContentPane ();     
              pane.setLayout(new GridLayout(2,3));
              pane.add(fcfsB);
              pane.add(priorityB);
              pane.add(sjfB);
              pane.add(rrB);
              pane.add(exitB);
              pane.add(creditsB);
              setSize(500,100);
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
         public class fcfsButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   JFrame frame = new JFrame("FCFCS setting");
         final JLabel FCFSProcessL, FCFSp1L,FCFSp2L,FCFSp3L,FCFSp4L, FCFSbt;
              final JTextField FCFSp1TF,FCFSp2TF,FCFSp3TF,FCFSp4TF;
                        FCFSProcessL = new JLabel("PROCESS", SwingConstants.CENTER);
                        FCFSp1L     = new JLabel("P1:", SwingConstants.CENTER);
                        FCFSp2L     = new JLabel("P2:", SwingConstants.CENTER);
                        FCFSp3L     = new JLabel("P3:", SwingConstants.CENTER);
                        FCFSp4L     = new JLabel("P4:", SwingConstants.CENTER);
                        FCFSbt      = new JLabel("BT:", SwingConstants.CENTER);
                        FCFSp1TF= new JTextField (10);
                        FCFSp2TF= new JTextField (10);
                        FCFSp3TF= new JTextField (10);
                        FCFSp4TF= new JTextField (10);
                        JButton     FCFSokB = new JButton ("Accept");
                        FCFSokB.addActionListener(new ActionListener() {   
                        public void actionPerformed(ActionEvent e)
                                  JFrame frame2 = new JFrame("FCFCS");
                                  frame2.setSize(500,500);
                                  frame2.setVisible(true);
                                  frame2.setDefaultCloseOperation(EXIT_ON_CLOSE);
                                  JButton     FCFSclearB = new JButton ("clear");
                                  FCFSclearB.addActionListener(new ActionListener() {   
                                  public void actionPerformed(ActionEvent e)
                                  FCFSp1TF.setText("");
                                  FCFSp2TF.setText("");
                                  FCFSp3TF.setText("");
                                  FCFSp4TF.setText("");
                        JButton     FCFSBackB = new JButton ("Back");
                        FCFSBackB.addActionListener(new ActionListener() {   
                        public void actionPerformed(ActionEvent e)
                                  setTitle("CPU SCHEDULING");
                                  frame.setLayout(new GridLayout(7,2));
                                  frame.add(FCFSProcessL);
                                  frame.add(FCFSbt);
                                  frame.add(FCFSp1L);
                                  frame.add(FCFSp1TF);
                                  frame.add(FCFSp2L);
                                  frame.add(FCFSp2TF);
                                  frame.add(FCFSp3L);
                                  frame.add(FCFSp3TF);
                                  frame.add(FCFSp4L);
                                  frame.add(FCFSp4TF);
                                  frame.add(FCFSokB);
                                  frame.add(FCFSclearB);
                                  frame.add(FCFSBackB);
                                  frame.setSize(200,250);
                                  frame.setVisible(true);
                                  frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
         public class priorityButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
         public class sjfButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   System.exit (0);          
         public class rrButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   System.exit (0);          
         public class exitButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   System.exit (0);          
         public class creditsButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   System.exit (0);          
              public static void main (String [] args)
              Oscon O = new Oscon();
    }

    please help me revise my program, im almost done, i just nid to set the progress bar that it will run according to the waiting time, or set the progress bar to run in order.. these are the variable names of the progress bar(current1, then current2, then current3 then current4).
    i looked it up on the site and i cant really understand it... i just did the part where i included the progress bar to the interface. ijust want the 4 progress bars to run after clicking the accept button.... Please help me!!! its for my project and i didnt slept last night just working on this... i just nid help sir... thnks...
    these are the codes i made:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JProgressBar;
    public class CPUSched
              public CPUSched()
              JFrame frame = new JFrame();
                   JProgressBar current1, current2, current3, current4;
                   Thread runner;
                   int num = 0;
              final JLabel ProcessL, p1L,p2L,p3L,p4L, bt, prioL, tqL, wtL, awtL, awtLA;
                   final JTextField p1TF,p2TF,p3TF,p4TF, prio1TF, prio2TF,prio3TF,prio4TF, tqTF ;
                   final JLabel      blank1, blank2, blank3, blank4, blank5, blank6, blank7, blank8, blank9, blank10, blank11,
                                       blank12, blank13, blank14, blank15;
                   final JLabel     blank16, blank17, blank18, blank19, blank20, blank21, blank22, blank23, blank24, blank25,
                                       blank26, blank27, blank28, blank29, blank30;
                   current1 = new JProgressBar(0, 2000);
                   current1.setValue(0);
         current1.setStringPainted(true);
                   current2 = new JProgressBar(0, 2000);
                   current2.setValue(0);
         current2.setStringPainted(true);
                   current3= new JProgressBar(0, 2000);
                   current3.setValue(0);
         current3.setStringPainted(true);
                   current4 = new JProgressBar(0, 2000);
                   current4.setValue(0);
         current4.setStringPainted(true);
                        ProcessL = new JLabel("PROCESS", SwingConstants.CENTER);
                        p1L     = new JLabel("P1:", SwingConstants.CENTER);
                        p2L     = new JLabel("P2:", SwingConstants.CENTER);
                        p3L     = new JLabel("P3:", SwingConstants.CENTER);
                        p4L     = new JLabel("P4:", SwingConstants.CENTER);
                        bt      = new JLabel("Burst Time:", SwingConstants.CENTER);
                        prioL= new JLabel("Priority (1-4):", SwingConstants.CENTER);
                        tqL= new JLabel("Time Quantum:", SwingConstants.CENTER);
                        wtL= new JLabel("Waiting time:", SwingConstants.CENTER);
                        awtL= new JLabel("Average Waiting time:");
                        awtLA= new JLabel("");
                        blank1= new JLabel("");
                        blank2= new JLabel("");
                        blank3= new JLabel("" ,SwingConstants.CENTER);
                        blank4= new JLabel("");
                        blank5= new JLabel("", SwingConstants.CENTER);
                        blank6= new JLabel("");
                        blank7= new JLabel("");
                        blank8= new JLabel("" ,SwingConstants.CENTER);
                        blank9= new JLabel("");
                        blank10= new JLabel("");
                        blank11= new JLabel("", SwingConstants.CENTER);
                        blank12= new JLabel("");
                        blank13= new JLabel("");
                        blank14= new JLabel("");
                        blank15= new JLabel("");
                        blank16= new JLabel("");
                        blank17= new JLabel("");
                        blank18= new JLabel("");
                        blank19= new JLabel("");
                        blank20= new JLabel("");
                        blank21= new JLabel("");
                        blank22= new JLabel("");
                        blank23= new JLabel("");
                        blank24= new JLabel("");
                        blank25= new JLabel("");
                        blank26= new JLabel("");
                        blank27= new JLabel("");
                        blank28= new JLabel("");
                        blank29= new JLabel("");
                        blank30= new JLabel("");
                        p1TF= new JTextField (2);
                        p2TF= new JTextField (2);
                        p3TF= new JTextField (2);
                        p4TF= new JTextField (2);
                        prio1TF= new JTextField (2);
                        prio2TF= new JTextField (2);
                        prio3TF= new JTextField (2);
                        prio4TF= new JTextField (2);
                        tqTF= new JTextField (2);
                             prio1TF.setEditable(false);
                             prio2TF.setEditable(false);
                             prio3TF.setEditable(false);
                             prio4TF.setEditable(false);
                             tqTF.setEditable(false);
                        JButton     okB = new JButton ("Accept");
                        okB.addActionListener(new ActionListener() {   
                        public void actionPerformed(ActionEvent e)
                             double iw=0, wtp1, wtp2, wtp3, wtp4;
                             double bt1, bt2, bt3, bt4;
                             double averageWT, sumWT;
                             bt1=Double.parseDouble(p1TF.getText());
                             bt2=Double.parseDouble(p2TF.getText());
                             bt3=Double.parseDouble(p3TF.getText());
                             bt4=Double.parseDouble(p4TF.getText());
                             wtp1 = iw;
                             wtp2 = wtp1+bt1;
                             wtp3 = wtp2+bt2;
                             wtp4 = wtp3+bt3;
                             sumWT = wtp1+wtp2+wtp3+wtp4;
                             averageWT = sumWT/4;
                             awtLA.setText(""+averageWT);
                             blank3.setText(""+wtp1);
                             blank5.setText(""+wtp2);
                             blank8.setText(""+wtp3);
                             blank11.setText(""+wtp4);
                        JButton     clearB = new JButton ("Clear");
                        clearB.addActionListener(new ActionListener() {   
                        public void actionPerformed(ActionEvent e)
                                  p1TF.setText("");
                                  p2TF.setText("");
                                  p3TF.setText("");
                                  p4TF.setText("");
                             awtLA.setText("");
                             blank3.setText("");
                             blank5.setText("");
                             blank8.setText("");
                             blank11.setText("");
                             frame.setTitle("First Come First Serve");
                                  frame.setLayout(new GridLayout(6,6));
                                  frame.add(ProcessL);
                                  frame.add(blank1);
                                  frame.add(wtL);
                                  frame.add(bt);
                                  frame.add(prioL);
                                  frame.add(tqL);
                                  frame.add(p1L);
                                  frame.add(current1);
                                  frame.add(blank3);                              
                                  frame.add(p1TF);
                                  frame.add(prio1TF);
                                  frame.add(tqTF);
                                  frame.add(p2L);
                                  frame.add(current2);
                                  frame.add(blank5);
                                  frame.add(p2TF);
                                  frame.add(prio2TF);
                                  frame.add(blank6);
                                  frame.add(p3L);
                                  frame.add(current3);
                                  frame.add(blank8);
                                  frame.add(p3TF);
                                  frame.add(prio3TF);
                                  frame.add(blank9);
                                  frame.add(p4L);
                                  frame.add(current4);
                                  frame.add(blank11);
                                  frame.add(p4TF);
                                  frame.add(prio4TF);
                                  frame.add(blank12);
                                  frame.add(blank13);
                                  frame.add(blank14);
                                  frame.add(okB);
                                  frame.add(clearB);
                                  frame.add(awtL);
                                  frame.add(awtLA);
                                  frame.setSize(800,200);
                                  frame.setVisible(true);
                                  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public static void main (String [] args)
              CPUSched O = new CPUSched();
    }

  • How to modify the icon of the main frame in JavaHelp?

    I can modify the title of the main frame, but can I modify the icon of the main frame? Thanks a million.

    hi,
    look at the Frame's method setIconImage(Image anImage);
    ;)

  • How to keep Progress bar in front of the main frame?

    Hi all,
    How can i keep the progress bar in front of the main frame all the time while the proggress bar is visible?

    Perhaps the question is not clear.
    I want the progress bar to remain in front of the parent frame as long as it is visible on screen.that is when i click on the parent frame,progress bar should not go behind the frame.
    Can ne1 plz help?
    Regards,
    Mansi

  • When i burn a disk in Disk Utility, the burn completes but the verification process does not complete and my disk pops out. The error message i get is something like this "burn failed because disk cannot be verified," PLEASE HELP

    when i burn a disk in Disk Utility, the burn completes but the verification process does not complete and my disk pops out. The error message i get is something like this "burn failed because disk cannot be verified," PLEASE HELP.
    Also when i take the disk out it seems fine nd everything seems to be burned onto the disk. I am buring mac os x lion onto a disk.
    The disk i am using is nextech and i am burning at the slowest speed (4x).
    Also this is my 3rd time trying to do this and the verifying process keeps failing.... what do i do?

    see there
    http://www.techmixer.com/best-free-mac-burning-software-for-mac-osx/
    what you like most
    try different brand of CD/DVD

  • Hi , my sister got really mad and she banged her iPod touch 5th generation on a table and she banged it so hard that the screen didn't crack but inside the the iPod is damage as in like colors are popping out and the screen doesn't work, can i fixed this?

    Hi , my sister got really mad and she banged her iPod touch 5th generation on a table and she banged it so hard that the screen didn't crack but inside the the iPod is damage as in like colors are popping out and the screen doesn't work, can i fixed this?

    Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price      
    A third-party place like the following maybe less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens

  • Mini 210 screen is popped out from the cover.

    As the subject indicates, I noticed a clicking noise when I closed the netbook.  When I opened the netbook, I discovered that the clicking is coming from the screen popping out of the botton of the cover - just below the HP logo.  It does not seem to causing any performance issues, but I was wondering if anyone else has the same issue.
    Thanks,
    Dave

    I have had the same thing happened to my HP Pavillion Dv2000
    I think my warranty has expired but is there anyway to get HP to cover this? When I put the screen at certain angles the separation between the screen and the plastic covering is almost half an inch apart. I feel like it is going to snap at some point. Ridiculous. 

  • My iphone 5c screen is popping out from the top right side , can i exchange it for a new one at the apple store ?

    my iphone 5c screen is popping out from the top right side , can i exchange it for a new one at the apple store ?

    If it is still under warranty, and they determine it is a manufacturing defect, they will replace it. Be sure to back everything up before taking it into the Apple Store. That way, if you do get a new device, you will be able to set it up from the backup.
    Cheers,
    GB

  • I just purchased a new SSD for my mac and I wanted to do a fresh/clean install on the SSD, like if my Macbook just came out of the box. How do I do that?

    I just purchased a new SSD for my mac and I wanted to do a fresh/clean install on the SSD, like if my Macbook just came out of the box. How do I do that?

    Install Mavericks, Lion/Mountain Lion Using Internet Recovery
    Be sure you backup your files to an external drive or second internal drive because the following procedure will remove everything from the hard drive.
    Boot to the Internet Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND-OPTION- R keys until a globe appears on the screen. Wait patiently - 15-20 minutes - until the Recovery main menu appears.
    Partition and Format the hard drive:
    1. Select Disk Utility from the main menu and click on the Continue button.
    2. After DU loads select your newly installed hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Partition button and wait until the process has completed. Quit DU and return to the main menu.
    Reinstall Lion/Mountain Lion. Mavericks: Select Reinstall Lion/Mountain Lion, Mavericks and click on the Install button. Be sure to select the correct drive to use if you have more than one.
    Note: You will need an active Internet connection. I suggest using Ethernet
                if possible because it is three times faster than wireless.
    This will install the version of OS X that originally came with your model if you have a model that supports Internet Recovery - 2010 models and later: Computers that can be upgraded to use OS X Internet Recovery.

  • I have itunes on a mac with 2 users but the library only shows on the main user how can both users have the same library?

    i have itunes on a mac with 2 users but the library only shows on the main user how can both users have the same library?

    Hi,
    Have a Look at these Links on Home Sharing:
    http://support.apple.com/kb/HT4620
    http://support.apple.com/kb/HT3819
    Could be what you need...
    Cheers,

  • When I copy a CD onto my macbook pro I sometimes get several songs that are "out" of the album.  How do I get them all together in one album?  Any help will be much appreciated!

    When I copy a CD onto my macbook pro I sometimes get several songs that are "out" of the album.  How do I get them all together in one album?  Any help will be much appreciated as I cannot seem to find the solution to this problem in the troubleshooting section of iTunes.

    Generally all you need do is give tracks from the same album a common Album Artist. See Grouping tracks into albums. The images need an update but the basic info. still holds.
    tt2

  • Good afternoon, I bought a box of PEV in the game the sims 3 worth € 8.99 and I was not credited in the game despite me out of the account. How can I cancel or receive the PEV?

    Good afternoon, I bought a box of PEV in the game the sims 3 worth € 8.99 and I was not credited in the game despite me out of the account. How can I cancel or receive the PEV?

    Try contacting iTunes support via this page and ask them to help : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

Maybe you are looking for