How to configure JSpinner to accept number of hours (with mins and secs)

I'm having a problem trying to figure out a simple way to enable a JSpinner to do allow the input in this format:
n hours : n minutes : n seconds
ex: 100 : 0 : 0, 1:59:59, 25:30:00
Where n hours could be from 0-n (not restricted by 24 hours) and minutes and seconds are, of course, < 60. That is, I can enter number of hours, not a date, or a specific time in a day.
I'm thinking the only way to do this is with a custom spinner model and custom editor? Or is there a simple way I can make the date model in spinner to allow me to do this?
Thanks

import java.awt.*;
import javax.swing.*;
import java.util.*;
public class Test2 extends JFrame {
  public Test2() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container content = getContentPane();
    content.setLayout(new FlowLayout());
    content.add(new MySpinner());
    setSize(300, 300);
    setVisible(true);
  public static void main(String args[]) { new Test2(); }
class MySpinner extends JSpinner {
  public MySpinner() {
    setModel(new SpinnerDateModel(
      new GregorianCalendar(2004,0,1,0,0,0).getTime(),
      null, null, Calendar.DAY_OF_YEAR));
    setEditor(new DateEditor(this,"HH:mm:ss"));
}???

Similar Messages

  • How to configure JConsole to connect to an agent with JMXMP and SASL Auth

    Hi,
    I have a standalone Java application which I am monitoring via JMX with the JMXMP protocol.
    I have just added SASL authentication, but now I'm not able to connect with JConsole anymore.
    Any pointers would be appreciated.
    I'm running Java 5.
    Thanks.

    Thanks, Ken.  I do have the Webex Application Scanning Bypass setting enabled already.  I agree it is unable to work via HTTPS due to the proprietary protocol the client is using.  It does seem to work sometimes, but isn't reliable.  I will research the logs, as you suggested.
    Thanks,
        Chris
    PS. Here is are the screenshots of the application.
    Message was edited by: Chris Gillham

  • I have an iphone4 and my husband merge his numbers with mine and i think it was deleted can you tell me how can he get his number back on his phone

    have an iphone4 and my husband merge his numbers with mine and i think it was deleted can you tell me how can he get his number back on his phone

    Do you possibly mean the contacts have been merged?
    If so, where are each of you syncing contacts?  A supported application on the computer? iCloud or another cloud service? An Exchange server?
    WIthout details, it's difficult to offer specific resolutions.

  • How do you change the phone number on an ipad mini in the imessage settings?

    How do you change the phone number on an ipad mini in the imessage settings?

    The Phone number of a Cellular iPad is assigned by the carrier the iPad is connected to.  Usually changing the sim card will change this number.
    If that is not what you mean can you please explain in more detail

  • My sprint service is off. How can I still use that number for iMessage with wifi instead of my apple id

    My sprint service is off. How can I still use that number for iMessage with wifi instead of my apple id?

    You can't. You can only use that number if you have active service.

  • How do I list the last n number of hours with respect to sysdate?

    I had a query regarding listing the last n number of hours with respect to sysdate?
    Say the current time is 1 AM, I want to get an output in the below format:
    1 AM
    12 AM
    11 PM
    10 PM
    9 PM...
    I know I can do it using a simple begin end block but I want the output to be returned in one single query.
    Any help would be very appreciated..

    Thanks!!
    I just figured it out as well!
    I used this:
    with hour_list as
         select trunc(sysdate- level/24,'HH') ,rownum
         from dual
         connect by level <=8
    select * from hour_list;

  • How do I sun all my messaging from phone, iPad mini, and macbook pro?

    How do I sun all my messaging from phone, iPad mini and MacBook Pro? I want to be able to see all my messages from any device? Thank you for the help in advance.

    Read this kb article for detailed instructions on how you can do this. I sync all of my messages from my iPhone, iPod Touch, iPad, and MacBook Pro.
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage

  • How long will power last on the iphone 5s with 4g and 3g and 2g?

    How long will power last on the iphone 5s with 4g and 3g and 2g?

    I don't think anybody would know the answer to your question.
    Nobody here knows how you use your phone.
    to answer your question test it out yourself.

  • How to I sync my 10.6.8 ical with icloud  and then to my ipad

    How to I sync my 10.6.8 ical with icloud  and then to my ipad

    I find that I can sync fine with Entourage and I cal under Leopard. I can also subscribe to the Leopard I-calendar on another computer (running Tiger). However, the calendar will not go onto a web page as it used to; this is very frustrating for my colleagues! We need a fix here I think.

