Component to display/change a time interval length

Hi all

I am trying to decide what would be the best component Swing to take the entry with a length of time. Ideally, I would prefer to avoid the user to type a number in the format (hh: mm: for example) which must be validated and have just a component that don't show / allow a valid entry. I had considered using a component JSpinner, from '00:00:00 ' and let the user 'spin' up to a certain number of hours, minutes, and seconds. In fact, the JSpinner would be ideal if I could work out how to do correctly view and edit this kind of value rather than the date values. At the moment I have a JSpinner configured to use a DateModel and DateEditor and initialized with a blank date. It works because I can ignore all but the values of the time in the date object so that the user can simply define an amount of time "since midnight" that I can effectively deal with the length of the interval. The problem is that using a configured router Date shows the time in a range of 12 hours from 12:00-01:59:59, at no time did the display check to 00:00:00, which, in my case, is that the user must start by as a value. So, to enter a time interval of, say, 30 minutes and 20 seconds, I set the spinner at 12:30:20, account held that currently is 30 minutes and 20 seconds elapsed since midnight.

Ideally, a time interval should not be tied to a date object at all, but if necessary, just a way of pursuading the spinner shows the time between midnight and 01:00 as departure 00 would be a way around the problem. The ideal solution would be an element that acts much like the Spinner which holds a value behind the scenes as a long in a few seconds, but this value in hh seconds formats for display and does not have the limitation of range 12 hours or 24 hours inherent to the Date in the format of the spinner. I suspect the editor used by a JSpinner and model manipulation could achieve this goal, but Oracle on JSpinners's article will little or no details on what can make a custom editor and how etc.

So, anyone know how I could reach or the other of these ends, displaying the time in a cone of Date from 0 rather than 12 or customize a router or another component to take a period of time as an input.

This code is indebted to Darryl Burke, Encephalopathic and Michael Dunn.
See [here. | http://forums.sun.com/thread.jspa?threadID=5337079]

import java.awt.*;
import javax.swing.*;

public class TimeSpinner extends JFrame {
  public TimeSpinner() {
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setLayout(new GridLayout(1,2, 0,5));
    JSpinner spin24 = new JSpinner(new SpinnerDateModel());
    spin24.setEditor(new JSpinner.DateEditor(spin24, "HH:mm:ss"));
    add(new JLabel("24 hours spinner"));
    add(spin24);
    pack();
    setVisible(true);
  }

  public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
      public void run() {
     new TimeSpinner();
      }
    });
  }
}

Hope that helps.

Tags: Java

