Get datetime to a JFrame...

i need to get the current system date & time to JFrame (to display)...also it should change dynamically according to the systems date&time
(i.e it should change from second to second...)
i tried it with a JApplet (call the JApplet in-side the JFrame...)
Like this...
//JApplet
String lastTime = "";
GregorianCalendar day = new GregorianCalendar();
String time = day.getTime().toString();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// do nothing
lastTime = time;
repaint();
//JFrame
     BorderLayout bord=new BorderLayout();
     getContentPane().setLayout(bord);
     appletTest aT=new appletTest();     //instance from JApplet
     getContentPane().add("Center",aT);
But, here it is not erase the previous value...It just overlap...
(if seconds...2 is overlap with 1....then 3 is overlap with 2)
How to avoid this...
OR
Is there other way of get the date&time to a JFrame.
pls...tell
thanks

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.util.*;
import java.applet.*;
<Applet code=AppletDate.class width=500 height=400>
</Applet>
public class AppletDate extends Applet implements Runnable
GregorianCalendar cal;
Thread thread=null;
Date date;
public void start()
       if(thread==null)
            thread=new Thread(this);
            thread.start();
     }//start
     public void run()
          while(thread!=null)
               repaint();
               try
                    thread.sleep(1000);
               catch (Exception E)
                    System.out.println(E);
               }//catch
          }//while
     }//run
     public void paint(Graphics g)
          String time;
        date=new Date();
          GregorianCalendar cal=new GregorianCalendar();
          cal.setTime(date);
          time=cal.get(cal.HOUR)+":"+cal.get(cal.MINUTE)+":"+cal.get(cal.SECOND);
          g.drawString(time,30,30);
}

