Digital Clock in ADF
Hi All,
How can I add the digital clock in ADF( Studio Edition Version 11.1.1.1.0 /Build JDEVADF_11.1.1.1.0_GENERIC_090615.0017.5407/)
Version Details :
ADF Business Components 11.1.1.54.7
CVS Version Internal to Oracle JDeveloper 11g (client-only)
Java(TM) Platform 1.6.0_11
Oracle IDE 11.1.1.1.33.54.07
Versioning Support 11.1.1.1.33.54.07
Please help me....
Regards
Shekhar
How can I Show the Current Date Time In a page. Time will be changeable.here is an example:
jspx
<af:form id="f1">
<af:poll id="p1" interval="1000" immediate="true"
pollListener="#{viewScope.clockBKB.pollListener}"/>
<af:outputText value="Time:#{viewScope.clockBKB.strTime}" id="ot1" partialTriggers="p1"/>
</af:form>backing bean (ClockBKB.java)
import java.util.Date;
import org.apache.myfaces.trinidad.event.PollEvent;
public class ClockBKB {
private String strTime;
public ClockBKB() {
public void pollListener(PollEvent pollEvent) {
strTime = new Date().toString();
public String getStrTime() {
return strTime;
}You may want to format the date as per your requirements.
regards
srini
Similar Messages
-
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);
} -
How to output the digital clock and synchronization signal from the NI USB-6211
Hello,
I need to connect the NI USB-6211 to control a digital to analog convertor chip (AD5541). However, this chip requires three input signals :1) Clock input, 2) Logic input or a synchronization signal and 3) Signal Serial Data input (CS, SCLK, DIN).
how to output the digital clock and the synchronization signal from the NI USB-6211?Hi SaberSaber,
You should be able to use the counters to generate a pulse train that could be used for clock and synch purposes.
Hope this helps. Let us know if you have more questions.
Dave C.
Applications Engineer
National Instruments -
Hello, I am learning java and i can make simple programs. i have only taken 2 years of java programmin in school.
i wanted to try something harder, i don't know if i am ready for it or not.
I want to make a digital clock in java, and maybe modify it by adding buttons to increase hours and mins.
I have kinda starte it. but i need a lot of help.by the nature of your questions, it appears that you don't know much about swing, timers, and java date time functions. We can't just tell you what you need for your clock, otherwise we'd be building it for you. What you need to do is study these areas and learn for yourself. I suggest that you start with the Sun Java Swing tutorials. Start out here:
http://java.sun.com/docs/books/tutorial/ui/index.html
and
http://java.sun.com/docs/books/tutorial/uiswing/index.html -
Digital clock which randomly selects different colors from Applet
Hi,
I relatively new to java, what I'm trying to do is list about five colours in my Applet and pass the colours into my java code, and maybe the font.....
I want to be able to Display a digital clock which randomly selects different colours which were passed from my Applet
Thanks for any help
Zip
Clock Code:
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.text.*;
public class dclock extends Applet implements Runnable{
Thread animThread = null;
int delay = 1000;
public void init(){}
public void paint (Graphics g){
// get the time
Calendar cal = Calendar.getInstance();
Date date = cal.getTime();
// format it and display it
DateFormat dateFormatter =DateFormat.getTimeInstance();
g.drawString(dateFormatter.format(date), 5, 10);
public void start(){
if(animThread == null){
animThread = new Thread(this,"Animation");
animThread.start();
public void stop(){animThread = null;}
public void run(){
while(animThread !=null){
try{ Thread.sleep(delay);}
catch(InterruptedException e){};
repaint();
//sec++;
}Why doesn't the clock just decide what colour it is going to be? If you need to pass the colour choices in, just let the clock accept a collection of colours in its constructor or something. I don't understand what bit of this you are having problems with as you haven't really explained. Please also use code tags.
-
Digital clock timer to turn on/off lights at certain times
Hello i am an undergraduate student curently doing a project.
I am making a automated plant growing system.
i need help in creating a VI that can use a digital clock to input a time for grow lights and a water pump to turn on and off.
Il will be using GPIB power supplies to power both.Hi,
Graham is currently out of the office, so I am taking over dealing with this support request.
I have attached a VI which shows an example of how to read the current time from the Time Stamp, and then specify a Start and End Time for the lights in your system to turn on. The example currently just activates an LED on the Front Panel, but you should be able to easily change this to an operation that sends the different string commands you require to your power supply for the lights and the water pump to turn them on and off respectively.
Regards,
Dan
Attachments:
Lights Controller.vi 16 KB -
hello!
I am trying to build a digital clock circuit to count the time in hours,minutes and seconds( I use Multisim Power Pro 10).
my first problem is that i was supposed to use CMOS CD4026(decade counters and 7-segment display drivers), but it doesn't exist in my library. So I tried to find a replacement and I got some(7490,74176,74292). But now I can't seem to figure out how to connect these so that I have the proper display. Can you please give me a hint?
Thank you!Hi,
There were a few problems with the circuit which is why the clock was not reseting at 3. I have modified the file. Please take a look and see. You will need to add a buffer between the second input and the AND gate because otherwise, the gate will trigger before the output has actually reached the desired state.
I had to edit the delay time in the buffer to make it work of this circuit. To edit the delay time, double-click the Buffer and under the Value tab, click on Edit Model. You can change the rise time and fall time from this window.
Hope this helps.
Regards,
Tayyab R,
National Instruments.
Attachments:
NEW140712 mod.ms11 545 KB -
I am trying to simulate a digital clock for counting 0-60 seconds using two seven seg displays two 7447 two 7493 and two clock generators on Multisim but the problem is i cannot workout the frequency input to be given to the two 7493 ic's connected to the displays through the two 7447 ic's please help
Solved!
Go to Solution.
Attachments:
Untitled.png 187 KBYou should post to the multisim board. You can click on Options and request that the moderator move your question. It really had nothing to do with an NI digital I/O device.
-
Digital clock reset problem with 74193N
Hi, i'm designing a digital clock circuit.
However, i faced problems during reset part.
when i tried to reset on 3(U11) with 1 NAND gate and 2 NOR gates,
i think i don't make mistake to reset with 0011(U3),how come the 3 will also appear on the seven-segment display?
Well,i also wonder how can i reset the other seven-segment display(U9) to show the following sequences:
0,1,2,3,4,5,6,7,8,9,0,1,2,3,0,1,2,3,4,5,6,7,8,9,0,1,2,3,0..
Lastly, is that possible to configure the transmition speed in multisim 11.0?
Thanks..
Attachments:
NEW140712.ms11 363 KBHi,
There were a few problems with the circuit which is why the clock was not reseting at 3. I have modified the file. Please take a look and see. You will need to add a buffer between the second input and the AND gate because otherwise, the gate will trigger before the output has actually reached the desired state.
I had to edit the delay time in the buffer to make it work of this circuit. To edit the delay time, double-click the Buffer and under the Value tab, click on Edit Model. You can change the rise time and fall time from this window.
Hope this helps.
Regards,
Tayyab R,
National Instruments.
Attachments:
NEW140712 mod.ms11 545 KB -
Analog or Digital Clock in movie
Hi,
I am wanting to put a analog or digital clock in a video I am making for a class. I doesn't have to show the real time but hopefully it will have hours:minutes:seconds. Does anyone know where I can get one?
Thanks.
AndyIf you have access to After Effects, you can do it under the "Textt" filter, then click on "Numbers." Pick a font, and then you can set what you need under the format tab. That should square you away. Or you could make your own digital clock with numbers in FCP, or with photoshop layers and set it up on a timeline manually. You could set up your incoming clip for one frame and just drop in the layers and theyll drop in sequence instead of dropping in every number one by one. All you would have to do is go through the trouble of making 01-59. Hope that helps.
-
How to get digital clock (and weather back)
A couple of weeks ago, I was going to ask how to change the analog clock on the "main screen" to a digital one.
But now it is gone completely.
My little local weather info underneath also disappeared.
How do I get them back? ... While also changing to a digital clock.
PS: There is a little digital clock on the screen before I do the finger-trace security login, but not afterward.
Thanks.Have you tried Beautiful Widgets at https://market.android.com/details?id=com.levelup.beautifulwidgets&feature=search_result
or
Weather and Toggle from https://market.android.com/details?id=com.androidapps.widget.weather2&feature=search_result.. -
Hi All,
Since I am a new bee, I am seeking a simple digital clock MIDlet. Last two days I have been searching internet but I haven't found. If you do not consider me as RTFM or too lazy, could you please either post a script or simple give a shortcut?
Many thanks in advance
seyyahdeepspace,
this is my code but it is not updating. I know tha I am being too much. Help is really appriciated.
* DrawImage.java
* Draw mutable image on a canvas
import java.util.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class emuezzin extends MIDlet
private Display display; // The display
private ImageCanvas canvas; // Canvas
public emuezzin()
display = Display.getDisplay(this);
canvas = new ImageCanvas(this);
protected void startApp()
display.setCurrent( canvas );
protected void pauseApp()
protected void destroyApp( boolean unconditional )
public void exitMIDlet()
destroyApp(true);
notifyDestroyed();
* Class ImageCanvas
* Draw mutable image
class ImageCanvas extends Canvas implements CommandListener
private Command cmExit; // Exit midlet
private emuezzin midlet;
private Image im = null;
private String message = "developerWorks 1";
public ImageCanvas(emuezzin midlet)
this.midlet = midlet;
// Create exit command and listen for events
cmExit = new Command("Exit", Command.EXIT, 1);
addCommand(cmExit);
setCommandListener(this);
* Draw mutable image
protected void paint(Graphics g)
// Clear the display
Calendar now = Calendar.getInstance();
int hours = now.get(Calendar.HOUR_OF_DAY);
int minutes = now.get(Calendar.MINUTE);
int seconds = now.get(Calendar.SECOND);
String message = hours+":"+minutes+":"+ seconds;
System.out.println("Current Time = "+message);
// Create mutable image
im = Image.createImage(100, 20);
// Get graphics object to draw onto the image
Graphics graphics = im.getGraphics();
// Specify a font face, style and size
Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);
graphics.setFont(font);
// Draw a filled (blue) rectangle, with rounded corners
graphics.setColor(0, 0, 255);
graphics.fillRoundRect(0,0, im.getWidth()-1, im.getHeight()-1, 20, 20);
// Center text horizontally in the image. Draw text in white
graphics.setColor(255, 255, 255);
graphics.drawString(message,
(im.getWidth() / 2) - (font.stringWidth(message) / 2),
(im.getHeight() / 2) - (font.getHeight() / 2),
Graphics.TOP | Graphics.LEFT);
g.setColor(255, 255, 255);
g.fillRect(0, 0, getWidth(), getHeight());
// Center the image on the display
if (im != null)
g.drawImage(im, getWidth() / 2, getHeight() / 2,
Graphics.VCENTER | Graphics.HCENTER);
public void run(){
while(true){
repaint();
try{
System.out.println("Current Time =");
Thread.sleep(1000);
} catch (Exception e){}
public void commandAction(Command c, Displayable d)
if (c == cmExit)
midlet.exitMIDlet();
} -
How do i build a digital clock in multisim
I need help. I am trying to build a digital clock in multisim. I know some things but not what I need to know. Originally this project was supposed to be a full 12 hour format with minutes and seconds but the instructor decided to make it just the hours. So, count to 12 then reset to 1. I want to use jk flip flops, 7447 decoder and 2 seven segments. I am attaching the circuit that my instructor helped me with yesterday that counts from 3-9( I dont know why , but just in case it helps). Also, I am not looking for someone to just build a circuit for me, I want to understand HOW it works. From what I was able to understand yesterday, it seems that the output is derived from the combination of my clears and presets, but I couldn't figure out exactly what my instructor was trying to explain to me. PLEASE HELP!!!!, this project is due in 6 days and I need ti understand it.
Attachments:
Design3.ms11 302 KBHello,
For those of you are still interested in knowing how to build a digital clock in Multisim, you can find a digital clock in the component database under The Sources group, Digital_Sources family. After placing the digital clock on your schematic you can change its frequency, duty cycle, and delay time in its property window (you can access by double-clicking on the component).
Regards,
Sharanya R
Market Development Engineer
National Instruments -
6300 - Any way to change the digital clock appeara...
Hi all,
Very happy with my new 6300 except for one thing - the digital clock on the normal standby screen is difficult to read and quite ugly with its pretend LED display. On every other screen, and when the display blanks, the time is shown in the very readable standard system font. Can the clock on the standby screen be configured that way? Or changed in any way?
Thanks for any help.well you get two clock options in 6300 one the digital and the other one is analogue.there is only one style to both the clocks and you can't configure it.while browsing the menu the clock will appear in system default font only.
what you can do,if you want to change the clock's appearance for a while is,you can apply a theme which has a swf slock set as the wallpaper.you can easily find such themes if you google them out.
Was this post of some help? Click 'Kudos' star on the right hand side of this post. Your gesture will be highly appreciated! -
[SOLVED] Thunderbird integration with KDE Digital Clock Widget
Is there a way to integrate Thunderbird's Lightning calendar extension with the KDE Digital Clock widget (default clock) so that clicking on it shows you your calendar events? Something similar like using the Evolution Data Server Mirror to sync with the GNOME Panel clock.
I have tried fiddling with various widgets, exporting iCalendars and importing with Personal Information settings, but nothing has worked so far.
Last edited by cornelus (2012-06-07 08:45:16)Hello
I use these steps in Thunderbird 31:
"New Calendar" >> "On the Network" >> "iCalendar (ICS)"
and use the "file://" protocol for the "Location" and give it the path of iCalendar file I use in the Akonadi/KOrganizer, i.e: "file:///home/MYNAME/calendar.ics"
also check the calndar "Properties" and uncheck the "Read Only", if it is necessary.
Maybe you are looking for
-
Selective line item to be printed in Delivery Note
Hi All! There is a specific requirement that the packing material used should not be printed but the number of packed units should get printed with the identification number. for e.g. There is 100kg of Aluminium strips [Material XYZ] which is to pack
-
Sync is not working in Firefox 30
I've just installed Windows 7 x64 and Firefox 30. I've succesfully logged in with my Sync account but nothing happens. Sync is not working in this device but it does in others. Other devices have also the latest version of Firefox.
-
I recently updated my iPad now I can't access all the documents in the pages app, any advice to to get them back on my iPad?
-
I have a PowerBook G4 running OSX 10.5.8. What problems am I going to encounter with Cloud?
-
How do I see the remaining balance of Benefit amount?
Hi All, Can somebody tell me how to see the remaining balance of particular benefit for 1 or more employee? Suppose the entitlement benefit for mr.A is $100 and he is already claiming $70 so far, then the remaining would be $30 (just to make sure my