  • How to configure network virtualization in SCVMM 2012 R2 with two host

    hi everyone... can you teach me how i configure networking in my infrastructure..
    i am getting confuse that i have 2 phisical server, i don't know to set the netwokring in scvmm. Every best practice, i found in internet is using more than 2 physical server.
    i have been tried before with the networking which i want..but it failed...
    any one help me please...

    This whitepaper should explain the required steps to get this working.
    http://gallery.technet.microsoft.com/Hybrid-Cloud-with-NVGRE-aa6e1e9a
    The whitepaper will use more than two hyper-v hosts, but you'll get the picture.
    You can have 1 host to run your NVGRE VMs, while the other host should be dedicated to run the virtualization gateway VMs.
    -kn
    Kristian (Virtualization and some coffee: http://kristiannese.blogspot.com )

  • How to configure workflow manager 1.0 ? Scenario "sharepoint 2013 and sql server 2012 workflow manager in one server" .

    i have sharepoint 2013 and sql server 2012 in one server . how to configure workflow manager 1.0 on the same server ?

    Please follow below technet article :
    http://technet.microsoft.com/en-us/library/jj658588(v=office.15).aspx
    Installing and Configuring Workflow Manager 1.0 (Step by Step)
    Note: The steps in this article apply to SharePoint Server 2013.
    The SharePoint 2013 Workflow platform is not supported in SharePoint Foundation 2013.
    If my contribution helps you, please click Mark As Answer on that post and
    Vote as Helpful
    Thanks, ShankarSingh(MCP)

  • How to configure SharePoint 2010 / 2013 Search for SQL Database Contents and Oracle Database Contents?

    Hi All,
    We are planning to maintain the contents in SQL / Oracle. Could you please suggest anyone which is best for SharePoint 2010 / 2013 Search. How to configure the search for external content source?
    Thanks & Regards,
    Prakash

    This link explains supported and non supported scenarios to use Oracle for BCS
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/453a3a05-bc50-45d0-8be8-cbb4e7fe7027/oracle-db-as-external-content-type-in-sharepoint-2013
    And here is more on it
    http://msdn.microsoft.com/en-us/library/ff464424%28office.14%29.aspx 
    And here how you can connect Oracle to SharePoint for BCS functionality
    http://lightningtools.com/bcs/business-connectivity-services-in-sharepoint-2013-and-oracle-using-meta-man/
    Overall it seems SQL doenn't require any special arrangement to connect BCS to SharePoint.
    Regards,
    Pratik Vyas | SharePoint Consultant |
    http://sharepointpratik.blogspot.com
    Posting is provided AS IS with no warranties, and confers no rights
    Please remember to click Mark As Answer if a post solves your problem or
    Vote As Helpful if it was useful.

  • How to Configure a Servlet Chain Using MIME Types with weblogic5.1?

    Hi ,
              I want to configure a servlet(cocoon) in weblogic 5.1 such that the
              servlet so configured is invoked each
              time a response with the mime-type "text/xml" is generated.
              1.) will weblogic support to configure a servlet with a particular
              mime-type so that it post-process any
              servlet's response with the corresponding mime-type?
              2.) if not what is the alternative?
              Thanks
              sumanth
              [sumo.vcf]
              