Similar Questions

  • Change the time interval snapshot AWR

    Hello
    in 10g R2 how to change the AWR snapshot time interval of two hours?
    Thank you.

    Hello.

    exec dbms_workload_repository.modify_snapshot_settings (range-120 online);

    [http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_wkrpos.htm#BACEHJJI]

    Anand

    Published by: Anand... Aug 23, 2009 22:28

  • My computer disconnects me way too fast. How to change this time interval?

    It seems that if I turn my back for a minute, my HP desktop computer disconnects me and I have to re - enter the password.  A significant pain in the neck... How can I adjust this time interval?

    Hello

    Open windows control panel, open personalization, click on the link on the bottom right and in the next window, screen saver set time "Wait" to a more acceptable figure and Remove the tick in the box next to "in curriculum vitae, the logon screen.  Click on apply, then Ok to save the setting.

    Kind regards

    DP - K

  • Virtual Storage Manager - can't change instant planning time interval with vSphere Web Client

    Hello

    I try to activate Virtual Storage Manager schedules-model for a data store using vSphere Web Client. Everything works fine, but I can't change the time interval of planning of the snapshot. He remains at 12:00 midnight to 12:00 midnight. I can't change it manually or by dragging the bar.

    I tried with IE9, IE11, newer Chrome browsers. And with Flash versions 15 and 13-. Same mistake.

    I've added the URL of Sites you trust with weaker security settings - no help.

    Y at - it a bug or something else I can try?

    I just talked to Dell support on my problem and this is apparently a known issue with local Europe\UK.  The similarity of our problems might be useful - workaround for me was to settle the Locale\Regional from my PC, where I'm doing it in the United States.  Not the time zone or other settings, to control panel, then "Region and language", then on the first tab, 'Format' box should be set to "English (United States).  Close browsers, start again and it worked for me.

    Might be worth a try if you're not already in US format. (mine was in the United Kingdom).

  • Time interval in the output file is different from the sampling frequency

    Hello

    I'm a load at 1000 Hz. cell sampling I send information to the VI "write to a measurement file. When I opened the .tdms in excel, the time interval between samples is 0,00062 seconds instead of 0.001 seconds. Is it possible to change the time interval seconds a.001?

    Kind regards

    Johan Hendrikse

    It has sampling frequencies different - he has simply not an infinite number of them. I should have been a little more clear as to what I wanted. Have you read the specifications? Sampling frequencies are defined as 50 000 / n where n is an integer between 1 and 31. When you specify a rate, the driver will put it to the nearest that the material support. A little arithmetic shows that 50000/31.00062. How do you rate? Will this work with a DAQ Assistant?

  • Change the time for all slides display?

    Captivate 6, is there a way to say, "all the slides in this simulation of software have a display time of 3 seconds.  Change them all to 4? »

    Please tell me that I don't have to change the time individually for each slide display...

    Thank you

    JK

    It is very easy to do before the capture preferences, default, slide Defaults, duration of slide.

    But it's too late. No panic please don't try this way:

    1. Select all of the slides in the film (CTRL-A after selecting a slide)
    2. Change the length of time in general, just below the quality parameters.

    Lilybiri

  • When the value to display in the time format double digital indicator... Changes in value.

    Hi all

    I can't display the values that I want. I have a value double say 320 sent to a digital indicator where I edited the properties of it to display in a time format that contains only minutes and seconds as Yes, 3:20 '. Unfortunately, it takes the value and change it to another value and display that. I don't know what is the issue. If anyone knows the solution... Please post!

    There is an image attatched!

    Thank you.

    I believe only then due to the fact that when I convert a timestamp value to double as 03:20, he gave me 320. So I thought that the reverse can be trying. Should I just enter the total amount of seconds and that will show the Minuteseconds I want?

    Thanks for the quick response.

  • Watch OS 3 is unable to change the time display am/pm

    My question is, where I can set up the format of the time on my watch?

    My iPhone display am/pm, the time zone is correct, but now after the update I can not control the display of the time on my watch.

    I need support

    Hello

    On your iPhone, in the application of the watch, go to: Watch My > clock > disable it on 24 hours.

  • How can I get a graphic display in real time of a task daqmx

    Hello

    I have set up a task DAQmx using the DAQ assistant and the task is to work and produce a graph/data, but not before the task is complete. How can I get a display in real-time of the numberical values or graphics?

    Any help would be really appreciated

    Thanks, Paul

    paultryan wrote:

    I could get set the frequency of sampling and to give a regular change of output, but im looking to get this long-term data acquisition. For example, the graph changes everything but 1 - 5 get 30 minutes of data.

    I used the DAQ assistant and labview is completely new to me, if im not sure where it take it from here.

    concerning

    Then you should use a chart - not a graphic. A graph has a story. You must set this. Right click and select "Chart History Length".

  • Change to test interval

    I run a test of "Listening Mode" to collect statistics for our ESXi servers.  We would like to do so in a few days.  Is it possible to change the interval by which metrics are gathered?  It seems to be 20 seconds.  It would be also good to change settings that are captured.  For example, we don't care interruptions for this exercise.  The motivation for the setting of the interval and the metric is to reduce the disk space consumed by each test data.

    Hello

    To change the snapshot interval, you can do so via a http command:

    http:// : 8180, IOAnalyzer, ioanalyzer, script? command = set-naked-interval & value = 20

    You can change 20 at the interval that you need. The minimum interval of snapshot is 6 seconds (included), and the value must be an integer.

    Note that this change is NOT persistent, so you have to do it every time that you restart the controller of the virtual machine or restart the tomcat server.

    Because now we do not have an option to remove unnecessary counters since the underlying library, we always take a complete snapshot and we simply analyze and display the disk/network/CPU related counters.

    Thank you

    Dog-clerbois

  • My IPhone 6s did the update of battery charge you change the time manually or time zone. I wonder if the problem is in the IOS or mobile phone? I say that because I changed my IPhone in a Bar in engineering (Brazil) 6, precisely because of this problem an

    My IPhone 6s did the update of battery charge you change the time manually or time zone. I wonder if the problem is in the IOS or mobile phone? I say this because I have changed my 6 IPhone in a Bar of genius (Brazil), precisely because of this problem, and the new cell has exactly the same problem

    This is a known, problem if the time is not set correctly.

    us-not-displaying-accurate-battery-data http://AppleInsider.com/articles/16/01/16/Apple-promises-Fix-for-iPhone-6S-6S-pl

  • Constant changes of time stamp

    So I select a timestamp and assign a value.  I connect ot a conversion to get the number of seconds.

    Then I change the timezone on my computer and the time constant exchange.

    Why NOT call it a constant if it changes its value?

    The number of seconds remains the same, but the hours value is changed.

    This is not the kind of behavior, I expect.

    Thank you

    Mark

    The time constant is the universal time.  It is displayed as a time for your time zone.  So when you change your time zone, the value does not change, but the value display changes to the new time zone.  You can change the display format to display UTC instead, and time will not change.

    Thus, the time is a consant (which is obvious because the second time remained the same).

  • Display in real time with a delayed recording LV6.1

    Hi, I need help with LabView 6.1

    I have a hardware module FieldPoint where I read 8 channels for thermocouple. I want to display the value of the thermocouples in real time (or as close as I can manage) all saving the values in a CSV file at discrete time intervals (every 10 seconds). I am able to display the values in real-time, but the recorder real-time records, produce a lot too much data. I'm able to delay the recording interval, but in bulk then display in real time!

    The following example shows a method I've tried. The delay time in the loop of logging seems to delay the entire program. I also tried to use the loop of the logging of a sequence (using a simple delay of 'Wait') structure and a structure of matter (with a counter and only do the loop of logging real when the counter gets to 1). I tried to configure synchronous display without success.

    I'm having no luck and wonder if someone could point me in the right direction?

    Ah, the benefits of time.

    I think that I managed to create a solution for me using a different tact. Instead of using individual meters of delay, I used a "trigger time" approach as demonstrated in this thread;

    http://forums.NI.com/NI/board/message?board.ID=170&message.ID=286988&query.ID=6280650#M286988

    Currently, it is limited because it will allow only a delay of 59 seconds between the readings, but this should be relatively easy to solve. The solution works continuously update the display with a slight delay to help cope aging computers, and then the button "Log Data" is selected writing worksheet function is called second pushed together as selected. Quite a simple and elegant solution I think.

  • How to stop an application to change the time system?

    Hello

    I have an application that is affecting my time GMT system, but not the time zone.

    How to stop applications to change the time system.
    I run gpedit.msc and changed the policy of "change the time system" in person, and the request is received to change the system time.

    Help.

    Concerning
    TANIEL

    "TanielB" wrote in the new message: * e-mail address is removed from the privacy... *

    Hello

    I have an application that is affecting my time GMT system, but not the time zone.

    How to stop applications to change the time system.
    I run gpedit.msc and changed the policy of "change the time system" in person, and the request is received to change the system time.

    Help.

    Concerning
    TANIEL

    Are you sure that it is an application that is causing the problem?

    When you are connected to the Internet, Win XP will periodically synchronize with a time server.  If you have Win XP on the wrong time zone, your computer displays the local time 'bad '.

    Double click on the time (lower RH of your screen) and select the time zone tab.  Select the correct time zone for your location and check the DST box.  If necessary, change the time manually to your local time and save your changes.

    Then select the time tab Internet - and make sure that you have a server in the server field.  I use the time - a.nist.gov.  There are many alternative servers, including time.nist.gov and time.windows.com.  Click 'Update now'.

  • How can I change the time screen idol before it goes black?

    I need to know how to change the time that you set for when your screen becomes black for safety when you are in a public place and to go to the toilet or something foot. Where should I go to change the time limit, so I can't move my mouse while I watch a film to avoid my screen goes black?


    Hello kimberlyJennings,

    You can change the time display goes off by visiting the Power Options.

    1. open Control Panel.

    2. click on the power Option icon.

    3. in the power Option window, click on the map to change the settings in the section balanced (assuming you are using the balanced plan) favorite plans.

    4. within the parameters of change of plans: window balanced, you will see an option to "turn off the display.

    5. click on the down arrow in the right dialog box to disable display option (it should read 10 minutes or 20 minutes).

    6. in the drop-down list select never at the bottom of the list. You can, if you want to choose anything between the two but I prefer the display to never turn off.

    7. click the button to save the changes.

    8. finally get out of the power options window, and then close Control Panel.

    9. now, your screen is never extinguished.

    Please note that this also applies when you leave your PC to visit the toilet; your screen is never extinguished unless you select another option of time.

    This forum post is my own opinion and does not necessarily reflect the opinion or the opinion of Microsoft, its employees or other MVPS.

    John Barnett MVP: Windows XP Expert associated with: Windows Expert - consumer: www.winuser.co.uk |  vistasupport.mvps.org | xphelpandsupport.mvps.org | www.silversurfer-Guide.com

Maybe you are looking for

  • iMac 8.1 stuck on the apple logo

    Model: iMac8, 1 2.66 GHz Intel Core 2 Duo At 2BG memory when the problem started Mountain Lion 10.8.5 Is in trouble with occasional frosts. Would be closed and it should restart very well. About 2 weeks ago, the computer froze. I shut down the comput

  • NETGEAR d7800 modem

    I replaced my old modem Netgear with a d7800 X4S. I have service ADSL2 +. My laptop is able to connect to the internet- LG Smart TV is unable to access store LG or Netflix. I can surf the web. TiVo can not access the TIVO Services. WD TV Live Media p

  • Cannot insert a video screen or modify an existing one

    Hello Anyone know why I can't insert a video screen or change any existing? As shown in the screenshots all my video files options are grayed out.

  • Disable the BONES for permanent monitor

    I have connected my all in a "touch" to a laptop and say to use the thing only for a silent monitor.  Touch screen is NOT responsive. I have the monitor again all in one PC (android OS) to the computer laptop recovery for some time.  How can I turn o

  • Failed to create parser; line 179

    I received this message from line parser. Now when it turns on it keeps popping up with this message from the parser. I can't also farm down, restart, put the computer to sleep and System Restore does not work either. It will make all possible assist