Page Functionality(Prev and Next) using applet

Hi,
I am trying to implement an applet which has the paging functionality(previous and next). How do I handle the mouse event for that.
Appreciate your help.
Thanks
Sankar.

ok. Sorry about that, Here is my applet implementation,
public class PageApplet extends JApplet implements ActionListener,MouseListener
     JTextField name,age;
     JRadioButton male, female;
     static String maleStr = "Male";
     static String femaleStr = "Female";
private boolean inAnApplet = true;
JComboBox status;
     JPanel pane;
     GridBagConstraints c;
     private static int count =0;
     private String nameStr;
     public PageApplet() {
     this(true);
public PageApplet(boolean inAnApplet) {
this.inAnApplet = inAnApplet;
if (inAnApplet) {
getRootPane().putClientProperty("defeatSystemEventQueueCheck",
Boolean.TRUE);
     * The entry point for the applet.
     public void init()
          setContentPane(makeContentPane());
     public Container makeContentPane() {
          //Add Components to a JPanel, using the default FlowLayout.
     pane = new JPanel(new GridBagLayout());
c = new GridBagConstraints();
          c.fill = GridBagConstraints.HORIZONTAL;
JLabel namel = new JLabel("Name : ",JLabel.LEFT);
          c.weightx = 0.6;
          c.gridx = 0;
          c.gridy = 0;
pane.add(namel,c);
          name = new JTextField(20);
          name.setColumns(20);
          c.gridx = 5;
          c.gridy = 0;     
          name.addActionListener(this);
          pane.add(name,c);
JLabel agel = new JLabel(" Age : ", JLabel.LEFT);
          c.gridx = 0;
          c.gridy = 1;
pane.add(agel,c);
          age = new JTextField(2);
          age.setColumns(2);
          age.addActionListener(this);
          c.gridx = 5;
          c.gridy = 1;
pane.add(age,c);
          JLabel gender = new JLabel(" Gender :", JLabel.LEFT);
          c.gridx = 0;
          c.gridy = 2;
pane.add(gender,c);
          male = new JRadioButton(maleStr);
     male.setMnemonic(KeyEvent.VK_C);
     male.setActionCommand(maleStr);
          male.setSelected(true);
          male.setBackground(Color.WHITE);
          male.addActionListener(this);
          c.gridx = 5;
          c.gridy = 2;     
pane.add(male,c);
female = new JRadioButton(femaleStr);
female.setMnemonic(KeyEvent.VK_D);
     female.setActionCommand(femaleStr);
     female.setBackground(Color.WHITE);
          female.addActionListener(this);
          c.gridx = 10;
          c.gridy = 2;
          pane.add(female,c);
          JLabel statusl = new JLabel(" Status :", JLabel.LEFT);
     c.gridx = 0;
          c.gridy = 3;
pane.add(statusl,c);
          String[] statusStr = {"Single","Married","Divorced"};
          status = new JComboBox(statusStr);
          status.setSelectedIndex(0);
          status.setEditable(false);
          status.setBackground(Color.WHITE);
          status.addActionListener(this);
          c.gridx = 5;
          c.gridy = 3;
pane.add(status,c);
JButton next = new JButton("Next");
          c.ipady = 0;
          c.weightx=0.0;
          c.weighty=1.0;
          c.anchor = GridBagConstraints.SOUTH;
          c.insets = new Insets(10,0,0,0);
          c.gridwidth = 1;     
          c.gridx = 5;
          c.gridy = 4;
          next.addMouseListener(this);
          pane.add(next,c);
     //pane.setBackground(new Color(255,255,204));
     pane.setBackground(Color.WHITE);
          //pane.setLayout(new GridBagLayout(2,2));
     pane.setBorder(BorderFactory.createMatteBorder(1,1,2,2,Color.black));
return pane;
     public Container makeContentPane1() {
          //pane = new JPanel(new GridBagLayout());
          pane.removeAll();
c = new GridBagConstraints();
          JLabel label1 = new JLabel("Hello ",JLabel.RIGHT);
          c.gridx = 0;
          c.gridy = 0;
pane.add(label1,c);
          JTextField text1 = new JTextField(20);
          text1.setText(nameStr);
          text1.setColumns(20);
          text1.setEditable(false);
          c.gridx = 5;
          c.gridy = 0;
pane.add(label1,c);
          JButton finish = new JButton("Finish");
          finish.addMouseListener(this);
          c.anchor = GridBagConstraints.CENTER;
          c.insets = new Insets(10,0,0,0);
          c.gridwidth = 1;     
          c.gridx = 5;
          c.gridy = 2;
          pane.add(finish,c);
          //Add Components to a JPanel, using the default FlowLayout.
     // JPanel pane = new JPanel();
          // pane.add(label1);
          // pane.add(text1);
          // pane.add(finish);
     //pane.setBackground(new Color(255,255,204));
     pane.setBackground(Color.WHITE);     
     pane.setBorder(BorderFactory.createMatteBorder(1,1,2,2,Color.black));
return pane;
     public void actionPerformed(ActionEvent e)
               if (e.getActionCommand().equals(maleStr)) {
               male.setSelected(true);
     female.setSelected(false);
          } else if(e.getActionCommand().equals(femaleStr)){
          male.setSelected(false);
     female.setSelected(true);
               nameStr = name.getText();
               JComboBox cb = (JComboBox)e.getSource();
               String statusStr = (String)cb.getSelectedItem();
               if(statusStr.equals("Single"))
               status.setSelectedIndex(0);
               else if(statusStr.equals("Married"))
               status.setSelectedIndex(1);
               else if(statusStr.equals("Divorced"))
               status.setSelectedIndex(2);
          public void mousePressed(MouseEvent me){
          public void mouseClicked(MouseEvent me){
               JButton next = (JButton)me.getSource();
               String str = next.getName();
               if(((me.getClickCount()==1)) || (str.equals(next))){
               setContentPane(makeContentPane1());
               count=1;
               }else{
               URL url;
               try {
               String nextPage="http://"+this.getCodeBase().getHost()+":"+this.getCodeBase().getPort()+"/ShowPage.jsp";
                    url=new URL(nextPage);
                    getAppletContext().showDocument(url);
               }catch(MalformedURLException ex) {
                         ex.printStackTrace();
          public void mouseReleased(MouseEvent me){
          public void mouseEntered(MouseEvent me){
          public void mouseExited(MouseEvent me){
          private static void createAndShowGUI(){
          JFrame frame = new JFrame("Application version: AppletDemo");
          frame.addWindowListener(new WindowAdapter() {
     public void windowClosing(WindowEvent e) {
          System.exit(0);
     PageApplet applet = new TestPartner(false);
     if(count==1)
               frame.setContentPane(applet.makeContentPane1());
     else
          frame.setContentPane(applet.makeContentPane());
     frame.pack();
     frame.setVisible(true);
          public static void main(String[] args) {
               javax.swing.SwingUtilities.invokeLater(new Runnable() {
     public void run() {
          createAndShowGUI();
Here is what I am trying to do, when the user hits the next button it should go to the next page. but when I hit the next page, its hanging in the same page. Since I am new to applet coding, I couldn't proceed.
Thanks
Sankar.

Similar Messages

  • I'm trying to add prev and next button to a gallery

    I've found a free flash gallery which looks good for my need here: http://www.flashgallery.org/
    The only problem is that the gallery doesn't have prev and next buttons for the full size images, so I'm trying to add them.
    I've been able to add those buttons, but they only work if I don't click on a thumb, as I click on a thumb they stop working.
    In the code there is a function called loadGImage which loads the full size images, originally that function accepted 2 parameters, I've added a 3rd one which store the current image's index inside an array, so that I can use my buttons to call that function with index+1 for next and index-1 for prev.
    In addition to this I've added a variable which is updated everytime a full image is shown, that variable contains the image's index.
    Clicking on thumb the buttons stop working because the current image's index turns to "undefined" so they can't pass a correct value to loadGImage.
    I've checked the code of the gallery, but I can't find where is said to the thumbs to call loadGImage, if I'd found that code I could add the index parameter and my buttons would work.
    I'm sure that the thumbs call loadGImage because I've put a trace() inside the function to see when it is activated.
    Here you can find the source file of the gallery (plus some images to see how the gallery works)
    http://www.fileden.com/files/2008/4/9/1858524/FlashGallery2.rar
    The code commented using /*   */ is the code written by me.
    Can you help me to find where the thumbs make the call to loadGImage?

    The informations about the images are read from an XML file.
    These variables will contain the informations
    _root.description = new Array();
    _root.small_image = new Array();
    _root.big_image = new Array();
    _root.total_images = 0;
    This code creates the thumbs
    function createSmall()
        _root.smallContainer.createEmptyMovieClip("smallImageContainer", 10);
        var _loc4 = 0;
        var _loc3 = 0;
        for (var _loc2 = 0; _loc2 < _root.small_image.length; ++_loc2)
            _root.smallContainer.imageContainer.attachMovie("smallImage", "smallImage_" + _loc2, 100 + _loc2);
            m = _root.smallContainer.imageContainer["smallImage_" + _loc2];
            m._x = _loc3 * 50;
            m._y = 0;
            m.imageContainer.loadMovie(_root.small_image[_loc2], 100);
            m.iData = Array();
            m.iData.big = _root.big_image[_loc2];
            m.iData.title = _root.description[_loc2];
            ++_loc3;
        } // end of for
        _root.smallImageContainer._x = 5;
        _root.smallImageContainer._y = 0;
    } // End of the function
    And this is how full size images are loaded
    function loadGImage(title, bigImgURL)
        _root.bigImage.imageContainer.loadMovie(bigImgURL, 100);
        _root.bigImage.imageContainer._x = 0;
        _root.bigImage.imageContainer._y = 0;
        _root.title.text = title;
        //trace(bigImgURL);
    } // End of the function
    I've checked around the fla file, but I haven't found any code associated to the thumbs which says to call loadGImage, that's my problem, because the code itself is not hard to understand.

  • How to customize the prev and next buttons separately in slideshows?

    Is there a way to customize the prev and next buttons separately in slideshows in muse? When I import a background image that looks like a right arrow it puts the image for both prev and next buttons. I import it by selecting the next button, and then clicking on the folder icon labelled "Image" in the Fill drop-down menu in the Tool bar at the top of the Muse page.

    Yes, it should be very easy. Here is how I do this:
    First, I move the arrows onto the image, and double click the box so that I can remove the arrow character.
    Then, I go up to the "Image Fill" and click the file icon to fill with an image
    Then, I select the other arrow, and do the same
    Hope this helps!
    Julia

  • Navigation back and forth between anchor points with "prev" and "next" buttons?

    Hi all,
    I am working on a horizontal layout site that has anchor points on each part. As the user scrolls, it snaps to each anchor point. It works fine with just the mouse wheel, but I'd like to have previous and next buttons that allow for easy navigation between the points. I know on each section I can have the buttons to jump from say A>B>C and then C>B>A, but this is a single "prev" and "next" set of buttons that are pinned to the page. So, as the page scrolls left to right, the buttons stay put. Is there a way to just have them go to the previous and next point in the line, rather than linking a button to anchor point A/B/C, etc?

    I'm not sure I'm making my question very clear. Your response doesn't address what I'm asking, unfortunately. I know how to make buttons that are linked to individual anchor points. But I'm trying to make buttons to link to the next anchor point, or a specific spot on the page. Think of how you would navigate on a horizontal page, that's what I'm looking to duplicate.

  • Printing Header and Footer once in HTML and on all pages in RTF and PDF using one RDF

    Hi,
    I am using a single RDF to generate reports in HTML,PDF and RTF.
    For printing the header only on the first page I used the
    following trigger
    begin
    srw.get_page_num (page_num);
    IF upper(:P_FORMAT) = 'HTML' THEN
    if page_num = 1 then
    return(true);
    else
    return (FALSE);
    end if;
    ELSE
    return (TRUE);
    END IF;
    end;
    I alo require to print the footer once on the last page in case
    of HTML and on all pages for RTF and PDF.Is there any way I can
    get the total number of pages or is there any other way to
    acheive this. ???
    Any help would be appreaciated .
    Thanks,
    Alka

    Generally, one template can not create nice output in all formats. In your case, you would need a format parameter to suppress headers/footers if it's value is 'EXCEL'. The problem is (I wish someone would correct me on this) that we can not refer the standard parameter already there and have to create another, user-defined parameter.

  • Sending Functional Location and Equipments using ALE

    I want to knbow the transaction code for sending the Functional Locations and Equipments.
    Like for Material we have BD10, I need the TCode for both Functional Locations and Equipments
    Also please let meknow the message type and basic types for the same.
    Thanks in advance

    I dont think there is any standard t-code available for distribution of functional area and equipment.  Anyway check the menu path SAP Menu -> Tools -> ALE -> Distribution in applications/Master data distribution.
    For IDOC and Message type details check transaction codes WE30 and WE81.
    Regards
    Vinod

  • Download and Upload using applet

    hi everyone,
    i tried to develop an applet that can handle upload and download file from server to client and vice versa.
    is there anyone can help me?
    Please help.
    thank you for replies.

    You need to sign your applet and the user needs to trust this signature in order for the
    applet to read from the local filesystem and or connect to a server other than the one the
    applet came from.
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post
    Here is some code that will upload (both msjvm and sun jre) but I never really finished
    it. Note that if you use the applet with msjvm the client has to adjust java security in IE
    import java.awt.*;
    import java.net.*;
    import java.io.*;
    public class srvHead extends java.applet.Applet implements Runnable{
         String c = "";
         public srvHead(){
              new Thread(this).start();
         public void init(){
    //          new Thread(this).start();
         public void run(){
              try{
    // run this as an application first, when it works than make an applet of it
                   URL u = new URL("http://localhost:101/test");
                   URLConnection c = u.openConnection();
                   // post multipart data
                   c.setDoOutput(true);
                   c.setDoInput(true);
                   c.setUseCaches(false);
                   // set some request headers
                   c.setRequestProperty("Connection", "Keep-Alive");
    // TODO: get codebase of the this (the applet) to use for referer
                   c.setRequestProperty("HTTP_REFERER", "http://applet.getcodebase");
                   c.setRequestProperty("Content-Type", "multipart/form-data; boundary=****4353");
                   DataOutputStream dstream = new DataOutputStream(c.getOutputStream());
    // write content to the server, begin with the tag that says a content element is comming
                   dstream.writeBytes("--****4353\r\n");
    // discribe the content, (in this case it's a file)
                   dstream.writeBytes("Content-Disposition: form-data; name=\"myfile\"; filename=\"C:\\myFile.wav\"\r\nContent-Type: application/octet-stream\r\n\r\n");
    // open a file
                   String title = "Frame Title";
                   Frame frame = new Frame("Select a file");
                   FileDialog fd = new FileDialog(frame);
                   frame.setSize(400, 400);
                   fd.show();
                   System.out.println(fd.getDirectory() + fd.getFile());
                   File f = new File(fd.getDirectory() + fd.getFile());
                   FileInputStream fi = new FileInputStream(f);
    // keep reading 1000 bytes from the file
                   byte[] bt = new byte[1000];
                   int cnt = fi.read(bt);
                   while(cnt==bt.length){
                        dstream.write(bt,0,cnt);
                        cnt = fi.read(bt);
    // send the last bit to the server
                   dstream.write(bt,0,cnt);
    // now close the file and let the web server know this is the end of this form part
                   dstream.writeBytes("\r\n--****4353\r\n");
    // send a form part named TargetURL with the value: /IntranetContent/TelephoneGuide/Upload/
                   dstream.writeBytes("Content-Disposition: form-data; name=\"TargetURL\"\r\n\r\n");
                   dstream.writeBytes("/IntranetContent/TelephoneGuide/Upload/");
    // let the web server know this is the end of this form part
                   dstream.writeBytes("\r\n--****4353\r\n");
    // send a form part named redirectURL with the value: http://none/none
                   dstream.writeBytes("Content-Disposition: form-data; name=\"redirectURL\"\r\n\r\n");
                   dstream.writeBytes("http://none/none");
    // this is the last information part of the multi part request, close the request
    // close the multipart form request
                   dstream.writeBytes("\r\n--****4353--\r\n\r\n");
                   dstream.flush();
                   dstream.close();
                   fi.close();
                   try{
                        DataInputStream in =
                             new DataInputStream(
                                  new BufferedInputStream(c.getInputStream()));
                        String sIn = in.readLine();
                        boolean b = true;
    // TODO: this will loop forever unless you make sure your server page
    // sends a last line like "I am done"
    // than you can do wile(sIn.compareTo("I am done")!=0){
                        while(sIn!=null){
                             if(sIn!=null){
                                  System.out.println(sIn);
                             sIn = in.readLine();
                   }catch(Exception e){
                        e.printStackTrace();
              }catch(Exception e){
                   e.printStackTrace();
         public static void main(String[] args) {
                   new srvHead();
    }

  • "prev"and "next" buttons no longer work on Yahoo/other slideshows. Still work in Chrome.

    In updating for FFX 6 and 7, the next and prev buttons no longer work in slideshows on Yahoo news and similar sites. Sometimes the status bar shows the links as javascript: void or :null. Sometimes longer links. All javaconsole add-ins are shown as incompatible with these version of FFX.

    i woudnt suggest it, but if your warranty is up it could just be a bad connection from the wheel...what generation do you have? my 4th generation 20 gig ceased to function and it was because somehow one of the cables had a bad connection. i took it to the apple store and they gave me an estimate for something i wasnt willing to pay on a 2 year old ipod so i just winged dissasembleing it and after taking apart the whole thing and reassembling it worked fine.

  • TS4006 what is the function 'lock and track used for ? What is 'remote wipe' used for ?

    I just fired up my iPhone and iPad with 'Find My iPhone app.....not sure how to use  'Function and Track & Remote Wipe' options
    Thanks
    S

    Lock - many users foolishly do not use a passcode, to lock the device.  This function lets a user lock the lost device with a password to prevent a thief from gaining access to the apps and data.
    Track - when lost or stolen, the device can be tracked on a map.  This assumes the device is connected to the internet, is turned on, and has not been reset.
    Wipe - this deletes all data of the lost device to prevent a their from viewing the data.  Once a remote wipe is placed, you cannot remotely unwipe it, same for lock.

  • Call jsp function in javascript without using Applet

    anyone knows how to call jsp function in javascript .
    just as follows:
    <%!
    public string jspcall()
    return new String("just a example");
    %>
    <script language="javascript">
    <!--
    temp = jspcall();
    //->
    </script>
    it's desn't work.
    any suggestion will help!

    it's was not able to call a jsp function in javascript.
    jsp function was on server site while javascript normally on the client site.

  • How to find function module's and tables used for the particulat screen or TCODE?

    Hello Nation,
    I would like to know how to find the  function modules and tables used for the particular screen or TCODE or program.
    Example : I would like know the function module used in the program RDBGFT?
                     How can i find that?
    Thanks in advance ,Awaiting your reply.

    Make use of Find function  with the keyword "CALL FUNCTION".
    Make use of the same find function with the keyword "Select" to know the database tables used.
    Regards,
    Philip.

  • Photoshop 13 wont install off disc.  Can I download it and still use the serial number off the box?

    Tried everything to install Photoshop Elements 13.  Sits at 11%.  There is a C++ issue even though there is no issue!!  My question is can I download it from Adobe and use the serial number off the box?

    Yes, you can download and use the serial number you have.
    PSE 10, 11, 12,13 - http://helpx.adobe.com/photoshop-elements/kb/photoshop-elements-10-11-downloads.html
    You can also download the trial version of the software thru the page linked below and then use your current serial number to activate it.
    Be sure to follow the steps outlined in the Note: Very Important Instructions section on the download pages at this site and have cookies enabled in your browser or else the download will not work properly.
    Photoshop/Premiere Elements 13: http://prodesigntools.com/photoshop-elements-13-direct-download-links-premiere.html

  • Difference between Function module and a subroutine

    hi
    In the case of subroutine i can access the global workarea values.
    I want to know whether in the case of function module
    whether
    i can follow the same procedure to access the workarea values
                                       or
    i have to pass this workarea values as an import or tables parameter to the function module and then use it
    (in first case whether that workarea to make global whether i have to place it in function pool please check this but which is better one)
    Thx in advance for any replies.

    Yes
    You would have to pass the values as import parameters to access the global variables of the program otherwise you will not be able to get the values of the global variable from inside the program.
    Another solution would be to export to SAP memory but the entire concept of modularization of using the FM would be lost.

  • I am having trouble with my JAVA Applet. It isn't functioning on SAFARI.    It seems to have stopped working and I used it on SAFARI last year. Any suggestions ?

    I am having trouble with my JAVA Applet. It isn't functioning on SAFARI.    It seems to have stopped working and I used it on SAFARI last year. Any suggestions?

    Post in the Safari forum area.

  • Previous Page and Next Page functions lost

    The Previous Page and Next Page icons suddenly vanished with only the Reload Page and Add Bookmark icons showing. The only way I am able to return to a previous page is through History. Will I have to reintall Safari? and, if so, can I just install Safari without jeopardizing my data not only in Safari but other applications? I have original OS X 10.2 and 10.3 discs. Can I reintall over the existing Safari app?
    Thanks much.
    TeddyZ
    G4   Mac OS X (10.4.3)  

    Sorry, but this didn't work at all. I think Safari has been corrupted and think I'll have to reinstall.
    Do I deinstall? or can I reinstall over the existing Safari? And can I isolate Safari with my existing OS discs (I have both OS 10.2 and 10.3.5)?
    I have an external hard drive. Could that be helpful in this process?
    (I suspect that all my bookmarks will be lost, but can compensate by printing them out in hard copy).
    G4   Mac OS X (10.4.3)  

Maybe you are looking for