Are you good at threads?

HI!
I have problems with java and threading!
I have made a clock with two threads. It almost works but if i, start it and stop it, i can't start it again.
I can't fint the fault!!
can anyone help??
Stian
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class klokke3 extends JFrame implements ActionListener{
    private JPanel en = new JPanel();
    private JButton startklokke,stoppklokke;
    //private int settigang;
    private Second sekund;
    private Minute minute;
    private TickTock minuteTick;
     public static void main(String[] args) {
        klokke3 frame = new klokke3();
        frame.setSize(500,300);
        frame.init();
        frame.show();
    public void init() {
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        getContentPane().add(en); //ma legge panelet i contentpane for at grafik skal vise
        TextField showSeconds = new TextField(20); //oppretter textfields
        en.add(showSeconds);
        showSeconds.setEditable(false);//far ikke lav a skrive i textfield
        TextField showMinutes = new TextField(20);
        en.add(showMinutes);
        showMinutes.setEditable(false);//far ikke lav a skrive i textfield
        startklokke = new JButton("Start klokke");
     en.add(startklokke);
        startklokke.addActionListener(this);
        stoppklokke = new JButton("Stopp/nullstill");
     en.add(stoppklokke);
        stoppklokke.addActionListener(this);
        //en.add(stoppklokke);
        minuteTick = new TickTock();
         minute = new Minute(showMinutes, minuteTick);
         minute.start();
         sekund = new Second(showSeconds, minuteTick);
        //sekund.start();
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() == stoppklokke) {
        sekund.pleasestop();
        //minute.pleasestop2();
    if (e.getSource()==startklokke){
        sekund.start();
class Second extends Thread {
    private int seconds = 0;
    private boolean quit;
    private TextField showSeconds;
    private TickTock minuteTick;
    public Second(TextField showSeconds, TickTock minuteTick) {
        this.showSeconds = showSeconds;
        this.minuteTick = minuteTick;
    public void run() {
        quit=true;
        while(quit) {
            try {
                Thread.sleep(1000);
            catch (InterruptedException e) {
                System.err.println("Exception");
            if(seconds == 59) {
                minuteTick.tick();
                seconds = 0;
            else seconds++;
            showSeconds.setText(seconds + " seconds");
    public void pleasestop(){
        quit=false;
        showSeconds.setText( " ");//Dersom knappen er trykka blanker vinduet
   // public void st(){
   //     quit=true;
class Minute extends Thread {
    private boolean quit2;
    private int minutes = 0;
    private TextField showMinutes;
    private TickTock minuteTick;
    public Minute(TextField showMinutes, TickTock minuteTick) {
        this.showMinutes = showMinutes;
        this.minuteTick = minuteTick;
    public void run() {
        quit2=true;
        while(quit2) {
            minuteTick.waitForTick();
            if (minutes == 59) {
                minutes = 0;
            else
                minutes++;
            showMinutes.setText(minutes + " minutes");
        public void pleasestop2(){
         quit2=false;
         showMinutes.setText( " ");//Dersom knappen er trykka blanker vinduet
         //quit2=true;
     //   public void st2(){
     //       quit2=true;
class TickTock {
    private boolean tickHappens = false;
    public synchronized void waitForTick() {
        while (!tickHappens)
            try {
                wait();
            catch (InterruptedException e) {
                System.err.println("Exception");
        tickHappens = false;
    public synchronized void tick() {
        tickHappens = true;
        notify();
}

But now i got a new problem.
I f i press the startbutton many times. several
clock's start and i only want one to startYou need to post your new code.
A comment about your variables.
1. 'quit' means 'stop' you loop on quit == true. That's a little confusing.
2. You use the name quit1 in one of your classes. There's no reason to name it differently. It's just annoying.

Similar Messages

  • Are you king of threads?

    We were implementing a producer consumer thing and my partner dropped out leaving me with a huge load of problems.
    Threads are not exactly my cup of tea. All I want to do is to make the application pause as long as the time printed from the keyboard.
    The time pausing should be specified for consuming the products and producing them. Also how long the buffer should hold after an item is inserted there. I don't think I'm that far from the solution, but nothing happens when I try to run it.
    I apologise for the amount of code, but maybe it was nessecary to get the whole picture?
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.Timer;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Producer extends Location
            implements Runnable
         public Thread aktivitet= new Thread(this);
         private ProductTypeList canProducera;
         private ProductList harProducerat;
         private Color color;
         private String producerStatus= "";
         private String producerName;
         private JPanel prodPanel;
            private JPanel prodLetterHasPanel;
            private Label prodSifTimerLabel = new Label ("0");
            private Timer t;
            private Label prodStatusLabel;
            private Buffer buffer;
            private SpelFrame frame;
         public Producer(Color arg_color, String name, ProductTypeList canProduc,Buffer buffer1)
                this.producerName=name;
                this.color = arg_color;
                this.canProducera= canProduc;
                this.harProducerat= new ProductList();
                this.producerStatus="WAITING_ON_BUFFER_NOT_FULL";
                System.out.println(this.producerName + " ");
                this.buffer= buffer1;
                this.t = new Timer(100, new TickLyssnare(prodSifTimerLabel));
                t.start();
                aktivitet.start();
            public void addFrame(SpelFrame fr)
                this.frame=fr;
            public void run()
                while(!Thread.interrupted())
                    try
                        Thread.sleep(2000);
                        Product produkt= produce();
                        this.buffer.put(produkt);
                    catch(InterruptedException avbruten)
                        break;
            public Color getProducerColor()
                return this.color;
            public ProductList getHasProducet()
                return this.harProducerat;
         private ProductType getRandomProductType()
              int rand_tal= (int) (Math.random()*this.canProducera.getListLength());
              return this.canProducera.getObjectByIndex(rand_tal);
         public Product produce()
              Product newProduct = new Product(this, this.getRandomProductType());
              this.harProducerat.setProduct(newProduct);
                    this.producerStatus="PRODUCING";
                    this.prodStatusLabel.setText(this.producerStatus);
                    this.addProductTillProducerPanel(newProduct);
                    //this.buffer_Manipulation(newProduct);
              return newProduct;
         public void buffer_Manipulation(Product product)
                System.out.println("Remove fr�n "+this.producerName + "  "+product.getType().present_me()+
                            " till buffer");
                if(buffer.is_Buffer_Full())
                    this.producerStatus="WAITING_ON_BUFFER_NOT_FULL";
                    this.prodStatusLabel.setText(this.producerStatus);
                else
                    System.out.println("Remove fr�n "+this.producerName + "  "+product.getType().present_me()+
                            " till buffer");
                    this.producerStatus="MANIPULATING_BUFFER";
                    this.prodStatusLabel.setText(this.producerStatus);
                    product.moveToBuffer(this.buffer);
                    buffer.uppdateBufferInformationPanel();
         public JPanel producerPanel()
                this.prodPanel= new JPanel();
                prodPanel.setLayout(new GridLayout(8,1));
                Label prodLabel = new Label(this.producerName);
                prodLabel.setForeground(Color.WHITE);
                prodLabel.setBackground(this.color);
                prodPanel.add(prodLabel);
                this.prodStatusLabel = new Label(this.producerStatus);
                prodPanel.add(prodStatusLabel);
                Label prodCanLabel = new Label("Can produce: ");
                prodPanel.add(prodCanLabel);
                Label prodLetterCanLabel = new Label(canProducera.presenteraMe());
                prodLetterCanLabel.setForeground(this.color);
                prodPanel.add(prodLetterCanLabel);
                 Label prodTimerLabel = new Label ("Timer:  ");
                prodPanel.add(prodTimerLabel);
                this.prodSifTimerLabel.setForeground(this.color);
                prodPanel.add(this.prodSifTimerLabel);
                Label prodHasLabel = new Label("Has produced:");
                prodPanel.add(prodHasLabel);
                this.prodLetterHasPanel =this.harProducerat.presenteraMeJPanel();
                prodPanel.add(this.prodLetterHasPanel);
                prodPanel.setBorder(BorderFactory.createLineBorder(this.color));
                return this.prodPanel;
            public void addProductTillProducerPanel(Product product)
              Label l = new Label(product.getType().present_me());
              l.setForeground(this.color);
              this.prodLetterHasPanel.add(l);
              this.frame.setVisible(true);
          class TickLyssnare implements ActionListener
                private int tick;
                private int sec;
                private Label lab;
                public TickLyssnare(Label tidLabel)
                    this.lab= tidLabel;
                    this.tick= 0;
                    this.sec= 0;
                 public void actionPerformed(ActionEvent e)
                   tick= tick + 1;
                   if (tick== 10)
                       tick= 0;
                       sec++;
                       System.out.println(" Tick Lyssnare: "+this.sec);
                       this.lab.setText(""+sec);
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.Timer;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Consumer extends Location
            implements Runnable
            public Thread aktivitet = new Thread(this);
         private ProductTypeList canConsum;
         private ProductList hasConsumt;
         private String consumerStatus = "";
         private String consumerName;
         private JPanel consPanel;
            private Label consStatusLabel;
            private Label consSifTimerLabel= new Label ("0");
         private JPanel consLetterHasPanel;
            private Timer t;
            private SpelFrame frame;
            private Buffer buffer;
            private long tid;
         public Consumer(String name,ProductTypeList argCanConsum, Buffer buffer1)
              this.consumerName= name;
              this.canConsum = argCanConsum;
              this.hasConsumt = new ProductList();
              this.consumerStatus = "WAITING_ON_BUFFER_ACCESS";
                    this.buffer= buffer1;
                    this.t = new Timer(100, new TickLyssnare(consSifTimerLabel));
                    t.start();
                    aktivitet.start();
            public void run()
                while (!Thread.interrupted())
                    try{
                        Thread.sleep(2000);
                        buffer.take(this);
                    catch (InterruptedException avbruten)
                        break;
            public void addFrame(SpelFrame fr)
                this.frame=fr;
            public void consumera(Buffer buffer)
                if(!buffer.is_Buffer_Empty())
                    this.consumerStatus="MANIPULATING_BUFFER";
                    this.consStatusLabel.setText(this.consumerStatus);
                   ProductList bufferList= buffer.getBufferList();
                   for(int i=0; i< bufferList.getListLength();i++)
                       Product product= bufferList.getObjectByIndex(i);
                       if(this.isInCanComsum(product.getType()))
                           product.moveToConsumer(this);
                           this.addProductTillConsumerPanel(product);
                           System.out.println(product.getType().present_me()+ " har consumerat");
                           buffer.uppdateBufferInformationPanel();
                           this.consumerStatus="CONSUMING";
                           this.consStatusLabel.setText(this.consumerStatus);
                else
                    this.consumerStatus="WAITING_ON_BUFFER_NOT_EMPTY";
                    this.consStatusLabel.setText(this.consumerStatus);
            public void addProductTillConsumerPanel(Product product)
              Label l = new Label(product.getType().present_me());
              l.setForeground(product.getProducer().getProducerColor());
              this.consLetterHasPanel.add(l);
              this.frame.setVisible(true);
            public boolean isInCanComsum(ProductType prType)
                return this.canConsum.isInTypeList(prType);
            public void addHasConsumt(Product product)
              this.hasConsumt.setProduct(product);
         public void setConsumerStatus(String status)
              this.consumerStatus=status;
         public String getConsumerStatus()
              return this.consumerStatus;
         public void consume(Product new_product)
              this.hasConsumt.setProduct(new_product);
         public void buffer_Manipulation()
            public JPanel consumerPanel()
                this.consPanel= new JPanel();
                consPanel.setLayout(new GridLayout(8,1));
                Label consLabel = new Label(this.consumerName);
                consLabel.setForeground(Color.WHITE);
                consLabel.setBackground(Color.MAGENTA);
                consPanel.add(consLabel);
                this.consStatusLabel = new Label (this.consumerStatus);
                consPanel.add(consStatusLabel);
                Label consCanLabel = new Label("Can consume: ");
                consPanel.add(consCanLabel);
                Label consLetterCanLabel = new Label(canConsum.presenteraMe());
                consPanel.add(consLetterCanLabel);
                Label consHasLabel = new Label("Has consumed:");
                consPanel.add(consHasLabel);
                this.consLetterHasPanel =this.hasConsumt.presenteraMeJPanel();
                consPanel.add(consLetterHasPanel);
                Label consTimerLabel = new Label ("Timer:  ");
                consPanel.add(consTimerLabel);
                consPanel.add(this.consSifTimerLabel);
                consPanel.setBorder(BorderFactory.createLineBorder(Color.MAGENTA));
                return this.consPanel;
            class TickLyssnare implements ActionListener
                private int tick;
                private int sec;
                private Label lab;
                public TickLyssnare(Label tidLabel)
                    this.lab= tidLabel;
                    this.tick= 0;
                    this.sec= 0;
                 public void actionPerformed(ActionEvent e)
                   tick= tick + 1;
                   if (tick== 10)
                       tick= 0;
                       sec++;
                       System.out.println(" Tick Lyssnare: "+this.sec);
                       this.lab.setText(""+sec);
    import javax.swing.*;
    import javax.swing.Timer;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Buffer extends Location
        private ProductList bufferList;
        private String ss1;
        private String ss2;
        private Label l1,l2,l3, l4, lb1,lb2, lb3, lb4;
        private DrawingArea dArea;
        private SpelFrame frame;
        public long tid;
        public Buffer()
            this.bufferList = new ProductList();
        public synchronized void put(Product product)
             while (this.bufferList.getListLength()>=4)
            while (bufferList.isEmty())
                            try {Thread.sleep(SpelFrame.setTime(tid));}
                      catch (InterruptedException e)
                              return;
            product.getProducer().buffer_Manipulation(product);
            notify();
            this.frame.setVisible(true);
        public synchronized void take(Consumer consumer)
            while (this.bufferList.isEmty())
                 try {Thread.sleep(SpelFrame.setTime(tid));}
                catch (InterruptedException e)
                    return;
            consumer.consumera(this);
            this.frame.setVisible(true);
        public void uppdateBufferInformationPanel()
             if(this.is_Buffer_Empty())
                         ss1 ="* is empty";
                    else
                        ss1 ="* is not empty";
              if(this.is_Buffer_Full())
                       ss2 ="* is full";
                    else
                       ss2 ="* is not full";
            this.dArea.changeDrawingArea(ss1, ss2, "Buffer");
            int buffLength= bufferList.getListLength();
            if (buffLength>0)
                               lb1.setText(bufferList.getObjectByIndex(0).present_me());
                               lb1.setForeground(
                                    bufferList.getObjectByIndex(0).getProducer().getProducerColor());
                            else
                               lb1.setText("");
           if (buffLength>1)
                               lb2.setText(bufferList.getObjectByIndex(1).present_me());
                               lb2.setForeground(
                                    bufferList.getObjectByIndex(1).getProducer().getProducerColor());
                            else
                               lb2.setText("");
           if (buffLength>2)
                               lb3.setText(bufferList.getObjectByIndex(2).present_me());
                               lb3.setForeground(
                                    bufferList.getObjectByIndex(2).getProducer().getProducerColor());
                            else
                               lb3.setText("");
          if (buffLength>3)
                               lb4.setText(bufferList.getObjectByIndex(3).present_me());
                               lb4.setForeground(
                                    bufferList.getObjectByIndex(3).getProducer().getProducerColor());
                            else
                               lb4.setText("");
        public ProductList getBufferList()
            return this.bufferList;
        public boolean is_Buffer_Empty()
         return this.bufferList.isEmty();
        public boolean is_Buffer_Full()
            if(this.bufferList.isEmty())
                return false;
            if(this.bufferList.getListLength()==4)
                return true;
            else return false;
        public void addToBuffer(Product product)
            bufferList.setProduct(product);
            System.out.println(product.getType().present_me()+" har addit till buffer ");
        public void deleteFromBuffer(Product product)
            this.bufferList.remove_Product(product);
            System.out.println(product.getType().present_me()+" has removed from the buffer");
        public JPanel presentMePanel()
            JPanel bufferPanel = new JPanel();
                 bufferPanel.setLayout(new GridLayout(2,1));
                    if(this.is_Buffer_Empty())
                         ss1 ="* is empty";
                    else
                        ss1 ="* is not empty";
                    if(this.is_Buffer_Full())
                       ss2 ="* is full";
                    else
                       ss2 ="* is not full";
                    this.dArea = new DrawingArea(ss1, ss2, "Buffer");
                    bufferPanel.add(dArea);
                    JPanel bufferInnePanel = new JPanel();
                    bufferInnePanel.setLayout(new GridLayout(8,1));
                    JPanel bufferStorInnePanel = new JPanel();
                    bufferStorInnePanel.setLayout(new GridLayout(1,3));
                    int buffLength= bufferList.getListLength();
                    l1 = new Label("Product 1");
                    bufferInnePanel.add(l1);
                    if (buffLength>0)
                               lb1 = new Label(bufferList.getObjectByIndex(0).present_me());
                               lb1.setForeground(
                                    bufferList.getObjectByIndex(0).getProducer().getProducerColor());
                            else
                               lb1 = new Label("");
                     bufferInnePanel.add(lb1);
                    l2 = new Label("Product 2");
                    bufferInnePanel.add(l2);
                    if (buffLength>1)
                               lb2 = new Label(bufferList.getObjectByIndex(1).present_me());
                               lb2.setForeground(
                                    bufferList.getObjectByIndex(1).getProducer().getProducerColor());
                            else
                               lb2 =  new Label("");
                     bufferInnePanel.add(lb2);
                    l3 = new Label("Product 3");
                    bufferInnePanel.add(l3);
                    if (buffLength>2)
                               lb3 = new Label(bufferList.getObjectByIndex(2).present_me());
                               lb3.setForeground(
                                    bufferList.getObjectByIndex(2).getProducer().getProducerColor());
                            else
                               lb3 =  new Label("");
                     bufferInnePanel.add(lb3);
                    l4 = new Label("Product 4");
                    bufferInnePanel.add(l4);
                    if (buffLength>3)
                               lb4 = new Label(bufferList.getObjectByIndex(3).present_me());
                               lb4.setForeground(
                                    bufferList.getObjectByIndex(3).getProducer().getProducerColor());
                            else
                               lb4 =  new Label("");
                     bufferInnePanel.add(lb4);
                    bufferInnePanel.setBorder(BorderFactory.createLineBorder(Color.MAGENTA));
                    WhiteRectangel rect1= new WhiteRectangel();
                    WhiteRectangel rect2= new WhiteRectangel();
                    bufferStorInnePanel.add(rect1);
                    bufferStorInnePanel.add(bufferInnePanel);
                    bufferStorInnePanel.add(rect2);
                    bufferPanel.add(bufferStorInnePanel);
                    return bufferPanel;
        public void addFrame(SpelFrame fr)
                this.frame=fr;
    }Message was edited by:
    Jasper

    Here's the problem (I think).
    The setTime method should return the number of seconds(?) that sets sleep-time for the put and take methods.
    This is for putting objects in, the consumer has a simular thing for take.
    public class Producer extends Location
            implements Runnable
    public void run()
                while(!Thread.interrupted())
                    try
                        Thread.sleep(tid);
                        Product produkt= produce();
                        this.buffer.put(produkt);
                    catch(InterruptedException avbruten)
                        break;
    public class ProductList implements Runnable {
         private ArrayList<Product> products = new ArrayList<Product>();
         public void run() {}
         public void setProduct(Product product)
              this.products.add(product);--------------------------------------------------------------------------------------
    public synchronized void put(Product product)
    while (this.bufferList.getListLength()>=4)
            while (bufferList.isEmty())
                            try {Thread.sleep(SpelFrame.setTime(tid));}
                      catch (InterruptedException e)
                              return;
              simulateBuffering.addActionListener(this);
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
         public void actionPerformed(ActionEvent e) {
              Scanner sc = new Scanner((simulateBuffering.getText()));
              long temp = (sc.nextLong());
              setTime(temp);
         public static long setTime(long a){
              long tid = a;
              return tid;
    }

  • What Are You Playing Right Now Thread

    Hey guys!
    Let's start a good conversation! Thread topic is very simple which is...
    What Are You Playing Right Now?
    > Give a short overview about the game you are playing or is hooked right now.
    > Give your recommendations to other members (good and bad or both are accepted)
    > Likes and Dislikes
    > Keep it clean and use English please
    Shall we start?
    Right now I am playing Final Fantasy X... yes.. an old game..... it's taking a long time to complete it. Before it, I played Mass Effect 3. Very nice game! Love the story! A lot of action and drama too. Recommend it to FPS and RPG gamers! Love the graphics too! Lady characters are very sexy! I think I'm in love with Miranda :p I'm also playing a little BF3 from time to time. I'm planning to go back playing MMO but can't decide what to play yet. I played Dragon Nest but got tired of it...

    Quote from: Taskmaster;1295
    we don't have FB in mainland...
    and everything is more expensive in here.
    I'd love to play HOTS thou
    Yeah StarCraft 2 looks awesome. I think I did play the first installment before I started working. I would like to finish the story. Been a fan of it since the first StarCraft... I'm kinda in a need of advice right now. I'm tired of playing single-player games right now like Final Fantasy, ME3.. I still have Alan Wake and Max Payne 3 that I haven't touched yet.. I feel like going back to MMOs.. any good suggestions? I feel like playing Guild Wars 2 but I'm reluctant since it's kinda old now and getting on top of the ranks should be harder for anybody entering the game right now.. Hmmm.. any other suggestions?

  • Att: For those who are good in Thread.....

    Why does JFrame freezes(meaning no effect on any of its components) when Thread.sleep() is running? Is there anyway to overcome it?
    How do i know when the Thread ends? I use the isAlive() method ?

    It depends on for which thread you have called Thread.sleep().
    If it as a thread you have started it should be no problem. But if
    you call Thread.sleep() within a method called by the event dispatcher,
    you get the described behaviour. If the event dispatcher sleeps, no
    other event can be passed to your application.
    J&ouml;rg

  • I have a problem in this that i want to paas a form in a case that when user pres n then it must go to a form but error arises and not working good and threading is not responding

    made in cosmos help please need it
    using System;
    using Cosmos.Compiler.Builder;
    using System.Threading;
    using System.Windows.Forms;
    namespace IUOS
        class Program
            #region Cosmos Builder logic
            // Most users wont touch this. This will call the Cosmos Build tool
            [STAThread]
            static void Main(string[] args)
                BuildUI.Run();
            #endregion
            // Main entry point of the kernel
            public static void Init()
                var xBoot = new Cosmos.Sys.Boot();
                xBoot.Execute();
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                a:
                Console.WriteLine("------------------------------");
                Console.WriteLine("WELCOME TO THE NEWLY OS MADE BY THE STUDENTS OF IQRA UNIVERSITY!");
                Console.WriteLine("------------------------------");
                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("\t _____                                
                Console.WriteLine("\t|     |        |            |        
    |            |      |");
                Console.WriteLine("\t|     |        |            |        
    |            |      |");
                Console.WriteLine("\t|     |        |            |        
    |            |      |");
                Console.WriteLine("\t|     |        |            |        
    |            |      |___________");
                Console.WriteLine("\t|     |        |            |        
    |            |                  |");
                Console.WriteLine("\t|     |        |            |        
    |            |                  |");
                Console.WriteLine("\t|     |        |            |        
    |            |                  |");
                Console.WriteLine("\t|     |        |            |        
    |            |                  |");
                Console.WriteLine("\t|     |        |            |        
    |            |                  |");
                Console.WriteLine("\t|_____|        |____________|         |____________|      ____________");
                string input;
                Console.WriteLine();
                Console.Write("\nAbout OS     : a");
                Console.Write("\nTo Shutdown  : s");
                Console.Write("\nTo Reboot    : r");
                Console.Write("\nStart Windows Normaly : n");
                Console.WriteLine();
                input = Console.ReadLine();
                if (input == "s" || input == "S"){
                    Cosmos.Sys.Deboot.ShutDown();
                else
                if (input == "r" || input == "R"){
                    Cosmos.Sys.Deboot.Reboot();
                else
                if (input == "a" || input == "A"){
                    Console.ForegroundColor = ConsoleColor.DarkBlue;
                    Console.Clear();
                    Console.WriteLine("\n\n\n-------------------------------------");
                    Console.WriteLine("version: DISPLAYS OS VERSION");
                    Console.WriteLine("about: DISPLAYS INFO ABOUT ANGRY OS");
                    Console.WriteLine("hello or hi: DISPLAYS A HELLO WORLD");
                    Console.WriteLine("MESSAGE THAT WAS USED TO TEST THIS OS!!");
                    Console.WriteLine("-----------------------------------");
                    Console.Write("You Want to know : ");
                    input = Console.ReadLine();
                    if (input == "version"){
                        Console.WriteLine("--------------------");
                        Console.WriteLine("OS VERSION 0.1");
                        Console.WriteLine("--------------------");
                    else
                    if (input == "about"){
                        Console.WriteLine("--------------------------------------------");
                        Console.WriteLine("OS IS DEVELOPED BY Qazi Jalil-ur-Rahman & Syed Akber Abbas Jafri");
                        Console.WriteLine("--------------------------------------------");
                    Console.Write("Want to go back to the main window");
                    Console.Write("\nYes : ");
                    string ans = Console.ReadLine();
                    if (ans == "y" || ans == "Y")
                        goto a;
                        Thread.Sleep(10000);
                    else
                    if (input == "n" || input == "N")
                        Thread.Sleep(5000);
                        Console.Clear();
                        for (int i = 0; i <= 0; i++){
                            Console.Write("\n\n\n\n\t\t\t\t\t  ____        ____   ___  
                            Console.Write("\n\t\t|\t\t |  |      |    |     
    |   |  | |  |  |");
                            Console.Write("\n\t\t|\t|    |  |----  |    |     
    |   |  | |  |  |---");
                            Console.Write("\n\t\t|____|____|  |____  |___ |____  |___|  |    |  |___");
                            Thread.Sleep(500);
                        Thread.Sleep(5000);
                        Console.Clear();
                        BootUserInterface();
                        Console.ReadLine();
    //                    Form1 fo = new Form1();
                    else{
                        for (int i = 0; i <= 5; i++){
                            Console.Beep();
                            Thread.Sleep(1000);
                            goto a;
                while (true);
            private static void BootUserInterface() {
                Thread t = new Thread(UserInterfaceThread);
                t.IsBackground = true;
                t.SetApartmentState(ApartmentState.STA);
                t.Start();
            private static void UserInterfaceThread(object arg) {
                Form1 frm = new Form1();  // use your own
                Application.Run(frm);
     

    Hi
    Jalil Cracker,
    >>when user pres n then it must go to a form but error arises and not working good and threading is not respondin
    Could you post the error information? And which line caused this error?
    If you want to show Form1, you can use form.show() method
    Form1 frm = new Form1();
    frm.Show();
    In addition, Cosmos is an acronym for C# Open Source Managed Operating System. This is not Microsoft product.If the issue is related to Cosmos, it would be out of our support. Thanks for your understanding. And you need raise an issue at Cosmos site.
    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.

  • How to add for wikipages the popup " are you sure you want to leave this page" on edit

    Our users complain about hitting the backspace button in a wiki page, sometimes the I.E. goes back and loose their changes. I could get a jquery popup but I don't know how to know that the wiki page is in edit mode and not in view mode.Do you know how/what 
    to check with javascript in order to know the mode of the page?
    Thank you
    Christos

    Jquery has a specific function that allows you to add this sort of thing to general SharePoint pages.  I've not tried it in my own environment but some good useful starter information can be seen on a similar thread at Stack exchange.
    See if this is of any use for you
    http://stackoverflow.com/questions/1119289/how-to-show-the-are-you-sure-you-want-to-navigate-away-from-this-page-when-ch?rq=1
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Trying to decide 9650 or Samsung Facinate, are you happy with your BB?

    Hi,
    I am going to get my upgrade, and getting my first smartphone. I will be using for email, txt, phone, and a little web. Are you guys happy with the blackberry, or is it getting out dated and I should move to the driod platform? Was looking at the 9650.
    Help

    BlackBerry cannot be beat for instant email, texting (the Bold keyboard is amazing), call quality and battery life. Do you have friends with BlackBerrys? You can use BB Messenger to chat with them. In fairness, other smartphone platforms have instant messaging as well, but BBM is just easy and always connected, and you can see when someone has read your message (not sure if others offer this feature). And a big plus for me is I can stick a BB in my pocket and not worry about the screen cracking or scratching.
    I wouldn't worry about the platform being outdated. RIM is still a strong contender because BlackBerrys just work the way they're supposed to. Get what's right for you, because these opinions constantly change. I still see lots of "Back to BlackBerry" threads.
    Since you said "a little web," I think the Bold might be a good choice for you. If you were into heavy browsing, watching videos, or loading up on free apps and games, I'd say check out the Fascinate. If you want fun, innovative stuff that looks amazing onscreen, BB is not known for that.
    As a previous poster said, try out both devices in a store. It's the best way to know. Good luck deciding!

  • Yet Another Syncing Complaint (when are you going to get it right, Apple?)

    I have to say, syncing my phone with itunes is the most miserably frustrating techno-process in my life at the moment.
    About to step out for lunch, I thought it'd be nice to grab a new audio book to accompany my sandwich and I to the park. I found a title and had it on my hard drive in under 90 seconds -- an impressively frictionless acquisition.
    But then came time to go from computer to phone.
    I click sync. Message: "Syncing will remove 30 applications including "Around Me" and others from your phone." Umm, why? Why 30? Why not all? Why any at all? No indication given. Okay, I don't care about the apps -- just the book for now -- so let's ignore the app's. I uncheck the 'Sync Apps' box. Message: "Not syncing your apps will remove all applications and their data from your iPhone." Are you <edited by host> kidding me? Where is the sanity in that? All I want you to do is LEAVE MY APPS ALONE. Instead, my options are lose 30, or lose all of them. Granted, there are probably ways to get them back after losing them, but all I want to do is go to lunch with my new book, not sit here and think long-term syncing strategy.
    This is one of many examples of the absurd inflexibility of the iTunes<->iPhone relationship.
    Another is the incessant backups that take 20 minutes. All I want to do is put a 200mb audio file on my phone and go to lunch. That should take less time than it took to download the file, not nearly two orders of magnitude more (after downloading the book, it took nearly 45 minutes to get my phone back to a usable state). Not only does the phone get backed up, but I notice that the syncing process includes transferring files that were ALREADY ON THE PHONE back to the phone.
    Seriously, Apple? How is it that you can be so good at user experience EVERYWHERE ELSE and <edited by host> so hard at it here?
    I'd say get a grip, but I'm not sure that's the message I want to send.
    P.S. The fact that I'm this frustrated is obviously an indication of how otherwise invested I am in your products. It is indeed a love-hate relationship.

    From the description I would assume you normally connect your iPod at home, but you made the purchase at work managed to connect to a different library that has the same content. Have you recently had to rebuild the library following a crash?
    Apple have designed iTunes to associate the iPhone with a single library. When you connect it to a different library iTunes will want to erase all apps and media content (except the built-in apps) and replace them with stuff from the local libray. This happens even if you have the iPhone in manually manage mode and is different from the behaviour of earlier iPod models.
    Alternatively you could have used the iTunes app on the iPhone to make your purchase, connecting to local wi-fi if necessary to download larger files. I often do this to acquire podcasts before leaving home/work just in case syncing takes longer than usual for some reason.
    Alternatively, if my original guess was correct and you want to be able to update your iPhone from work, home, anywhere else you happen to be, it can be done with a portable clone of your library. See this thread:
    http://discussions.apple.com/message.jspa?messageID=11521077#11521077
    tt2
    Message was edited by: turingtest2

  • Are you kidding me? can't open 2008 Numbers?

    Just got the new numbers and it won't open any of my old 2008 numbers files. Can't open because it's too old! ***? You need to BUY iWorks 09, save the document and then open it in the new Numbers 3? Are you kidding me? BYE BYE APPLE!
    Wow, someone (probably Microsoft) gave some cash to greedy Apple under the table to stop the competition.
    Now give me back the $20!
    Bye Apple.

    I agree that you should not have to jump through undignified hoops if you've bought a new version of software and just need to bring old documents into it. That must have been an irritating surprise.  If someone in your organization spent time on the phone with Apple my guess is you would eventually get satisfaction. The solution suggested in the other thread seemed quicker, though, and may just do the trick.
    I'm sure you're aware that Numbers 3.0 is not as good as Numbers 2 if you need to produce a lot of precisely formatted printed output or are particularly attached to some of the features that have been dropped. Numbers 3 is better than Numbers 2 at collaboration and dynamic display, particularly of charts, on either Mac or iPad. It's also strong at data entry on mobile that syncs back to the Mac.
    To get a quick and quite vivid portrayal of users' feelings and perspectives on the various differences between the two, the features gained, features lost, and workarounds threads may be helpful.
    SG

  • Content graphics tools are no longer available - why and what are you replacing them with

    help

    rzernitsky
    If you tell us that you are "editing a photo" that would seem that you are in Photoshop Elements. We still do not know which version. So, I am assuming that you mean Photoshop Elements 12, the latest version. Premiere Elements is a video editor not a photo editor like Photoshop Elements so that is how I made that assumption.
    You are in the wrong forum if you are asking a Photoshop Elements question. But, let us see if we can help before your thread gets transferred to Photoshop Elements Forum by a moderator.
    From what you wrote "some of the graphics are no longer available". Which specific graphics are missing from the Photoshop Elements 12 CONTENT that you had before in another earlier version? Do you have that earlier version still either on or off your computer with Photoshop Elements 12?
    If you are seeing "some graphics" and are in Photoshop Elements 12, then you are in the Expert workspace, not the Quick workspace. So that is good. From what you wrote before, it sounded like ALL the graphics were gone. Now you clarify and say "some".
    Photoshop Elements has a large collection of Content with lots of categories and choices. So, please me specific in your answers so that we can help you. That Content does have a category named Graphics as well as a lot others.
    I think that I can help you with this situation, but the details are extremely important.
    Lots of words above, but we can narrow it down
    a. What version of Photoshop Elements are you editing your photo in?
    b. What version of Photoshop Elements did you have before that which had more Content (graphics)?
    Looking forward to your help in working through this problem.
    Thank you.
    ATR

  • Are you certified in MOF Foundation?

    Are you certified in MOF Foundation? Share your info here, let do a Database, just post
    J
    Candidate
    Exam Version
    Date
    Cleber Marques
    MOF Foundation 4.0
    December 23, 2008
    Cleber Marques
    MOF Foundation 3.0
    December 04, 2007
    Hope this helps.
    Regards,
    Cleber Marques
    Microsoft MVP & MCT | Charter Member: SCVMM & MDOP
    MOF Brazil Project: Simplifying IT Service Management
    My Blog
    | MOF.com.br
    | CleberMarques.com
    | CanalSystemCenter.com.br

    To answer to the thread, I am not (yet) certified in MOF 4.0 but planning to be so before the end of July 2012! Anyone able to
    share some experience and materials would be greatly appreciated!
    Good luck in
    your exam :)
    Regards,
    Cleber
    Marques
    Microsoft
    MVP & MCT | Charter Member: SCVMM & MDOP
    MOF
    Brazil Project: Simplifying IT Service Management
    My
    Blog | MOF.com.br | CleberMarques.com | 

  • I have an iphone 5, and the battery is so bad! I was just wonder if anyone had used an external battery before? are they good? can they do damage to your phone? what's the best one to get? any help would be great thanks!

    I have an iphone 5, and the battery is so bad! I was just wonder if anyone had used an external battery before? are they good? can they do damage to your phone? what's the best one to get? any help would be great thanks!

    I'd just like to say that ahs70's post on Dec 1, 2013 at 1:17am on Pg. 9 worked for me as well: https://discussions.apple.com/thread/5338609?start=120&tstart=0
    If your iPhone's battery is acting up you need to determine if it's a software issue or a hardware/battery issue.  To do that, after syncing your iPhone, erase/hard reset all data and settings from your iPhone to what it was from the factory as new.  This can be found in Settings/General/Reset/Erase All Content and Settings.  Then test it out for a day or two.  If it's still acting up then it's likely a hardware issue and you will need to get your battery replaced.  If your warranty is done than check out this link to get a battery kit to replace your iPhone battery yourself:  http://www.ifixit.com/Store/iPhone/iPhone-5-Replacement-Battery/IF118-001#produc tDescription
    If your iPhone is now working properly after hard resetting it than it's most likely a software issue.  This battery issue only started after upgrading to the new iOs7, so it is obviously related to the update not properly installing itself.  What has worked for me and many others is to manually update to iOS 7.0.4 using the full downloaded version of the update which is about 1.32 Gigs.
    But first you need to find out what model of iPhone you have, click here to determine if it's GSM or CDMA: http://support.apple.com/kb/HT3939?viewlocale=en_US&locale=en_US
    Then go here and scroll down to download the iOS 7.0.4 complete update for your device:  http://www.downloadios7.org/download-ios-7-0-4-ipsw-file.html
    Then scroll up on the download page and follow the instructions of updating your iPhone manually following the instructions below:  "IPSW with iTunes"
    And your done.
    Problem solved.
    I only posted this because it was a very frustrating problem that no one really seemed to figure out a solution for.
    I hope this helps.
    Emile Beaulieu

  • I am trying to connect a Macbook Pro to a projector for a Powerpoint presentation. When I use a VGA cable, the color of the projected images are not good. When I use a USB cable, the projected image includes the presenter notes on my computer screen?

    I am trying to connect a Macbook Pro to a projector for a Powerpoint presentation. When I use a VGA cable, the color of the projected images are not good. When I use a USB cable, the projected image includes the presenter notes on my computer screen?

    To move an iPhoto Library to a new machine:
    Link the two Macs together: there are several ways to do this: Wireless Network,Firewire Target Disk Mode, Ethernet, or even just copy the Library to an external HD and then on to the new machine...
    But however you do choose to link the two machines...
    Simply copy the iPhoto Library from the Pictures Folder on the old Machine to the Pictures Folder on the new Machine.
    Then hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Choose Library'
    and select the Library that you moved.  That's it.
    This moves photos, events, albums, books, keywords, slideshows and everything else.
    Your first option didn't work because you imported one Library to another. Every version and thumbnail is imported like a distinct photo, you lose all your Albums, Keywords etc., the link between Original and Previews is destroyed, the non-destructive editing feature is ruined and so on. In summary: it's mess.
    Your second option didn't work because you simply referenced her library on the old machine.
    Regards
    TD

  • "Are you sure you want to shut down your computer?" prompt pops up for no reason and continues to pop up after selecting Cancel. How can I stop this?

    "Are you sure you want to shut down your computer?" prompt pops up for no reason and continues to pop up after selecting Cancel. How can I stop this?
    Mac Pro. OS 10.6.8

    Then I suggest you read this thread regarding the 30" Apple Cinema Display and that particular message pop up... several possible causes... common denominator, the display.
    http://forums.macrumors.com/showthread.php?t=617367

  • Seriously, Nokia what are you playing at?

    I know there are aleady countless threads about the battery life but I really want a proper response from anyone on here who can speak for nokia?
    WHY are you washing your hands of "battery issues " after this latest update when there are clearly so many people still with issues.
    9 hours since last charge now on 52%. That's with email checking every now and then over 3g and some facebook and some whatsapp. Few minutes of listening to music too.
    It's clear the latest battery update just changed the calculations so it showed there was more time estimated left...... (reckons 18 hours left but I'm more concerned about how much has gone in the past 8 hours rather than how much it says is left)
    Diagnostics tells me the full charge capacity is 1354mAh.....:/
    I'd also LOVE to know how you can claim these figures
    9.5 h
    Maximum 3G talk time
    335 h
    Maximum 3G standby time
    55 h
    Maximum music playback time
    6.5 h
    Maximum video playback time
    I can't even get 55hours max 3g standby time let alone listening to music for that long.
    And I don't even want to hear "turn data and wifi and location off when you're not using it"
    I shouldn't have to

    I have to agree with the OP - in that I feel that the battery life on these Nokia's is very poor.  The fact that this is Nokia that we're talking about, the same Nokia that built it's kingdom on bullet proof dependability and huge battery life, maybe compiles the problem.
    I have a Samsung Galaxy S2 - 1650 mAh and this new Lumia 800 (1450mAh).  I charged both last night and then used the SGS2 as my main phone all day with the Lumia along for the ride just to compare.
    Both phones had WiFi turned on and the phone set to 2G.  I installed a couple of apps on the Nokia and had it checking emails every 30 mins. 
    The Nokia has just died after less than 18 hours - of basically being on standby all day only. No calls, no maps, no GPS, no screen use, just emails and twitter check twice.  Stone dead.
    My SGS2 is still showing 54% charge after much more demanding use.  Even taking into account the extra 200mAh of the android battery, that would still equal around 48% remaining.
    Although others may feel that this is acceptable, especially if they simply don't use the phone very often in a day, for people that actually need to depend on their Lumia for any level of productivity away from a power source, this is terrible.  Throw in the fact that it's a sealed unit....pretty ridiculous.  My old N8 lasts vastly longer than both these phones.
    Design 10/10
    OS 6/10
    Productivity - 2/10
    As a long time user of Nokia phones and more recently Android handsets, coming back to Nokia feels a little like they've taken 2 steps forward and 3 steps backwards with the Lumia.
    I would like to return this handset to Nokia and try something else...maybe the N9 has a better battery life?

Maybe you are looking for

  • Means of transport in sales order

    Hi all, i want to enter some data in field "means of transport" in sales order Header data in shipping tab, but i dont have any values maintained there, where do i maintain the data of means of transport so that i ll reflect in F4 values of my sales

  • Recursive merge sort, how does it work?

    hey friends I am stuck up with the code of recursive merge sort and am unable to understand as to how is the recursion working. Im posting the code for the merge sort and telling the details of where im facing the problem, if someone could explain me

  • Large music collection questions...

    Hello All, I am new to iTunes and I have a couple of questions I need answers to before I make a big mess. I am moving from all windows to all mac environment. My music collection (77,000 songs) exists on several external HDD and are configured for t

  • Song's I've deleted not disappearing from Itunes

    Hi. I've deleted a folder full of songs, however, they are still showing in itunes. tried restarting... any way to remove those without going one by one???

  • PSE13 slide show theme array

    Any suggestions on how to do the following in PSE13 - slide show theme Array      > How to modify the duration of each slide?      > How to 'customize' the presentation of each slide (eg weather it is a single shot per slide or multiple shots per sli