How to make my program work using 2 files separately?

My main file is ExpenseTracker.java. When u
compile the ExpenseTracker.java , there is a column of buttons on the left
and a right box. I would like to make the output of the RecordMenu.java
appear(not pop out) in the right box of my ExoenseTracker when i click one
of the button 'Record Expenses'. I wonder you can help me in this? I am
facing that problem right now.=======================================================================
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.border.*;
public class ExpenseTracker extends JFrame {
public ExpenseTracker() {
super("Expense Tracker");
// FirstPanel
JPanel FirstPanel = new JPanel();
FirstPanel.setLayout(null);
JLabel labeltracker = new JLabel("Expense Tracker");
JButton recordExpenses = new JButton("Record Expenses");
JButton viewExpenses = new JButton("View Expenses");
JButton calendar = new JButton("Calendar" );
JButton exit = new JButton("Exit");
labeltracker.setBounds(40,120,135,30);
recordExpenses.setBounds(25,160,135,30);
viewExpenses.setBounds(25,210,135,30);
calendar.setBounds(25,260,135,30);
exit.setBounds(25,310,135,30);
FirstPanel.setBounds(5,5,200,500);
FirstPanel.add(labeltracker);
FirstPanel.add(recordExpenses);
FirstPanel.add(viewExpenses);
FirstPanel.add(calendar);
FirstPanel.add(exit);
//SecondPanel
JPanel SecondPanel = new JPanel();
SecondPanel.setLayout(new BorderLayout(1,2));
// SecondPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
SecondPanel.setBorder(new LineBorder(Color.black));
SecondPanel.setBounds(210,120,530,270);
getContentPane().setLayout(null);
getContentPane().add(FirstPanel);
getContentPane().add(SecondPanel);
setSize(800,500);
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
public static void main(String [] args) {
new ExpenseTracker();
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.event.*;
import javax.swing.border.*;
public class RecordMenu extends JFrame implements ItemListener,ActionListener {
>>
JCheckBox weekly;
JCheckBox monthly;
public RecordMenu() {
super("Choose");
Container c = getContentPane();
JPanel checkPanel = new JPanel();
checkPanel.setLayout(new GridLayout(4,2));
checkPanel.setBorder(new TitledBorder("Record Expenses"));
JLabel label2 = new JLabel("Amount to track:");
JTextField amtField = new JTextField(5);
//Create the check boxes.
weekly = new JCheckBox("Weekly");
weekly.setSelected(false);
monthly = new JCheckBox("Monthly");
monthly.setSelected(false);
//Register a listener for the check boxes.
weekly.addItemListener(this);
monthly.addItemListener(this);
amtField.addActionListener(this);
//Put the check boxes in a column in a panel
checkPanel.add(weekly,BorderLayout.NORTH);
checkPanel.add(monthly,BorderLayout.SOUTH);
checkPanel.add(label2);
checkPanel.add(amtField);
JPanel buttonPanel = new JPanel();
JButton buttonOk = new JButton("OK");
JButton buttonCancel = new JButton("Cancel");
buttonPanel.add(buttonOk);
buttonPanel.add(buttonCancel);
c.add(checkPanel,BorderLayout.NORTH);
c.add(buttonPanel);
setSize(370,200);
setVisible(true);
/** Listens to the check boxes. */
public void itemStateChanged(ItemEvent event) {
public static void main(String[] args) {
new RecordMenu();

but i wan e program to work wit 2 file, not all e 2 file codes put together in a file. I wonder if can call e code from the recordmenu file when i execute the expenseTracker file. I not sure i explain this way u will understand?
When the record menu 'ok' is clicked there will b a JOptionpane tat will pop out saying
'Total amt to b tracked on a weekly basis is (amt entered in textfield)"
if e checkbox is selected weekly, the output will be like e above
otherwise it will display 'Total amt to b tracked on a monthly basis is (amt entered in textfield)".
ya e textfield input must be numbers.

Similar Messages

  • How to make e program work using 2 files separately?

    My main file is ExpenseTracker.java. When u
    compile the ExpenseTracker.java , there is a column of buttons on the left
    and a right box. I would like to make the output of the RecordMenu.java
    appear(not pop out) in the right box of my ExoenseTracker when i click one
    of the button 'Record Expenses'. I wonder you can help me in this? I am
    facing that problem right now.=======================================================================
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    public class ExpenseTracker extends JFrame {
    public ExpenseTracker() {
    super("Expense Tracker");
    // FirstPanel
    JPanel FirstPanel = new JPanel();
    FirstPanel.setLayout(null);
    JLabel labeltracker = new JLabel("Expense Tracker");
    JButton recordExpenses = new JButton("Record Expenses");
    JButton viewExpenses = new JButton("View Expenses");
    JButton calendar = new JButton("Calendar" );
    JButton exit = new JButton("Exit");
    labeltracker.setBounds(40,120,135,30);
    recordExpenses.setBounds(25,160,135,30);
    viewExpenses.setBounds(25,210,135,30);
    calendar.setBounds(25,260,135,30);
    exit.setBounds(25,310,135,30);
    FirstPanel.setBounds(5,5,200,500);
    FirstPanel.add(labeltracker);
    FirstPanel.add(recordExpenses);
    FirstPanel.add(viewExpenses);
    FirstPanel.add(calendar);
    FirstPanel.add(exit);
    //SecondPanel
    JPanel SecondPanel = new JPanel();
    SecondPanel.setLayout(new BorderLayout(1,2));
    // SecondPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
    SecondPanel.setBorder(new LineBorder(Color.black));
    SecondPanel.setBounds(210,120,530,270);
    getContentPane().setLayout(null);
    getContentPane().add(FirstPanel);
    getContentPane().add(SecondPanel);
    setSize(800,500);
    setVisible(true);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    public static void main(String [] args) {
    new ExpenseTracker();
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    public class RecordMenu extends JFrame implements ItemListener,ActionListener {
    >>
    JCheckBox weekly;
    JCheckBox monthly;
    public RecordMenu() {
    super("Choose");
    Container c = getContentPane();
    JPanel checkPanel = new JPanel();
    checkPanel.setLayout(new GridLayout(4,2));
    checkPanel.setBorder(new TitledBorder("Record Expenses"));
    JLabel label2 = new JLabel("Amount to track:");
    JTextField amtField = new JTextField(5);
    //Create the check boxes.
    weekly = new JCheckBox("Weekly");
    weekly.setSelected(false);
    monthly = new JCheckBox("Monthly");
    monthly.setSelected(false);
    //Register a listener for the check boxes.
    weekly.addItemListener(this);
    monthly.addItemListener(this);
    amtField.addActionListener(this);
    //Put the check boxes in a column in a panel
    checkPanel.add(weekly,BorderLayout.NORTH);
    checkPanel.add(monthly,BorderLayout.SOUTH);
    checkPanel.add(label2);
    checkPanel.add(amtField);
    JPanel buttonPanel = new JPanel();
    JButton buttonOk = new JButton("OK");
    JButton buttonCancel = new JButton("Cancel");
    buttonPanel.add(buttonOk);
    buttonPanel.add(buttonCancel);
    c.add(checkPanel,BorderLayout.NORTH);
    c.add(buttonPanel);
    setSize(370,200);
    setVisible(true);
    /** Listens to the check boxes. */
    public void itemStateChanged(ItemEvent event) {
    public static void main(String[] args) {
    new RecordMenu();

    ?

  • How to make Folder Action work on file, subfolder content change?

    Hi!
    I looking for information in how to make a Folder Action, Work Flow or any action from Automator to work on file change and not only on deletion, moving or insertion. What I want to know is if it's possible to trigger some script or app while monitoring a folder and its contents, files and subfolders, changes. Meaning that when I have a file that has its contents updated the action will be triggered like an txt file that I only insert a new line in it, for example.
    Is there any solution that is not third party? Is there an internal Mac OS X solution that would work on Snow Leopard, Lion and Mountain Lion?

    i have same problem. i would like to move automatically saved Word backup copy to another folder, but the folder action doesn't recognize the save as a new file that needs to be acted upon.

  • How to make fullscreen mode work using javascript

    1.I want to open the window in fullscreen mode.
    It works fine for internet explorer.
    But in netscape navigator 8.0 as the tab browsing is there
    The menu bar appears on the page.
    That i don't want.
    2. Also when the window opens in full screen mode and if after that
    i press the ctrl+N the new window doesn't open in full screen mode.
    Giving the sample code as below.
    So how to make it work in full screen mode in both cases.
    //The sample code is given
    //check.html
    <HTML>
    <HEAD>
    <TITLE> Full Screen </TITLE>
    <script type="text/javascript">
    <!--
    function myPopup() {
    window.open( "http://www.google.com/", "myWindow", "status = 1, height = 300, width = 300, resizable = 0,fullscreen=yes" )
    //-->
    </script>
    </head>
    <body>
    <form>
    <input type="button" onClick="myPopup()" value="POP!">
    </form>
    <p onClick="myPopup()">CLICK ME TOO!</p>
    </body>
    </HTML>Plz help me.
    Thanx in Advance.
    Reema.

    dont try to use a browser for what its not intended to do.
    A browser is never been intended to work in fullscreen mode. Trying to control the size a browser is displayed in, is considered bad practice and sites that do it are usually very annoying.

  • How to make Edge Animation works in HLTM5 Offline? I cache all files, but Edge didn't play.

    How to make Edge Animation works in HLTM5 Offline? I cache all files, but Edge didn't play.
    Some createJS animation start without any problem.
    Thanks!
    Astors

    Thank you for your answer.
    I do use cdn off for publish setting.
    The Web site that I am working on is a very complicated site. Edge
    animations are in a subdirectory of Apache server.
    When server is offline, I get all files from Appcache without problem,
    excepted *_EdgePreload.js.
    I Google hundreds time, cannot find answer on why this file is always get
    online.
    Finally, I find out myself, Adobe Edge don’t like relative file path for
    *_EdgePreload.js.
    Change to root absolute path fixed the problem:
    Astors

  • How to make labview program to get average value of 200 reading from multimeter (by using loop)

    Hello
    How to make labview program to get average value of 200 reading from multimeter (I using using loop) to read voltage from mulmeter  but I like to get average value of all of 200 reding how can I do that?
    Thanks
    Wee
    Solved!
    Go to Solution.

    Another idea with less programming - take advantage of the "free" array that comes with a Chart - i.e. the  History Data.
    1) Wire your DMM data to a Chart. (You can set the chart to invisible if you don't plan on using it in the GUI).
    2) Set the Chart History Length to 200 (right click on the chart, click on Chart History Length...)
    3) On the block diagram, use the History Data Property Node, wire it to Mean.vi, and you're done.
    Easiest running average ever.
    Message Edited by Broken Arrow on 04-07-2010 11:36 AM
    Richard
    Attachments:
    EasyAvg.jpg ‏8 KB

  • How to make a program for backgroung processing used servlet

    how to make a program for backgroung processing used servlet

    well i need the coding part written in servlet ,in which servlet is always ready for accepting a client request.

  • How to make my wifi work . I'm using HP PAvilion G series Windows 7

    can somebody teach me how to make my wifi work. The guy from the place where i asked them to fix my laptop told me to download drivers from sites. and he gave me a list of drivers. But i lost it.. but then. I have downloaded almost all except for the LAN and WLAN. how do i make my wifi work. help me. thank you very much. i don't know the specific details of the laptop that's why i'm sorry if i provided little information..
    i saw someone asking for hardware IDs and this is the only i can post now. 
    PCI\VEN_1814&DEV_5390&SUBSYS_1636103C&REV_00
    PCI\VEN_1814&DEV_5390&SUBSYS_1636103C
    PCI\VEN_1814&DEV_5390&CC_028000
    PCI\VEN_1814&DEV_5390&CC_0280
    thank you!!

    I understand you need a wifi driver for your G series notebook.
    What is the product number?
    NOTE: Do NOT provide the serial number.
    What is the hardware ID of the wifi adapter?
    Go to start, search for device manager, and open this result.  
    Expand the network adapters category.
    Open the wifi card.
    Select the details tab and change the category to Hardware IDs.
    Report back the hardware IDs reported for it.  
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • YES! How to make PRINT QUOTAS WORK with 10.4

    How to make PRINT QUOTAS WORK in 10.4
    After struggling for quite some time, I finally found a pretty simple way to make print quotas work.
    First, I’ll tell you our setup. We have 3 different computer centers with a variety of eMacs and new Intel iMacs, all clients are running 10.4.8, and each of those 3 centers has its own HP Laserjet 4200 printer. Our dual G5 server is running Server v.10.4.8. Client computers and printers have static IP addresses. All clients are bound to the server with the standard WorkGroup Manager/ LDAPv3 Directory Access scheme - such that all students login to the clients with their network username/password to mount their home directory on the client.
    Next, I’ll tell you what does not work. IF YOU WANT PRINT QUOTAS TO WORK, you cannot use Workgroup Manager to assign a printer to any managed user account, user group, or computer group. Why? Because when you go to a client, and Show Info on the printer that is being pushed by Workgroup Manager, you’ll see that the queue name is not the queue that you’ve setup in Server Admin. Instead, you’ll see the queue name is “MCX” or something along those lines. Even if you manually edit the Workgroup print preference file that is being pushed to clients, it still will not work.
    Drawbacks of my technique: In my case, students will see all 3 printers (1 from each lab) available to them no matter which lab they are in. Not the best, but for now I think it’ll be worth it to be able to control wasteful printing. Students may be able to move/delete the preference file (see below), but they’ll only be hurting themselves, as they won’t have any printers at all then.
    Okay, here’s how I did it:
    1. If you have setup any printers to be pushed out via Workgroup Manager’s preference enforcement to individual users, usergroups, or computer groups, turn those preferences off and leave them off.
    2. Delete any existing printers in your Printer Setup Utility and/or Server Admin. Add and setup a new printer queue using the Server Admin> Print service. I added the printer through the Server Admin application, not Printer Setup Utility (may not matter). However, I did go into that latter utility to set the model of the printer. Now, back in Server Admin, edit the printer queue to turn on these services IPP, LPR (bonjour off), and of course check off the enforce quotas box. (No student Windows clients, so I didn’t tinker with SMB print service). I went ahead and specified the standard cover sheet – it will be handy while troubleshooting.
    3. In Workgroup Manager, select the users that you want to enforce quotas upon, go to the Printer Quota tab (not the preference pane) and, in my case, I selected All Queues and specified a quota, and clicked Save.
    4. Delete all printers that appear in the Printer Setup Utility from each client computer (I know, UGH).
    5. For all network users, you need to edit a preference file and put it into each user’s home directory. That file is “com.apple.print.favorites.plist” and as you guessed, it needs to go into the Library> Preferences folder of every one of your network users’ home directories. Now, the content of that file is crucial… what it should show is the name of the queue(s) you created in Server Admin above, and be immediately followed by an “@” and the address of the server that is hosting that queue. For example, my queue’s name is TCStudentQ and the server’s address is student.mydomain.org… so my preference file has this entry: [email protected]. If you have more than one queue, you’ll have more entries. Be sure that the network user has at least Read level access under Group or Others. I’d recommend making the server System account the Owner of the file, and be sure to lock the file so the users can’t easily trash it. If you don’t know how to create this file in the first place, what you can do is go to a client computer, and log into the client with a dummy network account. Then open Printer Setup Utility, and you should see the queue you created in step 2. Add that printer, and then the file will be created in your dummy account’s home directory under Library> Preferences. Now you can use that file to distribute to other user’s folders… but don’t forget that each user needs Read level access.
    6. That’s it. Works for me. When they exceed the quota, all that spits out is the cover page. It’d be nice if there was a quota monitor utility on the client side so users can see how many pages they have remaining and when the quota will automatically reset. I plan to start the quota on a Monday morning and go on a weekly duration. Not sure what a good starting point is… perhaps 25 pages every school week.
    7. Hey Apple Computer, Inc. Server Developers & Project Managers, I truly hope you’re reading this and can explain why print quotas don’t function as you have documented and advertised. I don’t mean to toot my own horn, but I’ve spent way too much time discovering this workaround, and I know it will help thousands of others with the same problem. I can see where your Print Quota system breaks down, and I think you need to fix these issues or at least document them. Don’t forget to fix serious 10.4 Server bugs before leaving it behind for 10.5 Server – many of us will continue using 10.4 Server for at least another year or two.

    David,
    Your assumption that I didn't read the documentation is incorrect. I read that 10.4 documentation over and over - followed it to the letter to no avail. Perhaps it was updated in the last few weeks? So, do you have a fully operable printer quota system in conjunction with a managed computer or user group that has a managed printer pushed to the group via Workgroup Manager? I can push a managed printer to a managed group without a problem, but the quotas won't be enforced unless I use the workaround above and cut Workgroup Manager's managed/pushed printer out of the picture.
    I know this is a user-to-user forum - however, I'm also aware that Apple tech support often chime in here, so it doesn't hurt to post a message to them in the context of a larger posting about a 'known issue'. I have used the server feedback form... hasn't seemed to me to be very helpful in the past.

  • How to make Finder NOT to show files from a specific folder in "All My Files"?

    Hello!
    Can someone please advice how to make finder NOT to show files from a specific folder in "All My Files"? See the attach - I recently installed Civilization 5 from Steam and now I have a lot of unneeded files (*.log and *.ini) shown in  All My Files colder in Finder.
    I don't want to see them. Any advise?

    Using "All my Files" was very handy before all this rubbish popped up. =(

  • How to make different users to use different Plan_Tables?

    How to make different users to use different Plan_Tables?
    I want each user use his own's Plan_Table. How to achieve this goal?

    qkc wrote:
    How to make different users to use different Plan_Tables?
    I want each user use his own's Plan_Table. How to achieve this goal?Which version of Oracle - if you're on 10g or later you are already (effectively) doing this.
    If not, then copy the 10g strategy back to your version; in outline:
    <ul>
    drop all existing plan tables
    create a table (but call it plan_table$) in the SYS schema (you may prefer to use SYSTEM) as a global temporary table on commit preserve rows
    create a public synonym plan_table for plan_table$
    grant select insert update delete on plan_table to public
    </ul>
    Look in $ORACLE_HOME/rdbms/admin/catplan.sql in a 10g version of Oracle to check how it's done.
    Each user gets a private (temporary) table in their temporary tablespace whenever they use the plan_table
    Their private data disappears when there session ends.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    There is a +"Preview"+ tab at the top of the text entry panel. Use this to check what your message will look like before you post the message. If it looks a complete mess you're unlikely to get a response. (Click on the +"Plain text"+ tab if you want to edit the text to tidy it up.)
    "Science is more than a body of knowledge; it is a way of thinking"
    Carl Sagan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to make PDF forms work in DreamWeaver

    How to make PDF forms work in Dreamweaver

    Look at DW's starter pages called "liquid" (FILE | New > Blank Page > "2 column, liquid" etc., or Google "liquid layouts".

  • Why do i have to keep clicking my left mouse button to make the program work it just stops and if left click it starts working

    Why do i have to keep clicking my left mouse button to make the program work it just stops and if left click it starts working. I'v only just started to use this program and It's no good at all if I go to a website and click a button I have to keep clicking it to finish what its doing.

    hello jeffsprig, can you try to replicate this behaviour when you launch firefox in safe mode once?
    [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    multiple other affected users have reported that this was an issue caused by malware on their pc. please run a scan of your system with [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner] and the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes].
    [[Troubleshoot Firefox issues caused by malware]]

  • Hi. I have a 2008 macbook pro 15.4 inch. Not abused but the hinge is stiff and the lid/ screen is starting to de-laminate at the bottom edge. Any ideas on how to make the hinge work a little more freely and how to re-seal the screen to the lid?

    Hi. I have a 2008 macbook pro 15.4 inch. Not abused but the hinge is stiff and the lid/ screen is starting to de-laminate at the bottom edge. Any ideas on how to make the hinge work a little more freely and how to re-seal the screen to the lid?

    When you have kernel panics, the pertinent information is in the panic report.
    These instructions must be carried out as an administrator. If you have only one user account, you are the administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    In the Console window, select
              DIAGNOSTIC AND USAGE INFORMATION ▹ System Diagnostic Reports
    (not Diagnostic and Usage Messages) from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar.
    There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points down. You'll see a list of reports. A panic report has a name that begins with "Kernel" and ends in ".panic". Select the most recent one. The contents of the report will appear on the right. Use copy and paste to post the entire contents—the text, not a screenshot.
    If you don't see any reports listed, but you know there was a panic, you may have chosen Diagnostic and Usage Messages from the log list. Choose DIAGNOSTIC AND USAGE INFORMATION instead.
    In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
    Please don’t post other kinds of diagnostic report.
    I know the report is long, maybe several hundred lines. Please post all of it anyway.

  • My ipad mini is totally drain and after plug it to regain the power its not working anymore.can somebody knows how to make my ipad work again

    my ipad mini is totally drain and after plug it to regain the power its not working anymore.can somebody knows how to make my ipad work again

    Reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

Maybe you are looking for