A simple applet

i am new to java.i wanted an example of an applet. the one below i chose it, but a message like this is generated when compilation:
"The target WelcomeApplet.java could not be started as a servlet ,because the class WelcomeApplet does not extend javax.servlet.GenericServlet
The target WelcomeApplet.java could not be started as an application because the class WelcomeApplet does not have a main method.
The target WelcomeApplet.java could not be started as an addin because the class WelcomeApplet does not implement oracle.ide.addin.Addin or oracle.ide.addin.Wizard"
this is the applet code:
import java.awt.Graphics;
import javax.swing.JApplet;
public class WelcomeApplet extends JApplet {
public void paint (Graphics g)
super.paint(g);
g.drawString("welcome to java programming",25,25);
}

http://java.sun.com/docs/books/tutorial/applet/index.html
Ignore all the applet tags and try to use objec tags.
http://java.sun.com/products/plugin/versions.html
Sun has some problems updating tutorials.

Similar Messages

  • Trying to add a simple applet to a web page

    Well, I was trying to add a simple applet to a web page(php nuke Home section), it didn't fin my applet, so I changed it and added it to a simple html file to make it as simple as I could get it.
    This is the code in the html file:
    <applet code="usblock.class" width="400" height="400">The browser doesn't support applets...</applet>The directory: www/usblock.html & www/usblock.java & www/usblock.class - As you can see the files are all in the same directory/folder.
    usblock.java code:
    import javax.swing.*;
    import java.awt.*;
    public class usblock extends JApplet
         public void init()
              JPanel p = new JPanel(new BorderLayout());
              p.add(new JLabel("Heisann"));
              add(p, BorderLayout.CENTER);
    }now as I open the html local on my computer, it workes. As soon as I open the usblock.html from my website, it doesn't.
    It gives me this error here:
    load: class usblock.class not found.
    java.lang.ClassNotFoundException: usblock.class
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 moreSo I thought it was that it couldn't find the .class file. Well, I went through the How To add applets that I found somewhere on sun.com. It had exactly the same as I had.
    Im figuring the problem is something easy and not hard to detect. But my eyes can't find it somehow. This is my second time trying applets, and I kinda forgot how I got it to work the first time.
    Im just glad for all the help I can get.
    Thanks a lot.
    LordSvae
    PS: Sry for the size of the post, but I'm not sure how much info I was supposed to put in here, so I thought the more the better, right? :S

    Hii,
    I doesn't know the solution but same kind of problem is come with me & I found that the problem is of Path i.e. you need to set a codebase attribute . For tempory solution what i do i simply copy the .class file in to html file dir.

  • Simple Applet does not run in IE 5.0

    Hi,
    Am trying to run a simple applet in IE 5.0 on MS Window NT Server machine. I disabled the
    JVM option in Tools/Internet Options/Advanced/Java column. I have MS VM(Miscrosoft Virtual Machine) JIT(Just In Time Compiler) enabled. As a
    result any applet will run on the MS VM JIT only. I use a simple applet in which I just add
    a button to the applet. My applet runs fine in JVM Ver 1.4 but when I try to run it in MS VM
    using JIT I get the following exception
    Error loading class: ImageTest1
    java.lang.NoClassDefFoundError
    java.lang.ClassNotFoundException: ImageTest1
         at com/ms/vm/loader/URLClassLoader.loadClass (URLClassLoader.java)
         at com/ms/vm/loader/URLClassLoader.loadClass (URLClassLoader.java)
         at com/ms/applet/AppletPanel.securedClassLoad (AppletPanel.java)
         at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
         at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
         at com/ms/applet/AppletPanel.run (AppletPanel.java)
         at java/lang/Thread.run (Thread.java)
    Can any one help me in solving the problem ? My applet source is
    import java.applet.*;
    import java.awt.*;
    public class ImageTest1 extends Applet
         public ImageTest1()
              System.out.println("On the Console !!!!");
         public void init()
              Button bt = new Button("Hello !!");
              this.setLayout(new FlowLayout());
              this.add(bt);     
    Thanks,
    Bala

    Take your HTML file and convert it with the HTMLConverter that comes with your JDK, this will create an <OBJECT> tag from the existing <APPLET> in the HTML file. With the newly created <OBJECT> tag, IE will know that it's supposed to run your applet with Java plugin (the only way for you to run an applet that uses swing.
    V.V.

  • Need help coding simple applet program

    Hello I'm attempting to learn applet programming in either swing or awt. Whichever is best for current applications. I want to begin by creating my first hello world application. I want to create a simple applet that has two buttons, press button number one and the text "hello world 1" comes up somewhere on the applet, press two and "hello world 2" comes up. can anyone help me with this simple applet? Thnx in advance

    http://java.sun.com/docs/books/tutorial/applet/

  • Simple Applet not running in ie 5

    Hi I have built a simple applet consisting of 4 classes, The button panel, and three listener classes. When I run this from the command line it works fine, and presents me with a grey panel (100 * 180) and the three buttons are drawn onto the applet all of which work fine. But when I use the plug in html page I get a grey panel with a red 'X' in the top left hand corner! Do I have to upload all of this before I can even test it, or is it just a dumb typo??
    Here is the HTML plug in:
    <html>
    <head>
    <title>Button Applet</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <applet CODE="Buttons.class" CODEBASE = "Sun">
    </applet>
    </body>
    </html>

    Change your html file to look like this:
    <applet CODE="Buttons.class" CODEBASE = ".">
    Put the html file in the same directory as the one with the Buttons.class and try it again.
    ;o)
    V.V.

  • Simple applet, curious yellow sign...

    This maybe a noob thing that I have run into. I have looked on some of the threads but can't find anything that relates to my specific problem. Below is a simple applet that displays a input message box user puts in name and it displays a greeting nothing fancy just something basic.
    I loaded the .class file on to the freewebs<dot> com server where my site is hosted at and did the applet tag and it runs. The only problem is it displays a yellow glow around the applet box and a yellow information warning. I did the reading on applets from the tutorial and didn't come across anything that mentioned anything like this, maybe I missed it. When I run the applet on the web it doesn't show any error messages or codes just that yellow information warning. How can I fix this.
    import javax.swing.JApplet;
    import javax.swing.JOptionPane;
    public class HelloFromBlahWebsite extends JApplet
              public void start()
                   String sName;
                   sName = JOptionPane.showInputDialog(null,
                   "What is your name?","Welcome to My Page",
                   JOptionPane.QUESTION_MESSAGE);
                   JOptionPane.showMessageDialog(null,
                   "Greetings From Me and welcome to my site,  " + sName + "!", "Greetings",
                   JOptionPane.INFORMATION_MESSAGE);
         }

    0xfeedadeadf15h wrote:
    How can I fix that?You don't. That's pretty much the idea ...
    Or a better question would be how do I get the applet signed so it doesn't show up?... unless of course you sign your applet. To do this you'll need to get a certificate, which costs quite some money.

  • Simple applet html editor

    Hi,
    I need a simple applet html editor.
    Does anyone has implemented one?
    The functions I need is bold, italic, insert table, insert image, and all basic functions of an editor
    I need some source, because I dont want to make it from scratch
    Thanks

    Using the search feature of this site, I found:
    http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A57&qt=html+editor
    ;o)
    V.V.

  • Help with simple applet - dragging box

    Hi I need help with a simple applet concept.
    I have a picture drawn in the background, but I need to draw a square and resize it when I drag.
    So with the picture in the background I click, drag the mouse, and it draws a rectangle from the starting point to where the mouse is while the mouse is clicked.
    The only problem is I can't figure out how to do this without redrawing the whole picture. If I don't repaint, it just keeps stretching around rectangles and leaving them there.
    I don't really need exact code, just an idea on how to do this without repainting the background every time the mouse is moved (because the picture in the background is complicated to draw and takes like a second).
    Thanks
    [nvm, found out about xormode]
    Edited by: BugMenOTdhzj on Nov 30, 2009 4:47 PM

    BugMenOTdhzj wrote:
    ..the picture in the background is complicated to draw and takes like a second).Paint the 'picture in the background' to a BufferedImage, then when it comes to paint()/paintComponent(), draw the BI to the Graphics object (clipped, if necessary (1)), then draw the rectangle to the Graphics object. This would be further optimised at time of rendering, by drawing both the 'picture in the background' BI and rectangle to a second BI, and finally writing that 2nd BI to the Graphics object.
    1) There are potentially other improvements that can be made, particularly with clipping, but I suspect if you try as I suggested, the rendering will be very quick and responsive. I have 40 FPS sound trace animations that do a great deal more on each call to paintComponent(), before bursting the final BI to screen.

  • What if simple Applet prg compiles successfully but do not loaded

    Dear Sir,
    I am new to applet programming. I have witten a very simple applet program with init, start and paint method. My prog complied successfully but when I run the prog using appletviewer cmd, the Applet window does not loaded(does not appear). Please guid me throgh the solution.
    Thanks & Regards
    pankh

    Take a look at this applet tutorial.
    [http://java.sun.com/docs/books/tutorial/deployment/applet/index.html]

  • New to Java. Want to write a simple applet for a mobile phone.

    Hello,
    I want to write a simple java applet for a mobile phone. currently I am in the stage of thinking about whether this is possible in a timeframe of about a month. I have very little java experience from a while back so I'm pretty much starting from scratch.
    All I want is an applet that lets you send 2 or 3 variables to an online server. The server will then reposition telescopes.
    All i'm concerned with is the mobile phone part, which doesn't have to be secure or impressive. Just a simple interface.
    Ideally it should work on my nokia 6070, which occording to the official specs has the following java technology:
    MIDP 2.0
    CLDC 1.1
    JSR 120 Wireless Messaging API
    JSR 135 Mobile Media API
    Nokia UI API
    (I don't know what any of this means but am a good learner).
    Can anyone offer me any advice? Is this possible in my timeframe? where should I start? I need a editor and compiler also (I'm using windows XP).
    Many thanks and kind regards,
    Jason

    Actually it is working on my phone now.
    I changed the target platform in the wireless toolkit settings to MIDP 1.0
    Now to create the fields coordinate fields etc. I don't have much of a clue really.
    Current I have:
    import java.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class AtmosMIDlet extends MIDlet implements CommandListener
    Form WelcomeForm = new Form("AtmosMIDlet");
    StringItem WelcomeMes = new StringItem(null, "Please enter coordinates:");
    TextField Longitude = new TextField("Longitude", "", 3, TextField.NUMERIC);
    TextField Lattitude = new TextField("Lattitude", "", 3, TextField.NUMERIC);
    public AtmosMIDlet()
    try
    ImageItem logo = new ImageItem(Image.createImage("/logo.png"));
    WelcomeForm.append(logo);
    catch (java.io.IOException x)
    throw new RuntimeException ("Image not found");
    WelcomeForm.append(WelcomeMes);
    WelcomeForm.append(Longitude);
    WelcomeForm.append(Lattitude);
    WelcomeForm.addCommand(new Command("Exit", Command.EXIT, 0));
    WelcomeForm.setCommandListener(this);
    public void startApp()
    Display.getDisplay(this).setCurrent(WelcomeForm);
    public void pauseApp() {}
    public void destroyApp(boolean unconditional) {}
    public void commandAction(Command c, Displayable s)
    notifyDestroyed();
    I'm trying to get the image logo.png to display at the top but I get the error:
    C:\WTK25\apps\AtmosSpec\src\AtmosMIDlet.java:19: cannot find symbol
    symbol : constructor ImageItem(javax.microedition.lcdui.Image)
    location: class javax.microedition.lcdui.ImageItem
    ImageItem logo = new ImageItem(Image.createImage("/logo.png"));
    ^
    1 error
    com.sun.kvem.ktools.ExecutionException
    Build failed
    When I try to build.. Any help would be great.
    Ideally the image would be on a seperate screen for a couple of seconds.

  • Simple Applet Question

    Hi. I have made a simple program which asks for the users name, and then using PrintWriter writes whatever the user enters, onto a text file and so on. However, I want to use this program on my webpage, currently I am using a very simple javascript 'prompt' but i do not know how to save it to a file in javascript. So I took my code and made it into an applet (extends applet, etc...) but when i load it in a web page it says loading applet and then goes away. SO, i was wondering if somebody could please help me to make my java applet have a space where the user can enter in their name and press "ok" or whatever it may be. As always here is my code that I used...
    Please either help me to do this on my webpage with Javascript or a java applet, thanks alot ;)
    MY CODE:
    import java.io.*;
    import javax.swing.*;
    public class userNames
    public static void main(String args[])
    PrintWriter myStream = null;
    try
    myStream = new PrintWriter(new FileOutputStream("names.txt" , true));
    catch(FileNotFoundException e)
    System.out.println("Sorry, no such file");
    String askName = JOptionPane.showInputDialog("Hello, what is your name?");
    String a = "";
    String b = null;
    int count = 0;
    while(askName!=a && askName!=b)
    count++;
    myStream.println(count + ". " + askName);
    myStream.close();
    JOptionPane.showMessageDialog(null, "Thank you "+ askName+"!");
    System.exit(0);

    An applet will try to write to the local file system, ie the user who loads the page.
    That, and applets are subject to many security restrictions, File I/O being one of them. I'd suggest you give up trying this with Applet.
    HTH,
    Radish21

  • Help....Simple Applets Not Working..

    I have been trying to get this simple HelloWorld applet to execute with no luck. I have confirmed that my Java Plug-In is setup with the IE Browser and JRE C:\Java\j2sdk1.4.1_1. I also enabled the Java console and JIT compiler for virtual machine enabled in the IE Browser.
    When I select the HTML template, I get an "Loading Java Applet Failed" error message. When I type java HelloWorld, "Exception in thread "main" java.lang.NoSuchMethodError: main" error even if change "paint" to "main". When I type appletviewer HelloWorld.class, nothing happens.
    I have been going through some of the tutorials and getting the same results. The tutorials have suggested that I install the Java Plug-In, which I have.
    Can someone tell me what I am doing wrong? Thanks....
    I have the following setup:
    HelloWorld.bat
    SET PATH=.;C:\Java\j2sdk1.4.1_01\bin;
    SET CLASSPATH=.;C:\Java\j2sdk1.4.1_01\bin;C:\Program Files\ora91\jdbc\lib\classes12.zip
    javac HelloWorld.java
    HelloWorld.java
    import java.applet.Applet;
    import java.awt.Graphics;
    public class HelloWorld extends Applet {
         public void paint (java.awt.Graphics g) {
              g.drawString("Hello, world!", 100, 25);
    HelloWorld.html
    <html>
         <body>
              <applet code="HelloWrold.class" height=50 width=400></applet>
         </body>
    </html

    This problem has been correct...Please ignore...
    Thanks,
    cbs

  • Simple applet compiling error

    Hi!
    I feel very embarrassed to ask this question:
    This is an applet that returns 1 error after compiling:
    /* an applet which uses Times Roman italic and bold font, 28 point size, drawn green on a yellow background*/
    import java.awt.Graphics;
    import java.awt.Font;
    import java.awt.Color;
    public class Lesson7Applet extends java.applet.Applet
         Font f = new Font("TimesRoman", Font.BOLD, Font.ITALIC, 28);
         public void paint (Graphics g)
              g.setFont (f);
              g.setColor(Color.green);
              setBackground(Color.yellow);
              g.drawString("Lesson 7 was easy", 10, 30);
    Error message after compiling:
    C:\java>javac Lesson7Applet.java
    Lesson7Applet.java:7: cannot resolve symbol
    symbol : constructor Font (java.lang.String,int,int,int)
    location: class java.awt.Font
    Font f = new Font("TimesRoman", Font.BOLD, Font.ITALIC, 28);
    1 error (pointing at "new")
    Could anyone help!
    Much obliged
    emni

    Hi emni!
    It's simple:
    Font f = new Font(
    "TimesRoman", // font name
    Font.BOLD & Font.ITALIC, // font style
    28); // font size
    Best regards.

  • Simple Applet

    Hi
    I'm new in mobile development. I'm trying to write a simple java applet that will run on Microsoft Pocket PC version 4.20.0 preferably run on CE as well, basically it must be platform independent. I have Eclipse 3.0 running jdk 1.5. Can someone help?

    Reformatting the code so its readable:
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Color;
    import java.awt.Rectangle;
    import java.applet.Applet;
    public class Assign1 extends Applet {
      String name;
      String address;
      String kamal;
      public void paint(Graphics g) {
        writeName("nag","mingst");
        g.drawString("it is"+ getName());
        writeShedule();
        g.drawString("it is" + getSchedule());
      public String getName() {
        return name;
        return address;
        return kamal;
      public String writeName(String name ,String address,Graphics g) {
        this.name = name;
        this.address = address;
        kamal =g.drawString( " Dr Mustafa Kamal 92 Council Trail Warrensburg MO 64093 Phone; 660 543 4243");
      public String getSchedule() {
        return sched;
      public void writeSchedule(Graphics g) {
        sched = g.drawString("CIS2615 CIS5606");
    } I assume the question is, why won't this compile? The answer is because the getName() method has to unreachable statements -- you can't return three things from one method. If that's what you want to do, you need to create an abstract data type that encapsulates three strings, and return that, OR return an array of Strings.
    - Adam

  • I am trying a simple applet... Does it work for you?

    Ok two problems... My friends (even w/ java installed) cannot see my applet online:
    http://www.geocities.com/vmc20002/Calendar.html
    Secondly my code isn't working right... There are radio buttons for the months and buttons for the days, when you click a month the days are created. But if you click on a different month the buttons are created on top of eachother... I cannot remove() or removeAll() the buttons from the previous button or think of another way around this! Heres the code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JOptionPane;
    public class Calendar extends JApplet implements ItemListener, ActionListener
    private int intBold = Font.PLAIN;
    private int intItalic = Font.PLAIN;
    private Color currentColor = Color.black;
    private JRadioButton January, February, March, April, May, June, July, August,
    September, October, November, December;
    private ButtonGroup Months;
    private JButton[][] button = new JButton[13][31];
    private int x, y;
    private String[] days = {"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"};
         private String[] back = {"Information"};
    public void init()
    Container c = getContentPane();
    c.setLayout(null);
    January = new JRadioButton("January");
    February = new JRadioButton("February");
    March = new JRadioButton("March");
    April = new JRadioButton("April");
    May = new JRadioButton("May");
    June = new JRadioButton("June");
    July = new JRadioButton("July");
    August = new JRadioButton("August");
    September = new JRadioButton("September");
    October = new JRadioButton("October");
    November = new JRadioButton("November");
    December = new JRadioButton("December");
    January.setLocation(5, 5);
    February.setLocation(5, 50);
    March.setLocation(105, 5);
    April.setLocation(105, 50);
    May.setLocation(205, 5);
    June.setLocation(205, 50);
    July.setLocation(305, 5);
    August.setLocation(305, 50);
    September.setLocation(405, 5);
    October.setLocation(405, 50);
    November.setLocation(505, 5);
    December.setLocation(505, 50);
    January.setSize(100,30);
    February.setSize(100,30);
    March.setSize(100,30);
    April.setSize(100,30);
    May.setSize(100,30);
    June.setSize(100,30);
    July.setSize(100,30);
    August.setSize(100,30);
    September.setSize(100,30);
    October.setSize(100,30);
    November.setSize(100,30);
    December.setSize(100,30);
    January.addItemListener(this);
    February.addItemListener(this);
    March.addItemListener(this);
    April.addItemListener(this);
    May.addItemListener(this);
    June.addItemListener(this);
    July.addItemListener(this);
    August.addItemListener(this);
    September.addItemListener(this);
    October.addItemListener(this);
    November.addItemListener(this);
    December.addItemListener(this);
    c.add(January);
    c.add(March);
    c.add(May);
    c.add(July);
    c.add(September);
    c.add(November);
    c.add(February);
    c.add(April);
    c.add(June);
    c.add(August);
    c.add(October);
    c.add(December);
    c.setBackground(Color.green);
    Months = new ButtonGroup();
    Months.add(January);
    Months.add(February);
    Months.add(March);
    Months.add(April);
    Months.add(May);
    Months.add(June);
    Months.add(July);
    Months.add(August);
    Months.add(September);
    Months.add(October);
    Months.add(November);
    Months.add(December);
    public void itemStateChanged(ItemEvent e)
    Container d = getContentPane();
              //*************MONTHS***************************//
              //*************START***************************//               
    //*************JANUARY***************************//
         if(e.getSource() == January)
              int x = 325;
              int y = 200;
              for(int i = 0; i < 32; i++)
                   button[1] = new JButton(days[i]);
                   button[1][i].addActionListener(this);
                   button[1][i].setSize(50, 30);
                   button[1][i].setLocation(x, y);
                   a.add(button[1][i]);
                        x = x + 75;
                        if(x == 550)
                             x = 25;
                             y = y + 30;
                             }//end if
                        repaint();
                   }//end for
              }//end if
    //*************FEBRUARY***************************//
    if(e.getSource() == February)
                   int y = 200;
                   int x = 25;
                   for(int i = 0; i < 30; i++)
                        d.remove(button[1][i]);
                        button[2][i] = new JButton(days[i]);
                        button[2][i].addActionListener(this);
                        button[2][i].setSize(50, 30);
                        button[2][i].setLocation(x, y);
                        b.add(button[2][i]);
                        x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
    //*************MARCH***************************//
    if(e.getSource() == March)
    int x = 100;
                        int y = 200;
    for(int i = 0; i < 32; i++)
    button[3][i] = new JButton(days[i]);
    button[3][i].addActionListener(this);
    button[3][i].setSize(50, 30);
    button[3][i].setLocation(x, y);
    d.add(button[3][i]);
    x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
    //*************APRIL***************************//
    if(e.getSource() == April)
    int x = 325;
                        int y = 200;
    for(int i = 0; i < 31; i++)
    button[4][i] = new JButton(days[i]);
    button[4][i].addActionListener(this);
    button[4][i].setSize(50, 30);
    button[4][i].setLocation(x, y);
    d.add(button[4][i]);
    x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
    //*************MAY***************************//
    if(e.getSource() == May)
    int x = 475;
                        int y = 200;
    for(int i = 0; i < 32; i++)
    button[5][i] = new JButton(days[i]);
    button[5][i].addActionListener(this);
    button[5][i].setSize(50, 30);
    button[5][i].setLocation(x, y);
    d.add(button[5][i]);
    x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
    //*************JUNE***************************//
    if(e.getSource() == June)
    int x = 175;
                        int y = 200;
    for(int i = 0; i < 31; i++)
    button[6][i] = new JButton(days[i]);
    button[6][i].addActionListener(this);
    button[6][i].setSize(50, 30);
    button[6][i].setLocation(x, y);
    d.add(button[6][i]);
    x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
    //*************JULY***************************//
    if(e.getSource() == July)
    int x = 325;
                        int y = 200;
    for(int i = 0; i < 32; i++)
    button[7][i] = new JButton(days[i]);
    button[7][i].addActionListener(this);
    button[7][i].setSize(50, 30);
    button[7][i].setLocation(x, y);
    d.add(button[7][i]);
    x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
    //*************AUGUST***************************//
    if(e.getSource() == August)
    int x = 25;
                        int y = 200;
    for(int i = 0; i < 32; i++)
    button[8][i] = new JButton(days[i]);
    button[8][i].addActionListener(this);
    button[8][i].setSize(50, 30);
    button[8][i].setLocation(x, y);
    d.add(button[8][i]);
    x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
    //*************SEPTEMBER***************************//
    if(e.getSource() == September)
    int x = 250;
                        int y = 200;
    for(int i = 0; i < 31; i++)
    button[9][i] = new JButton(days[i]);
    button[9][i].addActionListener(this);
    button[9][i].setSize(50, 30);
    button[9][i].setLocation(x, y);
    d.add(button[9][i]);
    x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
    //*************OCTOBER***************************//
    if(e.getSource() == October)
    int x = 400;
                        int y = 200;
    for(int i = 0; i < 32; i++)
    button[10][i] = new JButton(days[i]);
    button[10][i].addActionListener(this);
    button[10][i].setSize(50, 30);
    button[10][i].setLocation(x, y);
    d.add(button[10][i]);
    x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
    //*************NOVEMBER***************************//
    if(e.getSource() == November)
    int x = 100;
                        int y = 200;
    for(int i = 0; i < 31; i++)
    button[11][i] = new JButton(days[i]);
    button[11][i].addActionListener(this);
    button[11][i].setSize(50, 30);
    button[11][i].setLocation(x, y);
    d.add(button[11][i]);
    x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
    //*************DECEMBER***************************//
    if(e.getSource() == December)
    int x = 250;
                        int y = 200;
    for(int i = 0; i < 32; i++)
    button[12][i] = new JButton(days[i]);
    button[12][i].addActionListener(this);
    button[12][i].setSize(50, 30);
    button[12][i].setLocation(x, y);
    d.add(button[12][i]);
    x = x + 75;
    if(x == 550)
    x = 25;
    y = y + 30;
    }//end if
    repaint();
    }//end for
    }//end if
                   button[0][0] = new JButton(back[0]);
                   button[0][0].addActionListener(this);
                   button[0][0].setLocation(250,400);
                   button[0][0].setSize(100,30);
                   d.add(button[0][0]);
    }//end
    public void paint(Graphics g)
    super.paint(g);
    g.setColor(Color.blue);
    g.drawRoundRect(0,0,625,500,10,10);
    g.setColor(Color.red);
    g.setFont(new Font("Courier", intBold + intItalic, 24));
    g.drawString("Calendar",250,150);
    g.setFont(new Font("Courier", intBold + intItalic, 12));
    g.drawString("Sunday", 25,175);
    g.drawString("Monday", 100,175);
    g.drawString("Tuesday", 175,175);
    g.drawString("Wednesday", 250,175);
    g.drawString("Thursday", 325,175);
    g.drawString("Friday", 400,175);
    g.drawString("Saturday", 475,175);
    public void actionPerformed(ActionEvent e)
    if(e.getSource() == button[1][1])
    JOptionPane.showMessageDialog(null, "Hey", "Info", JOptionPane.INFORMATION_MESSAGE);     

    sorry... its for a friend basically, hes gonna put important dates that i will put on the calendar... yea it be nice if i could make it so he can easily program dates into the calendar but I am not that good yet.... it's going through revisions still!

  • Need some urgent help with my (simple) Applet!

    Hello, I'm pretty new to Java and I am beginning to like it!
    I'm still verry much new to the language, but if you can help me you make me verry happy!
    Oke so I made an Applet where if you push on the button Omhoog, Omlaag, Links, Rechts, and Reset the ball (created with g.Oval in the methode paint) the ball should move above, down, left, right, and with reset it should go to the specified beginningpoint. The thing which I can't get to work is that when you push for instance on rechts(right) I want it to change in color for each specific movement (i.e left right...) and turn to black again when pushing on the reset button. I have been meshing around with if and else but I don't seem to know how to set this proparly. (I hope you can help me out!)
    this is my sourcecode:
    package oefening80;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class Applet1 extends Applet {
    int xPos = 130, yPos = 130;
    Button Omhoog, Omlaag, Links, Rechts, Reset;
    boolean geklikt, gekliktL;
    public void init() {
    setBackground( Color.yellow );
    setLayout( null );
    geklikt = false;
    Omhoog = new Button( "Omhoog" );
    Omhoog.addActionListener( new OmhoogHandler() );
    Omhoog.setBounds( 120, 20, 50, 20 );
    gekliktL = false;
    Omlaag = new Button( "Omlaag" );
    Omlaag.addActionListener( new OmlaagHandler() );
    Omlaag.setBounds( 120, 60, 50, 20 );
    Reset = new Button( "Reset" );
    Reset.addActionListener( new ResetHandler() );
    Reset.setBounds( 120, 40, 50, 20);
    Links = new Button( "Links" );
    Links.addActionListener( new LinksHandler() );
    Links.setBounds(70, 40, 50, 20 );
    Rechts = new Button( "Rechts" );
    Rechts.addActionListener( new RechtsHandler() );
    Rechts.setBounds( 170, 40, 50, 20 );
    add( Omhoog );
    add( Omlaag );
    add( Reset );
    add( Links );
    add( Rechts );
    public void paint( Graphics g ) {
    g.fillOval( xPos, yPos, 30, 30 );
    class OmhoogHandler implements ActionListener {
    public void actionPerformed( ActionEvent e ) {
    yPos -= 10;
    repaint();
    class OmlaagHandler implements ActionListener {
    public void actionPerformed( ActionEvent e ) {
    gekliktL = true;
    yPos += 10;
    repaint();
    class ResetHandler implements ActionListener {
    public void actionPerformed( ActionEvent e ) {
    xPos = 130;
    yPos = 130;
    repaint();
    class LinksHandler implements ActionListener {
    public void actionPerformed( ActionEvent e ) {
    xPos -= 10;
    repaint();
    class RechtsHandler implements ActionListener {
    public void actionPerformed( ActionEvent e ) {
    xPos += 10;
    repaint();
    thanks.

    Gotten tag.
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class Applet1 extends Applet
         int     xPos = 130, yPos = 130;
         Button  Omhoog, Omlaag, Links, Rechts, Reset;
         boolean geklikt, gekliktL;
    public void init()
         setBackground( Color.yellow );
         setLayout( null );
         ActionListener actl = new OHandler();
         geklikt = false;
         Omhoog = new Button("Omhoog");
         Omhoog.addActionListener(actl);
         Omhoog.setBounds(115, 20, 60, 20 );
         gekliktL = false;
         Omlaag = new Button("Omlaag");
         Omlaag.addActionListener(actl);
         Omlaag.setBounds(115, 60, 60, 20 );
         Reset = new Button("Reset");
         Reset.addActionListener(actl);
         Reset.setBounds(120, 40, 50, 20);
         Links = new Button("Links");
         Links.addActionListener(actl);
         Links.setBounds(70, 40, 50, 20 );
         Rechts = new Button("Rechts");
         Rechts.addActionListener(actl);     
         Rechts.setBounds(170, 40, 50, 20 );
         add(Omhoog);
         add(Omlaag);
         add(Reset);
         add(Links);
         add(Rechts);
    public void paint(Graphics g)
         super.paint(g);
         g.fillOval(xPos, yPos, 30, 30 );
    class OHandler implements ActionListener
    public void actionPerformed(ActionEvent e)
         Object obj = e.getSource();
         if (obj.equals(Omhoog)) yPos -= 10;
         if (obj.equals(Omlaag)) yPos += 10;
         if (obj.equals(Rechts)) xPos += 10;
         if (obj.equals(Links))  xPos -= 10;
         if (obj.equals(Reset)) 
              xPos = 130;
              yPos = 130;
         repaint();
    [/code
    Noah                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • Payment engine, bank charge and outgoing payment

    Hi expert ! My customer wants to generate foreign outgoing payment, with Payment Wizard. We're french, so I created payment mode, and I choosed File format : SAPBPFROPBT_AFB_FO In case of outgoing payment file protocol, we must specify who paid Bank

  • Can One technical system be assigned to multiple BS system

    Hi All, I just need small confirmation, i want to know wether one technical system(ABAP) with same client be assigned to multiple busines system.. Regards, Raj

  • ASA5500 V8.2 integration with IAS adn etoken pass

    Hi, I am needing help or direction to a document whcih can assist me solving the below issue: 1). Authentication to IAS with OTP. 2). AV Pairs for Cisco ASA. In brief I have Radius via IAS, authentication working with the standard username and passwo

  • Demantra upgrade log file

    Hi, expert In Demantra implementation guide, it said when you add a new level, it will be logged in upgrade log file, please refer below copied from implementation guide, When a new level is created, the upgrade process: • Creates default methods for

  • Rounded toolbar Search box in WebHelp?

    The powers that be want a help facelift... One request is a search box with round ends. Preferably with the Search button inside the box, much like what Apple does in Safari etc. Any hints on what file(s) to edit and how? A ready made piece of code w