jiten_raulo 0 Newbie Poster

Hi Masters,

I Need your help on the bellow scenario:

I have a list of checkboxes. Want to show or hide images related to each checkbox upon selection/deselection.

I want initially the images will not shown as the check boxes are select the images will showup. if deselect any checkbox then that particular image will disappear with taking no space.

Bellow is the code witch not working.

<html>
<head>
<script type="text/javascript">
$(document).ready(function () {
$('.infiniteCarousel').infiniteCarousel();
});

function showImage(checkedBox){
if(document.getElementById('checkedBox.id').checked==true){
document.getElementById("checkedBox.value").style.visibility = 'visible';
}
else if(document.getElementById('checkedBox.id').checked==false){
document.getElementById("checkedBox.value").style.visibility = 'hidden';
}
}
</script>
</head>
<body>
<br>
<form method="post" action="#" name="test"> <input name="test1"
value="image1" id="check1" onclick="showImage(this)" type="checkbox">Test
1<br>
<input name="test2" value="image2" id="check2"
onclick="showImage(this)" type="checkbox">Test 2<br>
<input name="test3" value="image3" id="check3"
onclick="showImage(this)" type="checkbox">Test 3<br>
<input name="test1" value="image4" id="check4"
onclick="showImage(this)" type="checkbox">Test 4<br>
<input name="test1" value="image5" id="check5"
onclick="showImage(this)" type="checkbox">Test 5<br>
<input name="test1" value="image6" id="check6"
onclick="showImage(this)" type="checkbox">Test 6<br>
<input name="test1" value="image7" id="check7"
onclick="showImage(this)" type="checkbox">Test 7<br>
<input name="test8" value="image8" id="check8"
onclick="showImage(this)" type="checkbox">Test 8<br>
</form>
<br>
<br>
<a href="http://www.flickr.com/photos/remysharp/3047035327/"
title="Tall Glow"><img
src="http://farm4.static.flickr.com/3011/3047035327_ca12fb2397_s.jpg"
alt="Tall Glow" id="image1" height="75" width="75"></a> <a
href="http://www.flickr.com/photos/remysharp/3047872076/"
title="Wet Cab"><img
src="http://farm4.static.flickr.com/3184/3047872076_61a511a04b_s.jpg"
alt="Wet Cab" id="image2" height="75" width="75"></a> <a
href="http://www.flickr.com/photos/remysharp/3047871878/"
title="Rockefella"><img
src="http://farm4.static.flickr.com/3048/3047871878_84bfacbd35_s.jpg"
alt="Rockefella" id="image3" height="75" width="75"></a> <a
href="http://www.flickr.com/photos/remysharp/3047034929/"
title="Chrysler Reflect"><img
src="http://farm4.static.flickr.com/3220/3047034929_97eaf50ea3_s.jpg"
alt="Chrysler Reflect" id="image4" height="75" width="75"></a>&lt; <a
href="http://www.flickr.com/photos/remysharp/3047871624/"
title="Chrysler Up"><img
src="http://farm4.static.flickr.com/3164/3047871624_2cacca4684_s.jpg"
alt="Chrysler Up" id="image5" height="75" width="75"></a> <a
href="http://www.flickr.com/photos/remysharp/3047034661/"
title="Time Square Awe"><img
src="http://farm4.static.flickr.com/3212/3047034661_f96548965e_s.jpg"
alt="Time Square Awe" id="image6" height="75" width="75"></a> <a
href="http://www.flickr.com/photos/remysharp/3047034531/" …
jiten_raulo 0 Newbie Poster

Can anyone help me? Actually I want to lean Advance Java (J2EE), the problem is, to go further you should have two knowledge :
1. knowledge on RDBMS
2. knowledge on ODBC & JDBC
however I have little bit knowledge on database, and SQL statements, after that everything is blank, I have installed Oracle 10g and can create tables.

My questions are:
1. After creating a database table does it create any object or (file) and stores in your hard disk?
2. If no, then to what we will connected in JDBC?
3. what are the common factors between Java and Database

Please help, I’m confused!!!!!!!!

jiten_raulo 0 Newbie Poster

Hi Experts,
I want to calculate age, i.e. user enter the date of birth and the output would be the age.
I guess I should use GregorianCalendar. The logic is subtracting the user date from current date. But how? Can any one have any idea……………

Thanks in advance
JIten

jiten_raulo 0 Newbie Poster

mean, when we work on frame or applet we give locations(x and y coordinates, width, heigth etc.) for components, containers (buttons, checkboxes, radiobotton, text input area etc.. My questions is when when working with such things is that we have to imagine the location and assign or is there a standard sheet to do rough drawing ?
Thanks
Jiten

jiten_raulo 0 Newbie Poster

Extremely sorry, I have made a mistake. mistakenly posted the wrong code!
Here the correct code:

import java.awt.Frame;
import java.awt.Graphics;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.Color;


public class DrawOnFrame extends Frame
{
    DrawOnFrame()
    {
        this.addWindowListener(new WindowAdapter()
        {
            public void windowClosing(WindowEvent e)
            {
                System.exit(0);
            }
        });
    }
    public void paint(Graphics g)
    {
        //set blue color for drawing
        g.setColor(Color.blue);

        //displaya rectangle to contain drawing
        g.drawRect(40, 40, 200, 200);

        //draw face
        g.drawOval(90, 70, 80, 80);

        //eyes
        g.drawOval(110, 95, 5, 5);
        g.drawOval(145, 95, 5, 5);

        //nose
        g.drawLine(130, 95, 130, 115);

        //mouth
        g.drawArc(113,115,35,20,0,-180);


    }
    public static void main(String args[])
    {
        //create the frame
        DrawOnFrame d = new DrawOnFrame();

        //set title, size and visibility
        d.setTitle("My Frame");
        d.setSize(400, 400);
        d.setVisible(true);


        
    }

}
jiten_raulo 0 Newbie Poster

Hi Experts,
I have question on the bellow program (runs perfectly),
1. As I have created an instance (object) of startup class and we dint called method paint from the main method using the object but still it is called (how?). But in case of Instantiable classes, we need to call any method explicitly using the created object.
2. Is there any standard sheet to do rough calculation of frame locations? It is bit confusing, because my window resolution is 1024*768 and my frame size is differs. Whatever location measurement we do with frames: Is it depends on Window resolution or Frame resolution?


Thanks in advance for any help!

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Properties;
import java.io.File;
import java.util.Enumeration;
import java.util.Set;

public class TestSheet 
{
    public static void main(String args[]) throws Exception
    {
        File f = new File("F://my study material//DemoFiles//DemoTXT.txt");
        FileOutputStream fout = new FileOutputStream("F://my study material//DemoFiles//DemoTXT2.txt", true);
        FileInputStream fis = new FileInputStream(f);
        Properties p = new Properties();
        p.load(fis);
        Enumeration e = p.propertyNames();

        while(e.hasMoreElements())
        {
            String key = (String)e.nextElement();
            System.out.println(key + " : \t" + p.getProperty(key));
        }
        p.store(fout, "no comment");

        System.out.println();
        Set subject = p.keySet();

        for(Object name: subject)
            System.out.println(name+" : "+p.getProperty((String)name));

        String str = p.getProperty("Social Science", "No record");
        System.out.println("Marks obtain by social science: "+str);

        
    }
   
}

Jiten

jiten_raulo 0 Newbie Poster

An another way is that, if you thing any part may contain bugs, just get out that part to another source file and test it or just do a partial test.

jiten_raulo 0 Newbie Poster

thanks for the answer, so far that is right, but when I compile a java program in my NetBeans IDE I get notepad and .class file created. How can I run the same program (not the project only source file) and the .class file in unknown format!!
Please clarify me
again thanks

jiten_raulo 0 Newbie Poster

Hi all,

I have a question that , can we use java program as c++ program? Means, when we compile a c++ program we get a .exe file and we can run it anywhere or send to any one.
Is the same possible in Java? As I know java creates a .class bytecode. I am using NetBeans.

Thanks in advance for any consideration
G10

jiten_raulo 0 Newbie Poster

thanks friend.

jiten_raulo 0 Newbie Poster

Hi experts,

I have confusion about the point I read in my book:
I. In a source file you can define number of classes, but only one of them can be a public class. In this case, the name of source file must match the name of public class.
II. In a source file, you can define number of classes with default access specifier.

As I understand, one class must be public that is startup class and one or more class can be package(default).

Question
1. Suppose I have coded two classes in a source file, say in package X. And I want to use both of them in package Y. as far as I know, to use in outside package we have to put classes in access specifier public!

Should I have to put both the classes in different source file or what?

Thanks in advance for your cooperation all the way…

Jiten

jiten_raulo 0 Newbie Poster

An another way is you can store all digits in an array and pass the array name as int and in main program do a pointer to that and using for loop get all those number.
And an easy way is that, what I have done in my previous program just get a string of number and convert all index to int type.
thats all from mine.
happy coding.

jiten_raulo 0 Newbie Poster

thanks u all,
not its happening.
to things need to remember to include in header file:
1: both file should be in the same location, and
2: we have to include the header as #include"header.h" not as <header.h>
thanks
Jiten

jiten_raulo 0 Newbie Poster

Can any one tell me how to put a part of program into a header file or how to work with multiple files? According to my book, I need to put the template and class part into a separate file and include the header as "counter.h". I have done same and saved the file as counter.h but it didn’t worked. Please help me out!

Thanks in advance daniweb communitiy

#include<iostream>

template <class Type>
class counter
{
      Type data;                                   // store the count  
  public:
    counter (Type N=0){data = N;}                // constructor, default initial is 0
    void increment(Type D=1){data += D;}         // increment is 1 by default
    Type getValue(){return data;}                // return the current count 
};

using namespace std;

int main()
{

    int N;                                      // input number
    counter<int> counterOfOdds;                      // count of odd numbers
    counter<short>counterMultiples;                   // count of multiple of 3

    do
    {
       cout <<"Enter number (-1 to finish): ";
       cin >>N;

       if (N != -1)                             // not the terminator
       {
           if (N%2 == 0) counterOfOdds.increment();       // odd number
           if (N%2 != 0) counterMultiples.increment();    // multiple of 3
       }
    } while(N != -1);

    cout<<"Number of odd numbers: " <<counterOfOdds.getValue()<<endl;
    cout<<"Number of even numbers: "<<counterMultiples.getValue()<<endl;




    system("PAUSE");
    return 0;

}
jiten_raulo 0 Newbie Poster

I am little bit confuse about this operator. Can any one tell me what does operator -> internally. And what are the importance of -> in pointer?

Appreciated in advance for help (all daniweb group).

jiten_raulo 0 Newbie Poster

Thanks all u friendz,
really projecteuler.net is an excelent site for c++ programs.
Special thanks to unbeatable0.
Jiten.

jiten_raulo 0 Newbie Poster

I spend 6 to 7 hours each day practicing c++ and visual c++ but end of the day I think I don't have any Test or homework. Please anyone can provide with some site helping with the same. Thanks in advance
JIten