Similar Messages

  • How to get DATETIME value in a page?

    Hi,
    I have two pages.
    In page1, I have a table that contain MessageStyleText item(AuditTime) and the attribute data type is DATETIME .
    I want to pass AuditTime value from page1 to page2.
    I am passing the AuditTime value from page1 to page2 using Destination URI.
    The AuditTime value is 2008-11-11 12:45:31.0
    How to get the AuditTime in page2 so that I can get the exact value '2008-11-11 12:45:31.0' ?
    Please help.
    Thanks & Regards,
    Sagarika

    Hi
    I am passing the value using the following destination URI,
    OA.jsp?page=/uttara/oracle/apps/uttaraimc/audit/webui/Page2&auditTime={@AuditTime}&retainAM=Y
    In the database the AuditTime value is like '2008-11-11 12:45:31.0'
    Normally we are using pageContext.getParameter("auditTime"); to get the value which are passed in destination URI.
    Here if I'll use pageContext.getParameter("auditTime"); I am not getting the correct value.
    How to get the exact value?
    Thanks & Regards,
    Sagarika

  • How to force to wait and get input from a jframe-jpanel?

    I would like to use a jframe-jpanel to get user input instead of using JOptionPane.showInputDialog since there will be more than 1 input.
    But I could not do it. The code reads the panel lines and passes to other lines below without waiting for the okay button to be pressed.
    This is the part of code of my main frame;
    jLabel10.setText(dene.toString());
    if (dene == 0) {
    // todo add button input panel
    //String todo_write = JOptionPane.showInputDialog("Please enter a todo item");
    JFrame frameTodoAddInput = new JFrame( "Please input..." );
    TodoAddAsk1JPanel todoaddpanel = new TodoAddAsk1JPanel();
    frameTodoAddInput.add(todoaddpanel);
    frameTodoAddInput.setSize( 600, 200 ); // set frame size
    frameTodoAddInput.setLocation(300, 300);
    //String todo_write = todoaddpanel.getNewTodoItem();
    String todo_write = todoaddpanel.getNewTodoItem();
    jLabel10.setText("Satir 1822 de".concat(todo_write));
    // end of todo add button input panel
    todoTextPane1.setText(todo_write);
    This is the code of input panel;
    * TodoAddAsk1JPanel.java
    * Created on May 6, 2007, 12:03 AM
    package javaa;
    public class TodoAddAsk1JPanel extends javax.swing.JPanel {
    /** Creates new form TodoAddAsk1JPanel */
    public TodoAddAsk1JPanel() {
    initComponents();
    private String NewTodoItem = "";
    public String getNewTodoItem() {
    NewTodoItem = ANewTodoItemTextField.getText();
    return this.NewTodoItem;
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
    jLabel1 = new javax.swing.JLabel();
    ANewTodoItemTextField = new javax.swing.JTextField();
    jLabel2 = new javax.swing.JLabel();
    PriorityComboBox = new javax.swing.JComboBox();
    jLabel3 = new javax.swing.JLabel();
    DayValueComboBox = new javax.swing.JComboBox();
    MonthValueComboBox = new javax.swing.JComboBox();
    YearValueComboBox = new javax.swing.JComboBox();
    OkayButton = new javax.swing.JButton();
    CancelButton = new javax.swing.JButton();
    TimeValueComboBox = new javax.swing.JComboBox();
    jLabel1.setText("Please enter a todo item:");
    jLabel2.setText("Please select its priority level:");
    PriorityComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "A", "B", "C" }));
    jLabel3.setText("Please select its due date:");
    DayValueComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
    MonthValueComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }));
    YearValueComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025", "2026", "2027", "2028", "2029", "2030", "2031", "2032", "2033", "2034", "2035", "2036", "2037", "2038", "2039", "2040", "2041", "2042", "2043", "2044", "2045", "2046", "2047", "2048", "2049", "2050", "2051", "2052", "2053", "2054", "2055", "2056", "2057", "2058", "2059", "2060", "2061", "2062", "2063", "2064", "2065", "2066", "2067", "2068", "2069", "2070" }));
    OkayButton.setText("OK");
    OkayButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    OkayButtonActionPerformed(evt);
    CancelButton.setText("Cancel");
    TimeValueComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "08:30", "09:00", "09:30", "10:00", "10:30", "11:00", "11:30", "12:00", "12:30", "13:00", "13:30", "14:00", "14:30", "15:00", "15:30", "16:00", "16:30", "17:00", "17:30", "18:00", "18:30", "19:00", "19:30", "20:00", "20:30", "21:00", "21:30", "22:00", "22:30", "23:00", "23:30", "00:00", "00:30", "01:00", "01:30", "02:00", "02:30", "03:00", "03:30", "04:00", "04:30", "05:00", "05:30", "06:00", "06:30", "07:00", "07:30", "08:00" }));
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
    .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(PriorityComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(ANewTodoItemTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 279, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(OkayButton, javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 133, Short.MAX_VALUE)
    .addComponent(CancelButton))
    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
    .addComponent(DayValueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(MonthValueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(YearValueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addGap(13, 13, 13)
    .addComponent(TimeValueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(42, 42, 42)))
    .addContainerGap())
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(ANewTodoItemTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel1))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel2)
    .addComponent(PriorityComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel3)
    .addComponent(DayValueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(MonthValueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(YearValueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(TimeValueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(18, 18, 18)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(OkayButton)
    .addComponent(CancelButton))
    .addContainerGap())
    }// </editor-fold>
    private void OkayButtonActionPerformed(java.awt.event.ActionEvent evt) {                                          
    // TODO add your handling code here:
    NewTodoItem = ANewTodoItemTextField.getText();
    // Variables declaration - do not modify
    private javax.swing.JTextField ANewTodoItemTextField;
    private javax.swing.JButton CancelButton;
    private javax.swing.JComboBox DayValueComboBox;
    private javax.swing.JComboBox MonthValueComboBox;
    private javax.swing.JButton OkayButton;
    private javax.swing.JComboBox PriorityComboBox;
    private javax.swing.JComboBox TimeValueComboBox;
    private javax.swing.JComboBox YearValueComboBox;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    // End of variables declaration
    I want to get the resulted input of "NewTodoItem"
    Thanks in advance for your kind help.
    Guven

    Thank you very much for your help. But I would like
    to get 3 inputs from 1 window at the same time and I
    could not find any example code for JDialog for more
    than 1 input. If any body can show how to write this
    code, it would be appreciated.
    ThanksYou can write your own. A JDialog is a container just look a JFrame is.

  • Components getting distorted when the JFrame application is minimized

    Hello,
    I have developed a GUI application using Net Beans, the JFrame has a panel which has a JButton, JTextField, image icon (using label) and few other label's, when i click the button the text fields, image icon, button relocate using setBounds function and another panel is added dynamically which in turn contains few labels. When i click any of the label it will play music in real player software.
    But when i click any label the real player opens and the music is played but after clicking when i minimize the JFrame window the components are getting distorted.
    How to solve this problem.
    i have used
    java.swing.* package and
    java.awt.Desktop package for opening the music file in real player.
    Regards,
    Sandeep.

    Hello dvrsandeep,
    Maybe, you should not relocate your components using setBounds function. Use a LayoutManager Instead.

  • Get datetime in 1st row of another column

    Hi Everyone,
    Please anyone help me...
    Below is the query and output.
    Query:
    SELECT
      WMUMF.BIZDOCTYPEDEF.TYPENAME,
      Table__52.BD_PARTNERORDERNUMBER,
      Table__67.BD_TRACKINGNUMBER,
      WMUMF.BIZDOCATTRIBUTE.STRINGVALUE,
      TO_DATE(TO_CHAR(WMUMF.BIZDOC.DOCTIMESTAMP,'MM/DD/YYYY HH24:MI:SS'),'MM/DD/YYYY HH24:MI:SS')
    FROM
      WMUMF.PARTNER  SENDER,
      WMUMF.PARTNER  RECEIVER,
      WMUMF.BIZDOCTYPEDEF,
      WMUMF.BIZDOC,
      SELECT
          WMUMF.BIZDOCARRAYATTRIBUTE.DOCID,
          WMUMF.BIZDOCARRAYATTRIBUTE.STRINGVALUE BD_PartnerOrderNumber
          FROM
          WMUMF.BIZDOCATTRIBUTEDEF  BIZDOCATTRIBUTEDEF_A1,
          WMUMF.BIZDOCARRAYATTRIBUTE
          WHERE
          WMUMF.BIZDOCARRAYATTRIBUTE.ATTRIBUTEID=BIZDOCATTRIBUTEDEF_A1.ATTRIBUTEID AND
          Bizdocattributedef_A1.Attributename  In  ( 'BD_PartnerOrderNumber'  )
      )  Table__52,
      SELECT
    WMUMF.BIZDOCARRAYATTRIBUTE.DOCID,
    WMUMF.BIZDOCARRAYATTRIBUTE.STRINGVALUE BD_TrackingNumber
    FROM
    WMUMF.BIZDOCATTRIBUTEDEF BIZDOCATTRIBUTEDEF_A1,
    WMUMF.BIZDOCARRAYATTRIBUTE
    WHERE
    WMUMF.BIZDOCARRAYATTRIBUTE.ATTRIBUTEID=BIZDOCATTRIBUTEDEF_A1.ATTRIBUTEID AND
    Bizdocattributedef_A1.Attributename In ( 'BD_TrackingNumber' )
      )  Table__67,
      WMUMF.BIZDOCATTRIBUTEDEF,
      SELECT
          WMUMF.BIZDOCARRAYATTRIBUTE.DOCID,
          WMUMF.BIZDOCARRAYATTRIBUTE.STRINGVALUE BD_SiteID
          FROM
          WMUMF.BIZDOCATTRIBUTEDEF  BIZDOCATTRIBUTEDEF_A1,
          WMUMF.BIZDOCARRAYATTRIBUTE
          WHERE
          WMUMF.BIZDOCARRAYATTRIBUTE.ATTRIBUTEID=BIZDOCATTRIBUTEDEF_A1.ATTRIBUTEID AND
          Bizdocattributedef_A1.Attributename  In  ( 'BD_SiteID'  )
      )  Table__44
    WHERE
      ( WMUMF.BIZDOC.DOCTYPEID=WMUMF.BIZDOCTYPEDEF.TYPEID  )
      AND  ( WMUMF.BIZDOC.RECEIVERID=RECEIVER.PARTNERID  )
      AND  ( SENDER.PARTNERID=WMUMF.BIZDOC.SENDERID  )
      AND  ( WMUMF.BIZDOC.DOCID=WMUMF.BIZDOCATTRIBUTE.DOCID  )
      AND  ( WMUMF.BIZDOCATTRIBUTEDEF.ATTRIBUTEID=WMUMF.BIZDOCATTRIBUTE.ATTRIBUTEID  )
      AND  ( Table__44.DOCID(+)=WMUMF.BIZDOC.DOCID  )
      AND  ( WMUMF.BIZDOC.DOCID=Table__46.DOCID(+)  )
      AND  ( WMUMF.BIZDOC.DOCID=Table__52.DOCID(+)  )
      AND  ( WMUMF.BIZDOC.DOCID=Table__67.DOCID(+)  )
      AND
       WMUMF.BIZDOCTYPEDEF.TYPENAME  IN  ( 'doc_Xml_HoldReleaseNotification_CustomXML_Cisco','doc_Xml_PIP_3A9CancellationRequest_V_11_01'  )
       AND
       SENDER.CORPORATIONNAME  =  'CISCO LSS (E2Open)'
       AND
       RECEIVER.CORPORATIONNAME  =  'FLEXTRONICS'
       AND
       WMUMF.BIZDOCATTRIBUTEDEF.ATTRIBUTENAME  =  'ApplicationMessageType'
       AND
       WMUMF.BIZDOCATTRIBUTE.STRINGVALUE  IN  ( 'H','R','3A9V11.01.00'  )
       AND
       Table__44.BD_SITEID  =  '027'
      AND
       WMUMF.BIZDOC.DOCTIMESTAMP >= TO_DATE('06/15/2013','MM/DD/YYYY')
       AND WMUMF.BIZDOC.DOCTIMESTAMP <= SYSDATE+1
    Output:
    PartnerOrderNumber
    DateTime
    StringValue
    Tracking Number
    Document
    PO1
    1 am
    H
    123
    DOC
    PO1
    2 am
    H
    246
    DOC
    PO1
    3 am
    R
    125
    DOC
    PO1
    4 am
    H
    678
    DOC
    PO2
    5 am
    H
    890
    DOC
    PO2
    6 am
    R
    098
    DOC
    PO2
    7 am
    H
    001
    DOC
    PO2
    8 am
    R
    870
    DOC
    PO3
    9 am
    H
    008
    DOC
    PO3
    10 am
    H
    065
    DOC
    PO3
    11 am
    R
    593
    DOC
    PO3
    12 pm
    H
    636
    DOC
    PO3
    1 pm
    H
    978
    DOC
    PO3
    2 pm
    R
    675
    DOC
    But I need like below...
    PartnerOrderNumber
    H DateTime
    R DateTime
    Tracking Number
    Document
    PO1
    1 am
    3 am
    123
    DOC
    PO1
    2 am
    246
    DOC
    PO2
    4 am
    6 am
    678
    DOC
    PO2
    5 am
    890
    DOC
    PO2
    7 am
    8 am
    001
    DOC
    PO3
    9 am
    11 am
    008
    DOC
    PO3
    10 am
    065
    DOC
    PO3
    12 pm
    2 pm
    636
    DOC
    PO3
    1 pm
    978
    DOC
    My aim is to get H datetime in one column and R datetime in another column but only in 1st row of H datetime. PO3 has H H R H H R so each R datetime should be in 1st of H datetime.
    Thanks in Advance,
    Sindhu

    This forum is for the SQL Developer tool, not for general SQL or PL/SQL questions.  The clue is in the name. 
    Try asking in the Database General or SQL and PL/SQL forums.

  • JNI: get Window-Handle of JFrame

    Hello,
    I'm calling a DLL method (written in VC), that needs a Window-handle (HWND) as parameter. How can I get the Handle of my JFrame to pass it into the DLL function?
    All samples are designed for getting the HWND of a Canvas. But obviously it does not work with any kind of Frame.
    Can somebody tell me ?
    Thank you, Lars
    P.S. I'm working with SUN 1.4

    see this one, i was looking for same thing:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=238779

  • Trouble Getting Any Display of JFrame Components

    Hello all! I appreciate being able to post questions on this forum, and am grateful for anyone's help with this.
    I have written a program that displays a GUI and (will) read a random word from a file for use in a Hangman-like game.
    The trouble is, today I have no display (yesterday I had display just fine!). When I run the program, it opens just an empty Container with nothing inside.
    Am I crazy, but does my code create valid content for a display?
    Also, I use NetBeans 6.1.
    Would anyone know why one day I would get good display and the next nothing?
    Any advice or suggestions for my code are greatly appreciated! Thanks!
    package secretphraseusingfile;
    import java.io.*;       //program uses IOStreams
    import java.awt.*;      //program uses Font, Colors
    import java.awt.geom.*; //program uses shapes
    import java.awt.event.*;//program uses ActionListeners
    import javax.swing.*;   //program uses JOptionPane, JFrame
    //Class SecretPhraseUsingFile
    class DrawPanel extends JPanel
            int type = 1;
            public DrawPanel(int type)
                this.type = type;
        @Override
            protected void paintComponent(Graphics gr)
                super.paintComponent(gr);
                Color gallowColor = new Color(100, 100, 15);
                Graphics2D gr2D = (Graphics2D)gr;
                gr2D.setColor(gallowColor);
                gr2D.draw(new Rectangle2D.Float(100F, 50F, 400F, 333F));
                gr2D.fillRect(210, 60, 20, 300);
                gr2D.fillRect(230, 60, 120, 20);
                gr2D.fillRect(320, 80, 4,   50);
            }//end paintComponent
        }//end DrawPanel
    public class SecretPhraseUsingFile extends JFrame
                                       implements ActionListener
        DataInputStream istream;
        //declaration of program-wide variables
        String letter = "";
        String filePath = "C:\\Users\\Ben\\Desktop\\Lesson 13\\Hangman";
        String fileName = "secretList.dat";
        File wordFile = new File(filePath, fileName);
        //declaration of JFrame components
        //layouts
        GridLayout masterGrid       = new GridLayout(2, 1);
        GridLayout topGrid          = new GridLayout(1, 2);
        GridLayout bottomGrid       = new GridLayout(3, 1);
        GridLayout innerButtonsGrid = new GridLayout(6, 5, 15, 2);
        FlowLayout innerFlow        = new FlowLayout();
        //panels
        JPanel masterP  = new JPanel(masterGrid);
        JPanel topP     = new JPanel(topGrid);
        DrawPanel drawingP = new DrawPanel(1);
        JPanel usedP    = new JPanel(innerFlow);
        JPanel bottomP  = new JPanel(bottomGrid);
        JPanel wordP    = new JPanel(innerFlow);
        JPanel buttonP  = new JPanel(innerButtonsGrid);
        JPanel captionP = new JPanel(innerFlow);
        Container con   = new Container();
        //fonts
        Font buttonsFont        = new Font("Arial Black", Font.BOLD, 16);
        Font usedFont           = new Font("Courier New", Font.BOLD, 54);
        Font usedTitleFont      = new Font("Courier New", Font.BOLD, 34);
        Font wordFont           = new Font("Arial Black", Font.BOLD, 84);
        Font captionFont        = new Font("Helvetica",   Font.BOLD, 30);
        Font captionExtremeFont = new Font("Helvetica",   Font.BOLD, 36);
        //colors
        Color backgroundColor = new Color(100, 180, 230);
        Color buttonColor     = new Color(70, 170, 150);
        Color gallowColor     = new Color(100, 100, 15);
        //labels
        JLabel caption          = new JLabel("Uh oh!");
        JLabel usedL[]          = new JLabel[26];
        JLabel lblLettersUsed   = new JLabel("Letters You've Used So Far: ");
        JLabel wordLabel        = new JLabel("_ _ _ _ _ _ _ _ _");
        //buttons
        JButton abc[]       = new JButton[26];
        JButton exitButton  = new JButton("EXIT");
        //JFrame constructor//////////////////////////////////////
        public SecretPhraseUsingFile()
            super("Hangman Game Using File");
            //create alphabet buttons
            for(int i = 0; i < 26; i++)
                letter = Character.toString((char)(i + 65));
                abc[i] = new JButton(letter);
                abc.setFont(buttonsFont);
    abc[i].setBackground(buttonColor);
    abc[i].setBorder(BorderFactory.createLineBorder(Color.BLACK));
    //create used letter array for display of used letters
    for(int i = 0; i < 26; i++)
    letter = Character.toString((char)(i + 65));
    usedL[i] = new JLabel(" " + letter + " ");
    //keeps used letters invisible until chosen in game
    usedL[i].setVisible(false);
    usedL[i].setFont(usedFont);
    usedL[i].setForeground(Color.RED);
    drawingP.setBackground(backgroundColor);
    usedP.setBackground(backgroundColor);
    wordP.setBackground(backgroundColor);
    buttonP.setBackground(backgroundColor);
    captionP.setBackground(backgroundColor);
    caption.setFont(captionFont);
    con.add(masterP);
    masterP.add(topP);
    masterP.add(bottomP);
    topP.add(drawingP);
    topP.add(usedP);
    bottomP.add(wordP);
    bottomP.add(buttonP);
    bottomP.add(captionP);
    captionP.add(caption);
    wordP.add(wordLabel);
    wordLabel.setFont(wordFont);
    for(int i = 0; i < 26; i++)
    buttonP.add(abc[i]);
    abc[i].addActionListener(this);
    usedP.add(lblLettersUsed);
    lblLettersUsed.setFont(usedTitleFont);
    for(int i = 0; i < 26; i++)
    usedP.add(usedL[i]);
    buttonP.add(exitButton);
    exitButton.addActionListener(this);
    //create file opening for read from file
    try
    istream = new DataInputStream(new FileInputStream(wordFile));
    catch(IOException ioe)
    System.err.println("File not opened. " + "Cause: " + ioe.getMessage());
    }//end of constructor
    //main method runs java program
    public static void main(String[] args) {
    //declaration of constants
    int DELTA_X = 0, DELTA_Y = 0;
    int FRAME_WIDTH = 1280, FRAME_HEIGHT = 770;
    //declaration of JFrame
    SecretPhraseUsingFile display = new SecretPhraseUsingFile();
    display.setBounds(DELTA_X, DELTA_Y, FRAME_WIDTH, FRAME_HEIGHT);
    display.setVisible(true);
    display.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }//end of method main
    public void actionPerformed(ActionEvent e)
    Object source = e.getSource();
    if(source == exitButton)
    exitProgram();
    else if(source == abc[0]) //'A'
    System.out.println("AAAAAAAAAA");
    else if(source == abc[1]) //'B'
    System.out.println("BBBBBBBBBB");
    else if(source == abc[2]) //'C'
    System.out.println("CCCCCCCCCC");
    else if(source == abc[3]) //'D'
    System.out.println("DDDDDDDDDD");
    else if(source == abc[4]) //'E'
    System.out.println("EEEEEEEEEE");
    else if(source == abc[5]) //'F'
    System.out.println("FFFFFFFFFF");
    else if(source == abc[6]) //'G'
    System.out.println("GGGGGGGGGG");
    else if(source == abc[7]) //'H'
    System.out.println("HHHHHHHHHH");
    else if(source == abc[8]) //'I'
    System.out.println("IIIIIIIIII");
    else if(source == abc[9]) //'J'
    System.out.println("JJJJJJJJJJ");
    else if(source == abc[10])//'K'
    System.out.println("KKKKKKKKKK");
    else if(source == abc[11])//'L'
    System.out.println("LLLLLLLLLL");
    else if(source == abc[12])//'M'
    System.out.println("MMMMMMMMMM");
    else if(source == abc[13])//'N'
    System.out.println("NNNNNNNNNN");
    else if(source == abc[14])//'O'
    System.out.println("OOOOOOOOOO");
    else if(source == abc[15])//'P'
    System.out.println("PPPPPPPPPP");
    else if(source == abc[16])//'Q'
    System.out.println("QQQQQQQQQQ");
    else if(source == abc[17])//'R'
    System.out.println("RRRRRRRRRR");
    else if(source == abc[18])//'S'
    System.out.println("SSSSSSSSSS");
    else if(source == abc[19])//'T'
    System.out.println("TTTTTTTTTT");
    else if(source == abc[20])//'U'
    System.out.println("UUUUUUUUUU");
    else if(source == abc[21])//'V'
    System.out.println("VVVVVVVVVV");
    else if(source == abc[22])//'W'
    System.out.println("WWWWWWWWWW");
    else if(source == abc[23])//'X'
    System.out.println("XXXXXXXXXX");
    else if(source == abc[24])//'Y'
    System.out.println("YYYYYYYYYY");
    else if(source == abc[25])//'Z'
    System.out.println("ZZZZZZZZZZ");
    }//end of actionPerformed()
    @Override
    public void paint(Graphics brush)
    super.paint(brush);
    //Graphics2D g2D = (Graphics2D)brush;
    }//end paint()
    public void exitProgram()
    int answer = 1;
    answer = JOptionPane.showConfirmDialog(null,
    "Do you want to quit?");
    if(answer == 0)
    System.exit(0);
    }//end exitProgram()
    }//end of class SecretPhraseUsingFile

    Thanks JSG. Yeah, I definitely have too much in my constructor for sure. I just do that because I am uneasy about creating methods that I don't know how to use well. I am just now getting the hang of using try catch statements (they are very confusing!) and also knowing how to use FileStreams correctly (that took me forever to learn, and I still need work on it). I know that I need serious study of program architecture, how to design a program well. As for now, I'm content with smalll programs that at least work (albeit clunky).
    I will try to implement your suggestions about the methods and about using super, I'm sure that I could do better with them. Thanks!

  • How to get DateTime from PI message SOAP Header

    Hi ALL
    Can you please let me know how we can get the time message received in PI from the SOAP message header
    <SAP:TimeSent>2010-08-17T16:24:16Z</SAP:TimeSent>
    I would like to capture this value and send it in the payload of the message, initially I was using the Current TIme date function.
    However, if I can get the time received value from the SOAP Header message, It will be more accurate in providing the Time the message was received by IE.
    Thank you,
    Parikshit
    Sample SOAP Header from MONI:-
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Call Adapter
      -->
    - <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SAP="http://sap.com/xi/XI/Message/30">
    - <SOAP:Header>
    - <SAP:Main xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" versionMajor="003" versionMinor="000" SOAP:mustUnderstand="1" wsu:Id="wsuid-main-92ABE13F5C59AB7FE10000000A1551F7">
      <SAP:MessageClass>ApplicationMessage</SAP:MessageClass>
      <SAP:ProcessingMode>asynchronous</SAP:ProcessingMode>
      <SAP:MessageId>4C69D4B7-9806-0162-E100-80000A8221E6</SAP:MessageId>
    <SAP:TimeSent>2010-08-17T16:24:16Z</SAP:TimeSent>
    - <SAP:Sender>

    If you want to get the TimeSent from SOAP header and map it to some field in ur message then u can easily do it using following UDF :-
    GlobalContainer globalContainer;globalContainer = container.getGlobalContainer();
    java.util.Map param = globalContainer.getParameters();.
    String timeSent = (String) param.get (StreamTransformationConstants.TIME_SENT);
    return timeSent ;
    Note: This UDF won't need any input. So u need not to maintain any variable in UDF signature.
    Edited by: Samiullah Qureshi on Aug 18, 2010 9:41 AM

  • Get DateTime in Modem TC65

    Hi,
    I am working with modem TC65:
    - Platform: CLDC/MIDP
    - Emulator: Siemens IMP-NG TC65 R2 Wireless Toolkit
    - Device: IMP_NG_TC65_R2
    - Device configuration: CLDC-1.1
    - Device Profile: IMP-NG
    I am having a problem to get the current date time (without sending a command to modem TC65). Because it does not support both: java.util.Calendar & java.util.Date.
    If anyone has worked with this device (or relevant), could you please help me?
    Thanks in advance.
    Your help is much appreciated!

    Please ignore this,
    I found the answer, there is java.util.Date class existing but I could not know it.
    Thanks anyway

  • Getting DateTime

    Hi ,
    can you tell me how to get the Date and Time of different system which is there in the same network.
    thanx in advance
    Srinath.

    Hi,
    I didnt get you, exactly what are you looking for.
    Because, date and time are same for all the systems in specific region(LAN).
    this can be achieved in different ways:
    For example:#
    DateFormat df = new SimpleDateFormat("yyyyMMdd");
    Date d = new Date();
    String today = df.formt(d);
    System.out.println(today);
    or
    String[] ids = TimeZone.getAvailableIDs(1 * 60 * 60 * 1000);          
         SimpleTimeZone edt = new SimpleTimeZone(1 * 60 * 60 * 1000, ids[0]);
         edt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
         edt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
         Calendar calendar = new GregorianCalendar(edt);
         Date trialTime = new Date();
         calendar.setTime(trialTime);
         year = Integer.toString(calendar.get(Calendar.YEAR));          
         month = Integer.toString(calendar.get(Calendar.MONTH)+1);
         day = Integer.toString(calendar.get(Calendar.DAY_OF_MONTH));
         currentdate = year+month+day;
    System.out.println(currentdate);
    bye

  • How to get current top-most JFrame/JDialog?

    my problem is:
    i want to show an error message(JOptionPane). it could be shown at anytime because i am using another thread to show this error message(upon receiving of the Socket). but i dunno how to specify its owner in this case since it could be shown at anytime. i think if i can get the current top-most frame/dialog, then can set it to be the message owner. is it correct and how? or got any other better choice?

    OMG

  • Problem to get datetime

    Hi,
    Is there a way to convert 
    23APR15
    to a datetime? I got one exception to such codes
    dt1 = DateTime.ParseExact(curr_dt, "DDMMMYY", null);
    worksheet.Cells[rw, 1] = dt1.ToString("mm/dd/yyyy");
    Many Thanks & Best Regards, Hua Min

    Hi HuaMin,
    Do you mean this error? Here is my screenshot on my side when reproduce your code,
    There is no "DDMMMYY" format in DateTime. You can refer to
    Standard Date and Time Format Strings for more detailed information.
    The following code make sense.
    DateTime.Now.ToString("yyyyMMddHHmmss"); // case sensitive
    In addition, here is a pattern for en-us culture.
    Specifier
    DateTimeFormatInfo property
    Pattern value (for en-US culture)
    t
    ShortTimePattern
    h:mm tt
    d
    ShortDatePattern
    M/d/yyyy
    T
    LongTimePattern
    h:mm:ss tt
    D
    LongDatePattern
    dddd, MMMM dd, yyyy
    f
    (combination of D and t)
    dddd, MMMM dd, yyyy h:mm tt
    F
    FullDateTimePattern
    dddd, MMMM dd, yyyy h:mm:ss tt
    g
    (combination of d and t)
    M/d/yyyy h:mm tt
    G
    (combination of d and T)
    M/d/yyyy h:mm:ss tt
    m, M
    MonthDayPattern
    MMMM dd
    y, Y
    YearMonthPattern
    MMMM, yyyy
    r, R
    RFC1123Pattern
    ddd, dd MMM yyyy HH':'mm':'ss 'GMT' (*)
    s
    SortableDateTi­mePattern
    yyyy'-'MM'-'dd'T'HH':'mm':'ss (*)
    u
    UniversalSorta­bleDateTimePat­tern
    yyyy'-'MM'-'dd HH':'mm':'ss'Z' (*)
    (*) = culture independent
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Get datetime delta gaps

    Finding datetime gaps:
    we have a table with cars working from to dates:
    rec    car    DateFrom        DateTo
    1    11    2008-10-28 00:00:00    2008-11-05 23:59:59
    2    11    2008-11-06 00:00:00    2008-11-08 23:00:00
    3    11    2008-11-09 00:00:00    2008-11-05 23:59:59
    4    22    2008-10-28 00:00:00    2008-10-29 20:00:00
    5    22    2008-10-31 00:00:00    2008-11-05 23:59:59
    result I'm lookin for is finding dates and delta time a car is not working:
    car    gapFrom         gapTo            gapDelta[h]
    11    2008-11-08 23:00:00    2008-11-09 00:00:00    1     (in hours)
    22    2008-10-29 20:00:00    2008-10-31 00:00:00    28    

    Hi b_blase,
    Please see the below code to retrieve datetime delta gaps.
    CREATE TABLE yourTable
    rec INT,
    car INT,
    dateFrom DATETIME,
    dateTo DATETIME
    INSERT INTO yourTable VALUES(1,11,'2008-10-28 00:00:00','2008-11-06 00:00:00'),
    (2,11,'2008-11-06 00:00:00','2008-11-08 23:00:00'),
    (3,11,'2008-11-09 00:00:00','2008-11-10 00:00:00'),
    (4,11,'2008-11-10 11:37:00','2008-11-11 00:00:00'),
    (5,22,'2008-10-28 00:00:00','2008-10-29 20:00:00'),
    (6,22,'2008-10-31 00:00:00','2008-11-05 00:00:00'),
    (7,22,'2008-11-07 00:00:00','2008-11-11 00:00:00');
    ;WITH CTE AS
    SELECT *,ROW_NUMBER() OVER(PARTITION BY car ORDER BY dateFrom) AS rn FROM yourTable
    CTE2 AS
    SELECT c1.car car,c2.dateTo gapFrom, c1.dateFrom gapTo
    FROM CTE c1 LEFT JOIN CTE c2
    ON c1.rn=c2.rn+1 AND c1.car=c2.car
    WHERE c1.dateFrom <> c2.dateTo
    SELECT *,CAST(ROUND(DATEDIFF(MINUTE,gapFrom,gapTo)/60.0,2) AS NUMERIC(20,1)) gapDelta FROM CTE2 ORDER BY car,gapTo;
    DROP TABLE yourTable;
    I just made a little modification on the dateTo column so that the
    dateTo equaling to the dateFrom of next record can be identified as no gap. If you still prefer the dateTo valuing like ‘2008-11-06 23:59:59‘ as it was, you just modify the WHERE clause as below.
    WHERE DATEDIFF(MINUTE,c2.dateTo,c1.dateFrom) <> 1
    If you have any question, feel free to let me know.
    Best regards,
    Eric Zhang

  • Problem when to get JFrame components

    I want to get all components from a JFrame. The problem is, when first time i want to get JFrame components...it will print like below...
    nullHi i am button
    Hi i am label
    Hi i am text field
    Hi i am button that you clicked
    but for second time and others, i get true result like below
    Hi i am button
    Hi i am label
    Hi i am text field
    Hi i am button that you clicked
    Can someone show me some light, what mean of null that i get every first time i want to get JFrame components.
    Below is my source code :
    import javax.swing.JFrame;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.GridLayout;
    import java.awt.Component;
    import java.awt.BorderLayout;
    import java.awt.Container;
    public class GetAllComponentInJFrame implements ActionListener
         String storeAllComponentName;
         JFrame frame=new JFrame("Get all component in a JFrame");
         JButton button=new JButton("Button");
         JLabel label=new JLabel("Label");
         JTextField textField=new JTextField("Text field");
         JButton buttonToClick=new JButton("Click here to get all component in JFrame");
         GridLayout gl=new GridLayout(4,1);
         public GetAllComponentInJFrame()
              frame.setLayout(gl);
              buttonToClick.addActionListener(this);
              frame.setName("I am JFrame");
              button.setName("Hi i am button");
              label.setName("Hi i am label");
              textField.setName("Hi i am text field");
              buttonToClick.setName("Hi i am button that you clicked");
              frame.getContentPane().add(button);
              frame.getContentPane().add(label);
              frame.getContentPane().add(textField);
              frame.getContentPane().add(buttonToClick);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setSize(400,400);
              frame.setVisible(true);
         public void actionPerformed(ActionEvent event)
              if(event.getSource()==buttonToClick)
                   Component[]arrayToStoreComponent=frame.getContentPane().getComponents();
                   for(int i=0; i<arrayToStoreComponent.length; i++)
                        Component temp=arrayToStoreComponent;
                        storeAllComponentName=storeAllComponentName+temp.getName()+"\n";
                   System.out.println(storeAllComponentName);
                   storeAllComponentName=new String("");
         public static void main(String[]args)
              GetAllComponentInJFrame gacijf=new GetAllComponentInJFrame();

    So, why i just get it only on first..not on second or third when i click button :
    JButton buttonToClick=new JButton("Click here to get all component in JFrame");I hope you can show me the right way to get all components in JFrame? Thanks for spend a time on my problem.

  • DateTime issue at Universe Level

    Hello Experts,
    We have stored date in database as datetime format. In Universe, we have created object on this date. But we have to keep type of this objet as u2018Dateu2019 as there is no datetime  object type available  in universe.
    When we dragged this objet in webi, we found that we are getting only date but no timestamp. We can manually do this using report formatting. However we would like to achive this at universe level.
    My question is : What should be the type of object in universe for getting datetime at report level ?
    We found that, if we keep objet type as char, we may get the desired results. However is there any other alternative?
    Regards,
    Chinmay

    Hi,
    Use the Function Convert to convert into datetime format in the Universe object level.
    Syntax:
    convert(datetime,field_name,101)
    Regards,
    Shiva Kumar G.C

Maybe you are looking for

  • Some emails in Mail 5 are brown / gold colour

    Hey guys Installed OS X Lion and migrated my emails into Mail 5, and i've noticed that some messages are like a gold / brown colour. I thought this might have something to do with being Junk, or marked as junk, but I have selected 'Not junk' but no c

  • Report on Material document by Material Group

    Hi Apart from MB51 is there any report for Material document list by one of the selection criteria as Material Group Its urgent Please Regards Amuthan M

  • Approval Center - Report SSRS

    I would like to create a report (SSRS or Excel Services) that compares the data (Planned Work) of scheduling with data which send resources (Actual Work). That's what today is inadequate because it allows project managers complain that they can not s

  • Set flags true

    Hello! A Function Module at backend which is called like below shown has also two flags. I intend to set those flags on true. How is that working ? This is the call of FM inside a method. wdContext.current__I_Rf02_Ial_Query_InputElement().modelObject

  • How to get Top Talkers on ASA ?

    hi Friends, We ahave ASA 5510 and 5520 @ our office. We are not using any netflow tools in order to get the talk talklers. As this firewalls are shared firewall (used by different Projects), we are not able to get , which project is using more traffi