    We suggest that use the request dispatcher interface instead. Servlet
              chaining is not a standard's based possibility.
              Michael Girdley
              WLS Product Manager
              Sumanth Chinthagunta <[email protected]> wrote in message
              news:[email protected]..
              > Hi ,
              > I want to configure a servlet(cocoon) in weblogic 5.1 such that the
              > servlet so configured is invoked each
              > time a response with the mime-type "text/xml" is generated.
              > 1.) will weblogic support to configure a servlet with a particular
              > mime-type so that it post-process any
              > servlet's response with the corresponding mime-type?
              > 2.) if not what is the alternative?
              >
              > Thanks
              > sumanth
              >
              

  • How to configure my oracle jdeveloper 11g preview 4 with oracle 8i database

    hi every one
    my requrirement is to configure my oracle jdeveloper 11g preview 4 with oracle 8i database with (thin driver)
    thanks in advance

    Prapan,
    JDev 11g TP4 comes with 11g JDBC drivers, which do not support connecting to any database v 9.0.1 or earlier.
    So, back to you... depends upon what you want to do. If you want to write your own code to connect to a database using 11g, get ahold of some JDBC drivers that support 8i and have away. If you're talking about getting the database development stuff (e.g. the embedded SQLDeveloper) to work, you're probably out of luck.
    So, please define "configure my oracle jdeveloper 11g preview 4 with oracle 8i database"
    John

  • How do I set miminum # of connections for pool with Oracle and Tomcat?

    Hi,
    I can't seem to find any attribute to initialize the number of connections for my connection pool. Here is my current context.xml file under my /App1 directory:
    <Context path="/App1" docBase="App1"
    debug="5" reloadable="true" crossContext="true">
    <Resource name="App1ConnectionPool" auth="Container"
    type="oracle.jdbc.pool.OracleDataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    factory="oracle.jdbc.pool.OracleDataSourceFactory"
    url="jdbc:oracle:thin:@127.0.0.1:1521:oddjob"
    user="app1" password="app1" />
    </Context>
    I've been googling and reading forums, but haven't found a way to establish the minimum number of connections. I've tried all sorts of parameters like InitialLimit, MinLimit, MinActive, etc, with no success.
    Here is some sample code that I am testing:
    package web;
    import oracle.jdbc.pool.OracleDataSource;
    import oracle.jdbc.OracleConnection;
    import javax.naming.*;
    import java.sql.SQLException;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import java.util.Properties;
    public class ConnectionPool {
    String message = "Not Connected";
    public void init() {
    OracleConnection conn = null;
    ResultSet rst = null;
    Statement stmt = null;
    try {
    Context initContext = new InitialContext();
    Context envContext = (Context) initContext.lookup("java:/comp/env");
    OracleDataSource ds = (OracleDataSource) envContext.lookup("App1ConnectionPool");
    message = "Here.";
         String user = ds.getUser();
    if (envContext == null)
    throw new Exception("Error: No Context");
    if (ds == null)
    throw new Exception("Error: No DataSource");
    if (ds != null) {
    message = "Trying to connect...";
    conn = (OracleConnection) ds.getConnection();
    Properties prop = new Properties();
    prop.put("PROXY_USER_NAME", "adavey/xxx");
    if (conn != null) {
    message = "Got Connection " + conn.toString() + ", ";
              conn.openProxySession(OracleConnection.PROXYTYPE_USER_NAME,prop);
    stmt = conn.createStatement();
    rst = stmt.executeQuery("SELECT username, server from v$session where username is not null");
    while (rst.next()) {
    message = "DS User: " + user + "; DB User: " + rst.getString(1) + "; Server: " + rst.getString(2);
    rst.close();
    rst = null;
    stmt.close();
    stmt = null;
    conn.close(); // Return to connection pool
    conn = null; // Make sure we don't close it twice
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    // Always make sure result sets and statements are closed,
    // and the connection is returned to the pool
    if (rst != null) {
    try {
    rst.close();
    } catch (SQLException e) {
    rst = null;
    if (stmt != null) {
    try {
    stmt.close();
    } catch (SQLException e) {
    stmt = null;
    if (conn != null) {
    try {
    conn.close();
    } catch (SQLException e) {
    conn = null;
    public String getMessage() {
    return message;
    I'm using a utility to repeatedly call a JSP page that uses this class and displays the message variable. This utility allows me to specify the number of concurrent web requests and an overall number of requests to try. While that is running, I look at V$SESSION in Oracle and occassionaly, I will see a brief entry for app1 or adavey depending on the timing of my query and how far along the code has processed in this example. So it seems that I am only using one connection at a time and not a true connection pool.
    Is it possible that I need to use the oci driver instead of the thin driver? I've looked at the javadoc for oci and the OCIConnectionPool has a setPoolConfig method to set initial, min and max connections. However, it appears that this can only be set via Java code and not as a parameter in my context.xml resource file. If I have to set it each time I get a database connection, it seems like it sort of defeats the purpose of having Tomcat maintain the connection pool for me and that I need to implement my own connection pool. I'm a newbie to this technology so I really don't want to go this route.
    Any advice on setting up a proper connection pool that works with Tomcat and Oracle proxy sessions would be greatly appreciated.
    Thanks,
    Alan

    Well I did some more experiments and I am able to at least create a connection pool within my example code:
    package web;
    import oracle.jdbc.pool.OracleDataSource;
    import oracle.jdbc.OracleConnection;
    import javax.naming.*;
    import java.sql.SQLException;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import java.util.Properties;
    public class ConnectionPool {
    String message = "Not Connected";
    public void init() {
    OracleConnection conn = null;
    ResultSet rst = null;
    Statement stmt = null;
    try {
    Context initContext = new InitialContext();
    Context envContext = (Context) initContext.lookup("java:/comp/env");
    OracleDataSource ds = (OracleDataSource) envContext.lookup("App1ConnectionPool");
    message = "Here.";
         String user = ds.getUser();
    if (envContext == null)
    throw new Exception("Error: No Context");
    if (ds == null)
    throw new Exception("Error: No DataSource");
    if (ds != null) {
    message = "Trying to connect...";
    boolean cache_enabled = ds.getConnectionCachingEnabled();
    if (!cache_enabled){
    ds.setConnectionCachingEnabled(true);
    Properties cacheProps = new Properties();
    cacheProps.put("InitialLimit","5");
         cacheProps.put("MinLimit","5");
    cacheProps.put("MaxLimit","10");
    ds.setConnectionCacheProperties(cacheProps);
              conn = (OracleConnection) ds.getConnection();
    Properties prop = new Properties();
    prop.put("PROXY_USER_NAME", "adavey/xyz");
    if (conn != null) {
    message = "Got Connection " + conn.toString() + ", ";
              conn.openProxySession(OracleConnection.PROXYTYPE_USER_NAME,prop);
    stmt = conn.createStatement();
    //rst = stmt.executeQuery("SELECT 'Success obtaining connection' FROM DUAL");
    rst = stmt.executeQuery("SELECT user, SYS_CONTEXT ('USERENV', 'SESSION_USER') from dual");
    while (rst.next()) {
    message = "DS User: " + user + "; DB User: " + rst.getString(1) + "; sys_context: " + rst.getString(2);
    message += "; Was cache enabled?: " + cache_enabled;
    rst.close();
    rst = null;
    stmt.close();
    stmt = null;
    conn.close(OracleConnection.PROXY_SESSION); // Return to connection pool
    conn = null; // Make sure we don't close it twice
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    // Always make sure result sets and statements are closed,
    // and the connection is returned to the pool
    if (rst != null) {
    try {
    rst.close();
    } catch (SQLException e) {
    rst = null;
    if (stmt != null) {
    try {
    stmt.close();
    } catch (SQLException e) {
    stmt = null;
    if (conn != null) {
    try {
    conn.close();
    } catch (SQLException e) {
    conn = null;
    public String getMessage() {
    return message;
    In my context.xml file, I tried to specify the same Connection Cache Properties as attributes, but no luck:
    <Context path="/App1" docBase="App1"
    debug="5" reloadable="true" crossContext="true">
    <Resource name="App1ConnectionPool" auth="Container"
    type="oracle.jdbc.pool.OracleDataSource"
    driverClassName="oracle.jdbc.OracleDriver"
    factory="oracle.jdbc.pool.OracleDataSourceFactory"
    url="jdbc:oracle:thin:@127.0.0.1:1521:oddjob"
    user="app1" password="app1"
    ConnectionCachingEnabled="1" MinLimit="5" MaxLimit="20"/>
    </Context>
    These attributes seemed to have no effect:
    ConnectionCachingEnabled="1" ; also tried "true"
    MinLimit="5"
    MaxLimit="20"
    So basically if I could find some way to get these attributes set within the context.xml file instead of my code, I would be a happy developer :-)
    Oh well, it's almost Miller time here on the east coast. Maybe a few beers will help me find the solution I'm looking for.

Maybe you are looking for

  • Why can't I add Family Base to my plan?

    I have tried unsuccessfully many times to add Family Base to my plan. I have blocked numbers from calling/texting my son's phone, but it doesn't really help when he just calls them. I need to be able to block him from calling these people as well. He

  • SOAP Sender (500) Internal Server Error

    When calling a WebService defined in XI, I get the folloginw error: System.net.WebException: The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.CheckFinalStatus() at System.Net.HttpWebRequest.EndGetResponse

  • Can't delete master record when matching when matching detail record exist

    Hi on the rel. property: Delete Record Behaviour = cascading Prevent masterless Operation =yes Automatic Query = yesCan't delete Record Master & Detail... On delete getting error msg. Can't delete master record when matching when matching detail reco

  • Where can I download/g​et Windows 8 OEM if I have my product key

    My laptop messed up and now I have to re-install windows 8 which came with my laptop.  I tried to get it for free from the microsoft website because I have my product key but the retail version wont work for my computer because I need the OEM version

  • How do I stop numbers from automatically changing 8-6 to August 6, 2013?

    I'm making a work schedule for myself and on some days I work 8-6 but every time I type that in it changes it to August 6, 2013. How do I change the formula or whatever that is making that change automati