Search Results

Search found 13488 results on 540 pages for 'calculator date calculation'.

Page 18/540 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • actionlistener not responding in java calculator

    - by tokee
    hi, please see calculator interface code below, from my beginners point of view the "1" should display when it's pressed but evidently i'm doing something wrong. any suggestiosn please? import java.awt.*; import javax.swing.*; import javax.swing.border.*; import java.awt.event.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; /** *A Class that operates as the framework for a calculator. *No calculations are performed in this section */ public class CalcFrame extends JPanel { private CalcEngine calc; private JFrame frame; private JTextField display; private JLabel status; /** * Constructor for objects of class GridLayoutExample */ //public CalcFrame(CalcEngine engine) //{ //frame.setVisible(true); // calc = engine; // makeFrame(); //} public CalcFrame() { makeFrame(); calc = new CalcEngine(); } class ButtonListener implements ActionListener { ButtonListener() { } public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("1")) { System.out.println("1"); } } } /** * This allows you to quit the calculator. */ // Alows the class to quit. private void quit() { System.exit(0); } // Calls the dialog frame with the information about the project. private void showAbout() { JOptionPane.showMessageDialog(frame, "Declan Hodge and Tony O'Keefe Group Project", "About Calculator Group Project", JOptionPane.INFORMATION_MESSAGE); } // ---- swing stuff to build the frame and all its components ---- /** * The following creates a layout of the calculator frame. */ private void makeFrame() { frame = new JFrame("Group Project Calculator"); makeMenuBar(frame); JPanel contentPane = (JPanel)frame.getContentPane(); contentPane.setLayout(new BorderLayout(8, 8)); contentPane.setBorder(new EmptyBorder( 10, 10, 10, 10)); /** * Insert a text field */ display = new JTextField(8); contentPane.add(display, BorderLayout.NORTH); //Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(4, 5)); JPanel buttonPanel = new JPanel(new GridLayout(4, 4)); contentPane.add(new JButton("9")); contentPane.add(new JButton("8")); contentPane.add(new JButton("7")); contentPane.add(new JButton("6")); contentPane.add(new JButton("5")); contentPane.add(new JButton("4")); contentPane.add(new JButton("3")); contentPane.add(new JButton("2")); contentPane.add(new JButton("1")); contentPane.add(new JButton("0")); contentPane.add(new JButton("+")); contentPane.add(new JButton("-")); contentPane.add(new JButton("/")); contentPane.add(new JButton("*")); contentPane.add(new JButton("=")); contentPane.add(new JButton("C")); contentPane.add(new JButton("CE")); contentPane.add(new JButton("%")); contentPane.add(new JButton("#")); //contentPane.add(buttonPanel, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); } /** * Create the main frame's menu bar. * The frame that the menu bar should be added to. */ private void makeMenuBar(JFrame frame) { final int SHORTCUT_MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); JMenuBar menubar = new JMenuBar(); frame.setJMenuBar(menubar); JMenu menu; JMenuItem item; // create the File menu menu = new JMenu("File"); menubar.add(menu); // create the Quit menu with a shortcut "Q" key. item = new JMenuItem("Quit"); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, SHORTCUT_MASK)); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { quit(); } }); menu.add(item); // Adds an about menu. menu = new JMenu("About"); menubar.add(menu); // Displays item = new JMenuItem("Calculator Project"); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showAbout(); } }); menu.add(item); } }

    Read the article

  • increment date by one month

    - by TIT
    hi let i have a date like it: 2010-12-11(year-mon-day) Now in php i want to increment it by one month. but when the month will be incremented, it will be automatically adjust years if needed. pls help. regards

    Read the article

  • Regex for date.

    - by Harikrishna
    What should be the regex for matching date of any format like 26FEB2009 30 Jul 2009 27 Mar 2008 29/05/2008 27 Aug 2009 What should be the regular expression for that ? Edit I have regex that matches with 26-Feb-2009 and 26 FEB 2009 with but not with 26FEB2009. So if any one know then please update it. (?:^|[^\d\w:])(?'day'\d{1,2})(?:-?st\s+|-?th\s+|-?rd\s+|-?nd\s+|-|\s+)(?'month'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[uarychilestmbro]*(?:\s*,?\s*|-)(?:'?(?'year'\d{2})|(?'year'\d{4}))(?=$|[^\d\w])

    Read the article

  • Date and Time Conversion in Ruby

    - by dkris
    I am currently looking on converting Thu Jun 10 16:17:55 +0530 2010 to 15/06/2010 or 15-06-2010 using Ruby I am getting the dates from the DB as shown below. @tickets = Ticket.find(:all) for ticket in @tickets print ticket.created_at end I have been looking around for resources as I a n00b in RoR/Ruby. I have looked at Class Date Class DateTime and couldn't make much of it. Please let me know how I could achieve this conversion in Ruby.

    Read the article

  • Using jQuery to find and then reformat a date string

    - by j-man86
    Hello, I currently am displaying dates as follows "yyyy/mm/dd" in a wordpress blog (it needs to be input in this format because a plugin is using it to define a post expiration date). I want to use jQuery to locate all of these strings on a page (they're all in table cells) and reformat them to "mm.dd.yy" The site is: http://www.beattrainsoundsystem.com/category/gigs The dates also exist in the footer on every page which I would also like to change. Thanks!

    Read the article

  • SQL CHECK constraint to prevent date overlap

    - by Michael
    I have a table that describes which software versions were installed on a machine at various times: machine_id::integer, version::text, datefrom::timestamp, dateto::timestamp I'd like to do a constraint to ensure that no date ranges overlap, i.e. it is not possible to have multiple software versions installed on a machine at the same time. How can this be achieved in SQL? I am using PostgreSQL v8.4.

    Read the article

  • App engine JPA date query

    - by waney
    Hi There. Assume I have object which represents TASK. Task have due date. How do I create query to get all tasks which are due today? Some working code like "select t from Task t where dueDate=:today" will be usefull. Thank you in advance.

    Read the article

  • Sharepoint 2007 calculated Date field shows incorrectly in non-US region

    - by Proforce
    If a SharePoint user (with Regional Settings set to UK) views a calculated date field in a View details form, the field shows incorrectly. I am using: ddwrt:FormatDateTime(string(@RenewalDate), 1033, 'dd MMMM yyyy') Which shows 04 January 2010 for 01/04/2010 and, doesnt show unresolvable dates such as 31-Dec-2010. This applies even with a simnple =[Modified] formula The Server is set up in the US for that locale.

    Read the article

  • how to add revision and build date to source

    - by gucki
    Hi! I have a gcc project and would like to automatically add defines for build date and revision number (from git) to my sources. What's the best way to do this? My goal is simple to be able to do something like this on startup: printf("Test app build on %s, revision %d", BUILD_DATE, REVISION) For building I'm using make with a simple Makefile.inc, not autoconf ot anything like this. Thanks, Corin

    Read the article

  • Jquery date in a adropdown with interval

    - by Zoom Pat
    I am trying to use Jquery to display dates in a dropdown with interval of half month... so the first value would be the coming month's 1st, then second will be the coming month's 15th and third value would be next to next month's first and so on... If today date is less than 15th then the first value would be the 15th of current month. What will be the best or a cleaner way to do this... (want to display in the dropdown) Thanks

    Read the article

  • Block the user from changing the System Date/Time

    - by Ananth
    We have a windows application (C# .net) and we'll be giving installers to client. The requirement is that once the application has been installed , user should not be able to edit the system time/date . This is to make sure that the application generated dates/reports are not manipulated. My target OS is Win-XP What is the best way to do that ? Does OS provide any facility to do that ? Thanks in Advance

    Read the article

  • Calculate date from numeric value

    - by elias
    The number 71867806 represents the present day, with the smallest unit of days. How can I calculate the currente date from it? (or) convert it into an Unix timestamp? Solution shouldn't use language depending features. Thanks!

    Read the article

  • Jquery date in a dropdown with interval

    - by Zoom Pat
    I am trying to use Jquery to display dates in a dropdown with interval of half month... so the first value would be the coming month's 1st, then second will be the coming month's 15th and third value would be next to next month's first and so on... If today date is less than 15th then the first value would be the 15th of current month. What will be the best or a cleaner way to do this... (want to display in the dropdown) Thanks

    Read the article

  • Date conversion in Java

    - by llm
    How can I take a string in a format such as: 2008-06-02 00:00:00.0 and convert it to: 02-Jun-2008? Can I somehow take the original string, convert it to a Date object, then use a formatter to get the final output (rather than parsing the string myself)? Thanks!

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >