Calendar in Swings !!

Is anybody aware of any util package for manipulating a calendar like object. It should display a proper calendar for a month with features like changing month and year, selecting any date by clicking on any day.

I have a date picker applet on a website, with code, which could very easily be converted to swing
http://michael-dunn.freeservers.com/java/DatePickerApplet.htm
the applet doesn't appear to display using the MS VM (probably because of the single swing component)

Similar Messages

  • Create Calendar in  Swing

    Hi,
    Can you teach me how to create calendar in Swing.I would like to have two portion,up portion is the year and month which can let me choose which year and which month and down portion is the calendar that shows year and month which i have selected from up portion. When i click on calendar, i would like to to do some actionperformed.
    Thanks.
    Regards,
    marcalena

    To create a month spinner
        String[] months= {" Jan "," Feb "," Mar "," Apr "," May "," June "," July "," Aug ",
                          " Sep "," Oct "," Nov "," Dec "};
        JSpinner monthSpinner = new JSpinner(new SpinnerListModel(months));You can do something simular for years or get more creative if you wish.
    Cheers
    DB

  • System Time +Calendar using Swing

    Hi
    I'm trying to create Swing Appliation that displays the System time.but i don't know how to display it on the window.I imported package from java.util.calendar.* but i dont know how to use it.
    Also how can i create Calendar with help swing appliation?
    Sorry for my post in this thread but i' wasn't sure where to post it.So posted here.

    maheshkale wrote:
    I'm trying to create Swing Appliation that displays the System time.but i don't know how to display it on the window.I imported package from java.util.calendar.* but i dont know how to use it.--------
    I've written up a little clock widget that extends JLabel, so it should work with any Swing application. Hope it's not too long... Feel free to edit it. The enums are just for looks and can be replace with something else.
    It just works off of a Timer every second to update the time in the label, and can display in various formats.
    import javax.swing.JLabel;
    import java.awt.event.*;
    import java.util.*;
    * Simple clock display for JComponents. Displays in a variety of formats.
    public class Clock extends JLabel implements ActionListener {
         private static final long serialVersionUID = 1L;
          * Day of week.
         public static enum Day {
               * Sunday (0).
              SUNDAY( "Sunday", "Sun" ),
               * Monday (1).
              MONDAY( "Monday", "Mon" ),
               * Tuesday (2).
              TUESDAY( "Tuesday", "Tues" ),
               * Wednesday (3).
              WEDNESDAY( "Wednesday", "Wed" ),
               * Thursday (4).
              THURSDAY( "Thursday", "Thu" ),
               * Friday (5).
              FRIDAY( "Friday", "Fri" ),
               * Saturday (6).
              SATURDAY( "Saturday", "Sat" );
               * Full name of this day.
              public String name;
               * Shortened name of this day.
              public String s;
              Day( String name, String s ) {
                   this.name = name;
                   this.s = s;
          * A month of the year.
         public static enum Month {
               * January (0)
              JANUARY( "January", "Jan" ),
               * February (1).
              FEBRUARY( "February", "Feb" ),
               * March (2).
              MARCH( "March", "Mar" ),
               * April (3).
              APRIL( "April", "Apr" ),
               * May (4).
              MAY( "May", "May" ),
               * June (5).
              JUNE( "June", "Jun" ),
               * July (6).
              JULY( "July", "Jul" ),
               * August (7).
              AUGUST( "August", "Aug" ),
               * September (8).
              SEPTEMBER( "September", "Sep" ),
               * October (9).
              OCTOBER( "October", "Oct" ),
               * November (10).
              NOVEMBER( "November", "Nov" ),
               * December (11).
              DECEMBER( "December", "Dec" );
               * Full name of this month.
              public String name;
               * Shortened name of this month.
              public String s;
              Month( String name, String s ) {
                   this.name = name;
                   this.s = s;
          * This clock should display in words and numbers.
         public static final int ALPHANUMERIC = 1;
          * This clock should display in numbers.
         public static final int NUMERIC = 2;
          * This clock should only display the date.
         public static final int DATEONLY = 0;
          * This clock should display both date and time.
         public static final int DATETIME = 1;
          * This clock should display only the current hh:mm:ss time.
         public static final int TIMEONLY = 2;
          * Convenience value to mean the default choices (Date and Time in words and
          * numbers).
          * @see #ALPHANUMERIC
          * @see #DATETIME
         public static final int DEFAULT = 1;
         protected int display, what;
         protected javax.swing.Timer timer;
          * Create a new Clock with given display details and horizontal alignment.
          * <p>
    Display:<code><ul><li>ALPHA</li><li>ALPHANUMERIC</li><li>NUMERIC</li></ul></c
    ode>
          * </p>
          * <p>
    What:<code><ul><li>DATEONLY</li><li>DATETIME</li><li>TIMEONLY</li></ul></code
    >
          * </p>
          * The value <code>DEFAULT</code> applies for both.
          * <hr />
          * See <code>javax.swing.JLabel( String, int )</code>
          * @param display
          * @param what
          * @param align
         public Clock( int display, int what, int align ) {
              super( "", align );
              setDisplay( display );
              setWhat( what );
              timer = new javax.swing.Timer( 1000, this );
              timer.start();
         public void actionPerformed( ActionEvent evt ) {
              setText( getFormattedTime( display, what ) );
          * Get how this clock displays.
          * @return display
         public int getDisplay() {
              return display;
          * Get what this clock displays.
          * @return what
         public int getWhat() {
              return what;
          * Set how this clock displays.
          * @see #ALPHANUMERIC
          * @see #NUMERIC
          * @see #DEFAULT
          * @param display
          *        New <code>display</code> int.
         public void setDisplay( int display ) {
              this.display = display;
          * Set what this clock displays.
          * @see #DATEONLY
          * @see #DATETIME
          * @see #TIMEONLY
          * @see #DEFAULT
          * @param what
          *        New <code>what</code> int.
         public void setWhat( int what ) {
              this.what = what;
          * Get a formatted string of the current time according to given details.
          * @param display
          *        How to display.
          * @param what
          *        What to display.
          * @return Formatted <code>String</code>.
         public static String getFormattedTime( int display, int what ) {
              String ret = "";
              Calendar cal = Calendar.getInstance();
              switch ( what ) {
                   case DATEONLY:
                        int m = cal.get( Calendar.MONTH );
                        int d = cal.get( Calendar.DAY_OF_MONTH );
                        int w = cal.get( Calendar.DAY_OF_WEEK );
                        int y = cal.get( Calendar.YEAR );
                        switch ( display ) {
                             case ALPHANUMERIC: // dow, Mmm dd, yyyy
                                  Day wk = Day.values()[ w ];
                                  Month mn = Month.values()[ m ];
                                  ret += wk.name + ", " + mn.name + " ";
                                  ret += String.valueOf( d ) + getAfter( d );
                                  ret += ", " + String.valueOf( y );
                                  break;
                             case NUMERIC: // mm/dd/yyyy
                                  ret += String.valueOf( m ) + "/";
                                  ret += String.valueOf( d ) + "/";
                                  ret += String.valueOf( y );
                                  break;
                             default:
                        break;
                   case DATETIME:
                        ret += getFormattedTime( DATEONLY, what );
                        ret += " " + getFormattedTime( TIMEONLY, what );
                        break;
                   case TIMEONLY:
                        int hou = cal.get( Calendar.HOUR );
                        int min = cal.get( Calendar.MINUTE );
                        int sec = cal.get( Calendar.SECOND );
                        switch ( display ) {
                             case ALPHANUMERIC: // time is only numeric
                             case NUMERIC:
                                  ret += asString( hou ) + ":";
                                  ret += asString( min ) + ":";
                                  ret += asString( sec );
                        break;
                   default:
              return ret;
          * Format a number and return a string of length 2, with 0 preceeding any
          * value.
          * @param num
          *        Number to format.
          * @return "00", "0#", "##", etc...
         public static String asString( int num ) {
              String ret = String.valueOf( num );
              for ( int i = ret.length(); i <= 2; i++ ) {
                   ret += "0";
              return ret;
          * Return the "st", "rd", etc... after <code>day</code>.
          * @param day
          *        Day of month, 1-31
          * @return String
         public static String getAfter( int day ) {
              String ret = "";
              switch ( day ) {
                   case 1:
                        ret = "st";
                        break;
                   case 2:
                        ret = "nd";
                        break;
                   case 3:
                        ret = "rd";
                        break;
                   case 21:
                        ret = "st";
                        break;
                   case 22:
                        ret = "nd";
                        break;
                   case 23:
                        ret = "rd";
                        break;
                   case 31:
                        ret = "st";
                        break;
                   default:
                        ret = "th"; // everything else
              return ret;
    }Edited by: aaronabaci on Jan 6, 2008 9:49 PM

  • How to pop a virtual calendar with a click of button in swing applications

    How to pop a virtual calendar with a click of button in swing applications
    Does anyone knows how to pop up a virtual calendar in swing applications when there is a click of button. Do u have any components plug in tutorials or free java components download. Does java allows to used Microsoft calendar active x to plug into java applications. Thanks

    If you want a simple date picker, try this one
    http://forum.java.sun.com/thread.jspa?threadID=620699&messageID=3497753its a stand alone, but can be easily modified to include in a popup, and,
    instead of displaying the date:
    - passing the 'date picked' back to the calling object
    - close the popup

  • JCE requires: java.lang.RuntimePermission requires accessClassInPackage.sun.security.provider

    I'm trying to use the JCE with JWS1.0.2. All I want to do is generate a KeyPair and I can NOT use a signed application. The code is:
    public static KeyPair genDHKeyPair() throws Exception {
    // properties...
    DHParameterSpec dhSkipParamSpec;
    dhSkipParamSpec = new      DHParameterSpec(skip1024Modulus, skip1024Base);
    KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DH");
    keyPairGenerator.initialize(dhSkipParamSpec);
    KeyPair keyPair = keyPairGenerator.generateKeyPair();
    return keyPair;
    I'm using JDK1.4. This code works fine outside of JWS.
    If I call this code I get an exception that states I need the stated RuntimePermission. IMHO this is a bug because I should be able to make use of simple standard extension methods like this. Is getting an instance of a KeyPairGenerator and generating a key pair a security risk?
    The fix for this should be a simple addition to the security policy for JWS which gives SUN javax.crypto code access to the appropriate RuntimePermission.
    Can anyone think of a reason why NOT to do this?
    Thank you.
    BTW, here's the Exception you would get if you tried this:
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.security.provider)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
         at java.security.AccessController.checkPermission(AccessController.java:401)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
         at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1513)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:262)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
         at com.wss.calendar.client.swing.Main.main(Main.java:47)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sun.javaws.Launcher.executeApplication(Launcher.java:739)
         at com.sun.javaws.Launcher.executeMainClass(Launcher.java:701)
         at com.sun.javaws.Launcher.continueLaunch(Launcher.java:584)
         at com.sun.javaws.Launcher.handleApplicationDesc(Launcher.java:328)
         at com.sun.javaws.Launcher.handleLaunchFile(Launcher.java:166)
         at com.sun.javaws.Launcher.run(Launcher.java:134)
         at java.lang.Thread.run(Thread.java:536)

    hi there,
    Please I have the same problem in an applet that uses DSA with the following call:
    pkey = (PublicKey) new DSAPublicKey(server_pub_key);
    The Exception i am having on the console is
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.security.provider)
    Note that I am NOT using JCE and that both netscape and IE browsers gave this error
    Can somebody help me please?
    Thanks in advance,
    JPDib

  • JDk1.5.0beta3build58 security bug

    JWS isn't working with third party look and feel implementations wrt the FileOpenService.
    This seems to be a regression to 1.4.1 behaviour where I had to manually set the look and feel to the System LNF before trying to use the FileOpenService. I'm using JGoodies 1.2.2.
    I do not see this with JDk1.5.0 beta2.
    java.security.AccessControlException: access denied (java.io.FilePermission / read)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
         at java.security.AccessController.checkPermission(AccessController.java:427)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
         at java.io.File.exists(File.java:700)
         at javax.swing.filechooser.FileSystemView.getSystemDisplayName(FileSystemView.java:153)
         at javax.swing.plaf.basic.BasicFileChooserUI$BasicFileView.getName(BasicFileChooserUI.java:1157)
         at javax.swing.JFileChooser.getName(JFileChooser.java:1470)
         at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxRenderer.getListCellRendererComponent(MetalFileChooserUI.java:842)
         at javax.swing.plaf.basic.BasicComboBoxUI.getDisplaySize(BasicComboBoxUI.java:1182)
         at com.jgoodies.plaf.plastic.PlasticComboBoxUI.getMinimumSize(PlasticComboBoxUI.java:115)
         at javax.swing.plaf.basic.BasicComboBoxUI.getPreferredSize(BasicComboBoxUI.java:855)
         at javax.swing.JComponent.getPreferredSize(JComponent.java:1582)
         at javax.swing.plaf.metal.MetalFileChooserUI$1.getPreferredSize(MetalFileChooserUI.java:211)
         at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:690)
         at java.awt.Container.preferredSize(Container.java:1558)
         at java.awt.Container.getPreferredSize(Container.java:1543)
         at javax.swing.JComponent.getPreferredSize(JComponent.java:1584)
         at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:695)
         at javax.swing.plaf.metal.MetalFileChooserUI.getPreferredSize(MetalFileChooserUI.java:546)
         at javax.swing.JComponent.getPreferredSize(JComponent.java:1582)
         at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:690)
         at java.awt.Container.preferredSize(Container.java:1558)
         at java.awt.Container.getPreferredSize(Container.java:1543)
         at javax.swing.JComponent.getPreferredSize(JComponent.java:1584)
         at javax.swing.JRootPane$RootLayout.preferredLayoutSize(JRootPane.java:824)
         at java.awt.Container.preferredSize(Container.java:1558)
         at java.awt.Container.getPreferredSize(Container.java:1543)
         at javax.swing.JComponent.getPreferredSize(JComponent.java:1584)
         at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:690)
         at java.awt.Container.preferredSize(Container.java:1558)
         at java.awt.Container.getPreferredSize(Container.java:1543)
         at java.awt.Window.pack(Window.java:478)
         at javax.swing.JFileChooser.createDialog(JFileChooser.java:772)
         at javax.swing.JFileChooser.showDialog(JFileChooser.java:708)
         at javax.swing.JFileChooser.showOpenDialog(JFileChooser.java:620)
         at com.sun.jnlp.FileOpenServiceImpl$1.run(FileOpenServiceImpl.java:95)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.jnlp.FileOpenServiceImpl.openFileDialog(FileOpenServiceImpl.java:74)
         at com.wss.calendar.client.swing.ScheduleWorldFrame.jMenuItemFileImportFileCSV_actionPerformed(ScheduleWorldFrame.java:7402)
         at com.wss.calendar.client.swing.ScheduleWorldFrame$86.actionPerformed(ScheduleWorldFrame.java:4239)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1766)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

    Looks like the original bug (4772834), which was really in javax.swing.filechooser.FileSystemView.getSystemDisplayName, where it opened a file w/o wrapping call in a doPrivilige() block, was worked around in Java Web Start 1.5.0 beta 1, by putting the whole FileChooserDialog, along with the Security Dialog surronding it, in the Look and Feel of Java Web Start.
    This caused regressions (by running Dialogs with differant Look and Feels in the same AppCOntext) such as the one in the TCK test ( 5060636 ), which were fixed in b57 by partially removing the original fix, so now the original bug is back.
    I will re-open it.
    /Dietz

  • UIManager ClassPath ignored? (access violation)

    Appologies if this is a second post, but I do not believe my previous post worked. I do not see it in the list of topics...
    I've encountered a serious problem: I can not use any 3rd party look and feel
    implementations inside the Java Web Start secure sandbox. More specifically,
    they work unless you use the FileOpenService or FileSaveService, which bring
    up a JChooser with UI components that are in the wrong ClassLoader and cause
    access violation exceptions.
    Some code I have tried to (unsuccessfully) work around this problem:
    // Attempt #1
    ClassLoader jwsClassLoader = this.getClass().getClassLoader();
    UIManager.put("ClassLoader", jwsClassLoader);
    SlafLookAndFeel slaf = new SlafLookAndFeel("com.memoire.slaf.SlafLookAndFeel"); UIManager.setLookAndFeel(slaf);
    This brings up the SLAF look and feel for everything but the FileOpenService.
    Exception pasted below.
    // Attempt #2
    // After executing the above code, I also run this:
    Hashtable tb = UIManager.getDefaults();
    tb.put("ClassLoader", jwsClassLoader);
    Enumeration e = tb.keys();
    while (e.hasMoreElements()) {
    Object obj = e.nextElement();
    if (! (obj instanceof String))
    continue;
    String k = (String)obj;
    if (k.endsWith("UI")) {
    Class uic;
    try {
    uic = jwsClassLoader.loadClass(tb.get(k).toString());
    } catch(Exception ex) {
    // classnotfound...
    continue;
    tb.put(uic.getName(), uic);
    Again, this does not help.
    // Attempt #3
    In Sun bug:4155617 the username 'awiner' posted a message that contained
    some code to register your own ClassInstantiator (implements UIDefaults.LazyValue)
    I would like to try this, but I do not know how to use the code presented.
    I think it needs to be integrated within the Look and Feel code?
    Here's the exception:
    java.security.AccessControlException: access denied (java.io.FilePermission /tmp read)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
    at java.security.AccessController.checkPermission(AccessController.java:401) at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
    at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
    at java.io.File.exists(File.java:677)
    at javax.swing.filechooser.FileSystemView.getSystemDisplayName(FileSystemView.java:140)
    at javax.swing.plaf.basic.BasicFileChooserUI$BasicFileView.getName(BasicFileChooserUI.java:1005)
    at javax.swing.JFileChooser.getName(JFileChooser.java:1437)
    at com.memoire.slaf.SlafFileChooserUI$DirectoryComboBoxRenderer.getListCellRendererComponent(SlafFileChooserUI.java:605)
    at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147) at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1097)
    at javax.swing.plaf.basic.BasicListUI$ListSelectionHandler.valueChanged(BasicListUI.java:1465)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:187)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:214)
    at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:402)
    at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:411)
    at javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:435)
    at javax.swing.JList.setSelectedIndex(JList.java:1730)
    at javax.swing.plaf.basic.BasicComboPopup.setListSelection(BasicComboPopup.java:998)
    at javax.swing.plaf.basic.BasicComboPopup.access$000(BasicComboPopup.java:43)
    at javax.swing.plaf.basic.BasicComboPopup$ItemHandler.itemStateChanged(BasicComboPopup.java:782)
    at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1161)
    at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1218)
    at javax.swing.JComboBox.contentsChanged(JComboBox.java:1265)
    at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
    at com.memoire.slaf.SlafFileChooserUI$DirectoryComboBoxModel.setSelectedItem(SlafFileChooserUI.java:751)
    at com.memoire.slaf.SlafFileChooserUI$DirectoryComboBoxModel.addItem(SlafFileChooserUI.java:746)
    at com.memoire.slaf.SlafFileChooserUI$DirectoryComboBoxModel.access$500(SlafFileChooserUI.java:665)
    at com.memoire.slaf.SlafFileChooserUI$1.propertyChange(SlafFileChooserUI.java:500)
    at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:264)
    at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:232)
    at javax.swing.JComponent.firePropertyChange(JComponent.java:3814)
    at javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:541)
    at javax.swing.JFileChooser.<init>(JFileChooser.java:333)
    at com.sun.jnlp.FileOpenServiceImpl$1.run(FileOpenServiceImpl.java:82)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.jnlp.FileOpenServiceImpl.openFileDialog(FileOpenServiceImpl.java:73) at com.wss.calendar.client.swing.InfoHTML.jButtonUpload_actionPerformed(InfoHTML.java:217)
    at com.wss.calendar.client.swing.InfoHTML$3.actionPerformed(InfoHTML.java:146) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
    at java.awt.Component.processMouseEvent(Component.java:5093)
    at java.awt.Component.processEvent(Component.java:4890)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
    at java.awt.Container.dispatchEventImpl(Container.java:1609)
    at java.awt.Window.dispatchEventImpl(Window.java:1585)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:140)
    at java.awt.Dialog.show(Dialog.java:538)
    at java.awt.Component.show(Component.java:1134)
    at java.awt.Component.setVisible(Component.java:1089)
    at com.wss.calendar.client.swing.ScheduleWorldFrame.showInfoView(ScheduleWorldFrame.java:2247)
    at com.wss.calendar.client.swing.ScheduleWorldFrame.jMenuItem14_actionPerformed(ScheduleWorldFrame.java:2226)
    at com.wss.calendar.client.swing.ScheduleWorldFrame$44.actionPerformed(ScheduleWorldFrame.java:1127)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1109) at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)
    at java.awt.Component.processMouseEvent(Component.java:5093)
    at java.awt.Component.processEvent(Component.java:4890)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
    at java.awt.Container.dispatchEventImpl(Container.java:1609)
    at java.awt.Window.dispatchEventImpl(Window.java:1585)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

    Hi,
    I am using jdk1.1.6 and personal oracle 8.0.3.0.0.
    I set my classpath to [home]\jdbc\lib\classes111.zip.
    (I am not sure how to try with thin driver to make sure
    everything else is ok).
    I hope you guys got the information to suggest me some solution
    to the problem below. I would greately appeciate if any help to
    solve the problem..
    Thank you,
    Sreenivas.
    Oracle Product Development Team wrote:
    : Need more information :
    : What JDK are you using ?
    : What is the Server version ?
    : Try with THIN to make sure that everything else is okay
    : Sreenivas Kompelli (guest) wrote:
    : : I have Oracle 8i trial version installed on my NT work
    : station.
    : : After configuring the CLASSPATH and PATH, When I try to run a
    : : sample example from files given (I am just trying to connect
    to
    : : the database using JDBC oracle/oci, and display the EMP
    table).
    : : I am getting a Windows internal Error "Exception: Access
    : : Violation (0xc0000005).
    : : I have no clue what to do.. I would greately appeciate if any
    : : help to solve this problem..
    : : Thanks
    : : Sreenivas
    : Oracle Technology Network
    : http://technet.oracle.com
    null

  • How can I code around this: RuntimePermission accessClassInPackage

    (JDK1.4)
    I'm using JCE in Java Web Start without this permission.
    The code I'm using very simple:
    DHParameterSpec dhSkipParamSpec;
    dhSkipParamSpec = new DHParameterSpec(skip1024Modulus, skip1024Base);
    KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DH");
    keyPairGenerator.initialize(dhSkipParamSpec);
    KeyPair keyPair = keyPairGenerator.generateKeyPair();
    This code tries to access the code in a sun.security.provider which throws the stack trace below.
    Of course, the code works without a SecurityManager. I'm likely fubar'd with JWS and above code.
    Is my only option to investigate complete JCE rewrites like IAIK so I can make it part of my classpath (and security policy)??
    Thank you.
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.security.provider)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
         at java.security.AccessController.checkPermission(AccessController.java:401)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
         at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1513)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:262)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
         at com.wss.calendar.client.swing.Main.main(Main.java:47)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sun.javaws.Launcher.executeApplication(Launcher.java:739)
         at com.sun.javaws.Launcher.executeMainClass(Launcher.java:701)
         at com.sun.javaws.Launcher.continueLaunch(Launcher.java:584)
         at com.sun.javaws.Launcher.handleApplicationDesc(Launcher.java:328)
         at com.sun.javaws.Launcher.handleLaunchFile(Launcher.java:166)
         at com.sun.javaws.Launcher.run(Launcher.java:134)
         at java.lang.Thread.run(Thread.java:536)

    Sign it and also specify the "all-permissions" in your deployment descriptor

  • Free advanced controls

    Hi guys,
    I need your help on a swing question.
    I did many researches on the web but I didn't find any useful result.
    Does exists some good free library for swing project?
    Is there a free library for use advances textbox, calendar or other controls?
    I mean, to make a comparison, something like good primafaces for web..
    I sayd it cause I need to develop a appointment calendar in swing and I can't find anything more than standard calendar...
    Do you have some link for me?
    Thanks,
    Regards

    I thought I remember Kleopatra posting a Calendar widget for trial on the old Sun forums for the SwingX project.
    I couldn't find it on their new website ( http://swinglabs.org/index.jsp ) though, since the JNLP demos weren't working for me.
    Perhaps she can chime in to shed some light on its status.

  • Searching a calendar swing component

    Hello friends.
    I'm looking for a calendar swing component, to make a schedule aplication (like Outlook).
    I found "Mig Java Calendar" (http://www.migcalendar.com/index.php) but it isn't free, i need one like this free.
    Do you know someone free?
    Thank you.

    And if you think, as I do, that a date picker is
    standard component and should be part of the jdk,
    please vote here:
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=473
    0041
    -Pucethat is really helpful. I voted for it.

  • Swing Calendar Component

    Hi,
    Commonly enough; in my Swing app I need to display a calendar of dates.
    I've been looking for third-party components (both free and commercial) as building my own seems daft really. However, most seem to be primarily "date pickers". What I need is something that indicates "busy days" (days with an entry booked on them) on the calendar display.
    Can anyone point me to any good ones? I see there are loads out there. I'd happily take a good/pretty "date picker" and add to it if I can get the source code.
    I've looked at so many through Google that I don't know which to invest my time - and potentially money - in.
    Many thanks

    is there a calendar component in the jdk or an open source component?The forum has a search facility. Its really not that difficult to think of search words. The words in your subject title will do just fine.

  • Does Swing have a calendar widget that can be connected to a JFormattedText

    Does Swing have a calendar widget that can be connected to a JFormattedTextField? I want to be able to either type a date into the field, or click an arrow and choose the date from the widget.
    Thanks,
    Matt

    http://freshmeat.net/projects/jcalendar4swing/
    http://sourceforge.net/projects/jcalendar
    You will have to perform the linking to your text field yourself.

  • Jcalendar Java Swing Calendar

    I've implemented this into my application:
    http://forms.pjc.bean.over-blog.com/article-14848846.html
    Now suddenly the Calendar is no longer showing up on my canvas. I must have changed something that has stopped it from popping up? I click the button and the code fires without error, but no calendar is displayed. Has anyone else experienced this? Do you have any suggestions?
    I have both the Calendar push button and the Bean object on seperate, non-base table control block and the item it populates is on my main base-table canvas.
    The push button code is:
    go_item('induction_info.drop_dt');
    Set_Custom_Property('CTRL.BEAN',1, 'SET_PROPERTY','title,Drop Date');
    Set_Custom_Property('CTRL.BEAN',1, 'SHOW_CALENDAR','50,50');
    Thanks in advance.

    In the event anyone runs into this issue going forward...
    I had changed the 'Database Block Property' of my control block from 'Yes' to 'No' at some point. I changed it back to 'Yes' and now the calendar is displaying again. Especially strange to me in that my control block is does not specify a base table and no items on the control block are base-table items.

  • Is there a way to add event details using a calendar object vs. those dumb field entry boxes?

    I have switched from PC to Mac over a year and a half ago, and have been plagued with the "dumb" date entry boxes in iCal and now Reminders on the mac. For one, they don't show you the DAY OF WEEK for an event, it assumes you are parked on that day, but of course reality sets in and causes constant date changes for events. Picking a date in the future would be much more helpful if Apple followed some usability norms in iCal. For instance, if you are booking a flight online, those helpful little calendar objects pop up, and further, they are smart about "end dates and times" for events, knowing it can't be earlier than the start date. Apple iCal unfortunately always thinks you are creating an ALL DAY event, and when you change the start time, it creates the end time for the next day. Not very smart. Or is it me that is not very smart for constantly hawking every little data entry field for correctness. Why, oh why dear lord has Apple not given some usability attention to iCal on the mac??? At least match the interface of the iPhone with a nice little slot machine rolling control.
    Is there an add in?
    Is there hope that Apple will ever fix its lagging Mail and iCal apps on the Mac?
    Please advise. Or just offer a kind word of consolation if there is no hope for a better interface.

    In the future, Swing related questions should be posted in the Swing forum.
    The code you posted is of little use since it uses custom classes so we can't see the behaviour of your code.
    In general if you add a component to a Container at run time then you just use
    container.revalidate()
    This will invoke the LayoutManager and repaint the components in the container based on the new layout.

  • How to create the digital clock in java swing application ?

    I want to create the running digital clock in my java swing application. Can someone throw some light on this how to do this ? Or If someone has done it then can someone pl. paste the code ?
    Thanks.

    hi prah_Rich,
    I have created a digital clock you can use. You will most likely have to change some things to use it in another app although that shouldn't be too hard. A least it can give you some ideas on how to create one of your own. There are three classes.One that creates the numbers. a gui class and frame class.
    cheers:)
    Hex45
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.geom.*;
    public class DigitalClock extends Panel{
              BasicStroke stroke = new BasicStroke(4,BasicStroke.CAP_ROUND,
                                               BasicStroke.JOIN_BEVEL);
              String hour1, hour2;
              String minute1, minute2;
              String second1, second2;
              String mill1, mill2, mill3;
              int hr1, hr2;
              int min1, min2;
              int sec1, sec2;
              int mll1, mll2,mll3;       
        public void update(Graphics g){
             paint(g);
         public void paint(Graphics g){
              Graphics2D g2D = (Graphics2D)g;
              DigitalNumber num = new DigitalNumber(10,10,20,Color.cyan,Color.black);     
              GregorianCalendar c = new GregorianCalendar();
              String hour = String.valueOf(c.get(Calendar.HOUR));
              String minute = String.valueOf(c.get(Calendar.MINUTE));
              String second = String.valueOf(c.get(Calendar.SECOND));
              String milliSecond = String.valueOf(c.get(Calendar.MILLISECOND));
              if(hour.length()==2){
                   hour1 = hour.substring(0,1);
                   hour2 = hour.substring(1,2);
              }else{
                   hour1 = "0";
                   hour2 = hour.substring(0,1);
              if(minute.length()==2){
                   minute1 = minute.substring(0,1);
                   minute2 = minute.substring(1,2);
              }else{
                   minute1 = "0";
                   minute2 = minute.substring(0,1);
              if(second.length()==2){
                   second1 = second.substring(0,1);
                   second2 = second.substring(1,2);
              }else{
                   second1 = "0";
                   second2 = second.substring(0,1);
              if(milliSecond.length()==3){
                   mill1 = milliSecond.substring(0,1);
                   mill2 = milliSecond.substring(1,2);
                   mill3 = milliSecond.substring(2,3);
              }else if(milliSecond.length()==2){
                   mill1 = "0";
                   mill2 = milliSecond.substring(0,1);
                   mill3 = milliSecond.substring(1,2);
              }else{
                   mill1 = "0";
                   mill2 = "0";
                   mill3 = milliSecond.substring(0,1);
              hr1  = Integer.parseInt(hour1);     
              hr2  = Integer.parseInt(hour2);
              min1 = Integer.parseInt(minute1);
              min2 = Integer.parseInt(minute2);
              sec1 = Integer.parseInt(second1);
              sec2 = Integer.parseInt(second2);
              mll1 = Integer.parseInt(mill1);
              mll2 = Integer.parseInt(mill2);
              g2D.setStroke(stroke);
              g2D.setPaint(Color.cyan);
              num.setSpacing(true,8);
              num.setSpacing(true,8);
              if(hr1==0&hr2==0){
                   num.drawNumber(1,g2D);
                   num.setLocation(40,10);
                   num.drawNumber(2,g2D);
              else{
                   if(!(hr1 == 0)){     
                        num.drawNumber(hr1,g2D);
                   num.setLocation(40,10);
                   num.drawNumber(hr2,g2D);
              num.setLocation(70,10);
              num.drawNumber(DigitalNumber.DOTS,g2D);
              num.setLocation(100,10);
              num.drawNumber(min1,g2D);
              num.setLocation(130,10);
              num.drawNumber(min2,g2D);
              num.setLocation(160,10);
              num.drawNumber(DigitalNumber.DOTS,g2D);
              num.setLocation(190,10);
              num.drawNumber(sec1,g2D);
              num.setLocation(220,10);
              num.drawNumber(sec2,g2D);
              /*num.setLocation(250,10);
              num.drawNumber(DigitalNumber.DOTS,g2D);
              num.setLocation(280,10);
              num.drawNumber(mll1,g2D);
              num.setLocation(310,10);
              num.drawNumber(mll2,g2D);
              g2D.setPaint(Color.cyan);
              if((c.get(Calendar.AM_PM))==Calendar.AM){               
                   g2D.drawString("AM",260,20);
              }else{
                   g2D.drawString("PM",260,20);
         String dayOfweek = "";     
         switch(c.get(Calendar.DAY_OF_WEEK)){
              case(Calendar.SUNDAY):
                   dayOfweek = "Sunday, ";
                   break;
              case(Calendar.MONDAY):
                   dayOfweek = "Monday, ";
                   break;
              case(Calendar.TUESDAY):
                   dayOfweek = "Tuesday, ";
                   break;
              case(Calendar.WEDNESDAY):
                   dayOfweek = "Wednesday, ";
                   break;
              case(Calendar.THURSDAY):
                   dayOfweek = "Thursday, ";
                   break;
              case(Calendar.FRIDAY):
                   dayOfweek = "Friday, ";
                   break;
              case(Calendar.SATURDAY):
                   dayOfweek = "Saturday, ";
                   break;
         String month = "";     
         switch(c.get(Calendar.MONTH)){
              case(Calendar.JANUARY):
                   month = "January ";
                   break;
              case(Calendar.FEBRUARY):
                   month = "February ";
                   break;
              case(Calendar.MARCH):
                   month = "March ";
                   break;
              case(Calendar.APRIL):
                   month = "April ";
                   break;
              case(Calendar.MAY):
                   month = "May ";
                   break;
              case(Calendar.JUNE):
                   month = "June ";
                   break;
              case(Calendar.JULY):
                   month = "July ";
                   break;
              case(Calendar.AUGUST):
                   month = "August ";
                   break;
              case(Calendar.SEPTEMBER):
                   month = "September ";
                   break;
              case(Calendar.OCTOBER):
                   month = "October ";
                   break;
              case(Calendar.NOVEMBER):
                   month = "November ";
                   break;
              case(Calendar.DECEMBER):
                   month = "December ";
                   break;
         int day = c.get(Calendar.DAY_OF_MONTH);
         int year = c.get(Calendar.YEAR);
         Font font = new Font("serif",Font.PLAIN,24);
         g2D.setFont(font);
         g2D.drawString(dayOfweek+month+day+", "+year,10,80);
         public static void main(String args[]){
              AppFrame aframe = new AppFrame("Digital Clock");
              Container cpane = aframe.getContentPane();
              final DigitalClock dc = new DigitalClock();
              dc.setBackground(Color.black);
              cpane.add(dc,BorderLayout.CENTER);
              aframe.setSize(310,120);
              aframe.setVisible(true);
              class Task extends TimerTask {
                 public void run() {
                      dc.repaint();
              java.util.Timer timer = new java.util.Timer();
             timer.schedule(new Task(),0L,250L);
    class DigitalNumber {
         private float x=0;
         private float y=0;
         private float size=5;
         private int number;
         private Shape s;
         private float space = 0;
         public static final int DOTS = 10;
         private Color on,off;
         DigitalNumber(){          
              this(0f,0f,5f,Color.cyan,Color.black);          
         DigitalNumber(float x,float y, float size,Color on,Color off){
              this.x = x;
              this.y = y;
              this.size = size;
              this.on = on;
              this.off = off;
         public void drawNumber(int number,Graphics2D g){
              int flag = 0;
              switch(number){
                   case(0):          
                        flag = 125;
                        break;
                   case(1):
                        flag = 96;
                        break;
                   case(2):
                        flag = 55;
                        break;
                   case(3):
                        flag = 103;
                        break;
                   case(4):
                        flag = 106;
                        break;
                   case(5):
                        flag = 79;
                        break;
                   case(6):
                        flag = 94;
                        break;
                   case(7):
                        flag = 97;
                        break;
                   case(8):
                        flag = 127;
                        break;
                   case(9):
                        flag = 107;
                        break;
                   case(DOTS):
                        GeneralPath path = new GeneralPath();
                        path.moveTo(x+(size/2),y+(size/2)-1);
                        path.lineTo(x+(size/2),y+(size/2)+1);
                        path.moveTo(x+(size/2),y+(size/2)+size-1);
                        path.lineTo(x+(size/2),y+(size/2)+size+1);
                        g.setPaint(on);
                        g.draw(path);     
                        return;
              //Top          
              if((flag & 1) == 1){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath Top = new GeneralPath();
              Top.moveTo(x + space, y);
              Top.lineTo(x + size - space, y);
              g.draw(Top);
              //Middle
              if((flag & 2) == 2){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath Middle = new GeneralPath();
              Middle.moveTo(x + space, y + size); 
              Middle.lineTo(x + size - space,y + size);     
              g.draw(Middle);
              //Bottom
              if((flag & 4) == 4){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath Bottom = new GeneralPath();
              Bottom.moveTo(x + space, y + (size * 2));  
              Bottom.lineTo(x + size - space, y + (size * 2));
              g.draw(Bottom);
              //TopLeft
              if((flag & 8) == 8){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath TopLeft = new GeneralPath();     
              TopLeft.moveTo(x, y + space);
              TopLeft.lineTo(x, y + size - space);          
              g.draw(TopLeft);
              //BottomLeft
              if((flag & 16) == 16){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath BottomLeft = new GeneralPath();     
              BottomLeft.moveTo(x, y + size + space);
              BottomLeft.lineTo(x, y + (size * 2) - space);
              g.draw(BottomLeft);
              //TopRight
              if((flag & 32) == 32){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath TopRight = new GeneralPath();     
              TopRight.moveTo(x + size, y + space);
              TopRight.lineTo(x + size, y + size - space);
              g.draw(TopRight);
              //BottomRight
              if((flag & 64) == 64){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath BottomRight = new GeneralPath();     
              BottomRight.moveTo(x + size, y + size + space);
              BottomRight.lineTo(x + size, y + (size * 2) - space);
              g.draw(BottomRight);
         public void setSpacing(boolean spacingOn){
              if(spacingOn == false){
                   space = 0;
              else{
                   this.setSpacing(spacingOn,5f);
         public void setSpacing(boolean spacingOn,float gap){
              if(gap<2){
                   gap = 2;
              if(spacingOn == true){
                   space = size/gap;
         public void setLocation(float x,float y){
              this.x = x;
              this.y = y;
         public void setSize(float size){
              this.size = size;
    class AppFrame extends JFrame{
         AppFrame(){
              this("Demo Frame");
         AppFrame(String title){
              super(title);
              setSize(500,500);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

Maybe you are looking for