DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   Assignment on java 2 j2sdk1.4.2_04 (http://www.daniweb.com/forums/thread97794.html)

tactfulsaint Nov 21st, 2007 10:18 am
Assignment on java 2 j2sdk1.4.2_04
 
Hello everyone please i need help ..
i am new 2 java and i was given this assigment of which i dont even know where to start from...If anyone can help please IM me so i can send him the question or perhaps for a little guidance on how to go about everything cuz i will have to defend my project...
Thanks Alot
Anthony

jwenting Nov 21st, 2007 11:28 am
Re: Assignment on java 2 j2sdk1.4.2_04
 
no, we're NOT going to do your homework for you and we're NOT going to give you private help.

If you'd paid attention in class you'd by now have known what to do and how to do it, so if you fail it's all your own fault and quite deserved.

tactfulsaint Nov 23rd, 2007 6:29 am
Re: Assignment on java 2 j2sdk1.4.2_04
 
its ait man, you dont understand i am not askin you to help me do it...
All i needed was just a lil guidelines, common i have been doing it on my own its just gettin a lil bit complicated i can figure it out but time is not on my side but thanks all the same jwenting. i like what you did but dont rush into conclusions ok.

tactfulsaint Nov 29th, 2007 7:42 am
How do i add music..
 
hello everyone ..
please i need some one to help with the way i should about add music to play on my java app .
i am doing a project that involves buying music online so i want to add the artist music so that when someone clicks on the artist he'll be able t hear the song of the artist before adding to cart.
thank..

ithelp Nov 29th, 2007 9:57 am
Re: How do i add music..
 
Quote:

Originally Posted by tactfulsaint (Post 480758)
hello everyone ..
please i need some one to help with the way i should about add music to play on my java app .
i am doing a project that involves buying music online so i want to add the artist music so that when someone clicks on the artist he'll be able t hear the song of the artist before adding to cart.
thank..


You can not code website using java, try some server side language like asp/php
Or are you trying to implement java applet ?

tactfulsaint Nov 29th, 2007 10:06 am
Re: How do i add music..
 
yes thats right i was trying to implement java applet . here is the code snipet, please dont lauch cuz am new lol.


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.util.Calendar;
/*
<applet code="The.class" height=20 width=20>
</applet>
*/
public class The extends JApplet implements ActionListener
{
/*D V*/
JPanel panel;
JLabel lo;
JLabel bo;
JLabel wo;
JLabel yo;
JLabel b1;
JLabel l1;
JLabel l2;
JLabel display;
ImageIcon LO;
ImageIcon LO1;
ImageIcon LO2;
ImageIcon LO3;
JButton classic;
JButton western;
JButton pop;
JButton jazz;
JButton add;
JCheckBox tilo;
JCheckBox tila;
JCheckBox tilu;
JCheckBox tile;
JCheckBox tili;
JComboBox cbta;
JTextField bu;
Font f;
GridBagLayout g;
GridBagConstraints gbc;
public void init()
{
/*I L V*/
g=new GridBagLayout();
gbc=new GridBagConstraints();
panel=(JPanel)getContentPane();
panel.setLayout(g);
Icon LogoImage=new ImageIcon("c:/project/music on.gif");
//you will mention the path of your jpg file
l1=new JLabel();
gbc.anchor=GridBagConstraints.EAST;
gbc.ipady=2;
gbc.ipadx=4;
gbc.gridx=4;
gbc.gridy=4;
g.setConstraints(l1,gbc);
panel.add(l1);
panel.setBackground(Color.blue);
/*A C P*/
classic=new JButton("Classic");
gbc.fill=GridBagConstraints.BOTH;
classic.setForeground(Color.red);
classic.setBackground(Color.blue);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=1;
gbc.gridy=3;
g.setConstraints(classic, gbc);
panel.add(classic);
tilo=new JCheckBox("Gwen Stefani");
tilo.setForeground(Color.red);
tilo.setBackground(Color.blue);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=2;
gbc.gridy=3;
g.setConstraints(tilo, gbc);
panel.add(tilo);
setSize(6000,9000);
/*A C P*/
western=new JButton("Western");
western.setForeground(Color.red);
western.setBackground(Color.blue);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=1;
gbc.gridy=4;
g.setConstraints(western, gbc);
panel.add(western);
tila=new JCheckBox("topee");
tila.setForeground(Color.red);
tila.setBackground(Color.blue);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=2;
gbc.gridy=4;
g.setConstraints(tila, gbc);
panel.add(tila);
/*A C P*/
pop=new JButton("Pop");
pop.setForeground(Color.red);
pop.setBackground(Color.blue);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=1;
gbc.gridy=5;
g.setConstraints(pop, gbc);
panel.add(pop);

tilu=new JCheckBox("Fergie");
tilu.setForeground(Color.red);
tilu.setBackground(Color.blue);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=2;
gbc.gridy=5;
g.setConstraints(tilu, gbc);
panel.add(tilu);

/*A C P*/
jazz=new JButton("Jazz");
jazz.setForeground(Color.red);
jazz.setBackground(Color.blue);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=1;
gbc.gridy=6;
g.setConstraints(jazz, gbc);
panel.add(jazz);
tile=new JCheckBox("10/12/07 10:25");
tile.setForeground(Color.red);
tile.setBackground(Color.blue);
gbc.ipady=1;
gbc.ipadx=1;
gbc.gridx=1;
gbc.gridy=7;
g.setConstraints(tile, gbc);
panel.add(tile);
/*A C P*/
add=new JButton("Add to cart");
add.setForeground(Color.blue);
add.setBackground(Color.green);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=4;
gbc.gridy=7;
g.setConstraints(add, gbc);
panel.add(add);

/*A C P*/
lo=new JLabel("select the category");
lo.setForeground(Color.red);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=1;
gbc.gridy=2;
g.setConstraints(lo, gbc);
lo.setFont(new Font("Helvetical",Font.BOLD,15));
panel.add(lo);
bo=new JLabel("List of all");
bo.setForeground(Color.red);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=2;
gbc.gridy=2;
g.setConstraints(bo, gbc);
panel.add(bo);
tili=new JCheckBox("Funke");
tili.setForeground(Color.red);
tili.setBackground(Color.blue);
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=2;
gbc.gridy=6;
g.setConstraints(tili, gbc);
panel.add(tili);
/*I M*/
LO=new ImageIcon("c:/project/Rihanna.gif");
LO2=new ImageIcon("c:/project/Gwen Stefani.gif");
LO3=new ImageIcon("c:/project/Christina Milian.gif");
LO1=new ImageIcon("c:/project/Fergie.gif");
display = new JLabel();
gbc.anchor = GridBagConstraints.LINE_END;
gbc.gridx = 4;
gbc.gridy = 4;
gbc.ipadx = 3;
gbc.ipady = 4;
g.setConstraints(display, gbc);
panel.add(display);
Icon logoImage=new ImageIcon("c:/project/music on.gif");
b1=new JLabel(logoImage);
gbc.anchor=GridBagConstraints.NORTHEAST;
gbc.ipady=2;
gbc.ipadx=2;
gbc.gridx=4;
gbc.gridy=1;
g.setConstraints(b1,gbc);
panel.add(b1);
classic.addActionListener(this);
western.addActionListener(this);
pop.addActionListener(this);
jazz.addActionListener(this);
tilo.addActionListener(this);
add.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
Object o=ae.getSource();
if(o==classic)
{
display.setIcon(LO);
tilo.setText("Fergie");
tila.setText("Christina Milian");
tilu.setText("Rihanna");
tili.setText("Lagbaja");
}
if(o==western)
{
display.setIcon(LO1);
tilo.setText("Funke");
tila.setText("Keinde");
tilu.setText("T-pain");
tili.setText("Topee");
}
if(o==pop)
{
display.setIcon(LO2);
tilo.setText("Pink");
tila.setText("Britney Spears");
tilu.setText("Limbizkit");
tili.setText("Kelly Clarkson");
}
if(o==jazz)
{
display.setIcon(LO3);
tilo.setText("Kenny G");
tila.setText("Yenny");
tilu.setText("JazzMan");
tili.setText("Lenny");
}
if(add==o)
{
Add myadd = new Add();

/*start changes*/
myadd.init();
myadd.start();

int compCount = panel.getComponentCount();
java.util.Vector componentList = new java.util.Vector();
for(int i = 0; i < compCount; i++)
{
Component c = panel.getComponent(i);
componentList.addElement(c);
}

for(int i = 0; i < componentList.size(); i++)
{
Component c = (Component)componentList.elementAt(i);
panel.remove(c);
}

panel.add(myadd);

//use this method for thread safety
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run() {
javax.swing.SwingUtilities.updateComponentTreeUI(The.this);
}
});
/*end changes*/
{
String months[]= {"jan", "Feb", "Mar", "Apr", "May", "Jun",
"july", "Aug", "Sept", "Oct", "Nov", "Dec"};

Calendar cal = Calendar.getInstance();
System.out.println("The Date is: ");
System.out.print(months[cal.get(Calendar.MONTH)]) ;
System.out.print(" " + cal.get(Calendar.DATE) + " ") ;
System.out.println(cal.get(Calendar.YEAR));

cal.set(Calendar.HOUR, 11);
cal.set(Calendar.MINUTE, 30);
cal.set(Calendar.SECOND, 0);
System.out.print("The Time is: ");
System.out.print(cal.get(Calendar.HOUR) + ":");
System.out.print(cal.get(Calendar.MINUTE) + ":");
System.out.print(cal.get(Calendar.SECOND));
}

}
}
}

stultuske Nov 30th, 2007 8:47 am
Re: Assignment on java 2 j2sdk1.4.2_04
 
well...
since you've said that you could figure it all out on yourself, I take it you've allready figured out that Java and JavaScript are not the same programming language?

tactfulsaint Dec 2nd, 2007 1:06 pm
Re: Assignment on java 2 j2sdk1.4.2_04
 
Thanks man but i could use your help cuz am lost right now.

jwenting Dec 3rd, 2007 1:29 am
Re: Assignment on java 2 j2sdk1.4.2_04
 
you said you could figure it all out for yourself, so by definition you're not lost.

masijade Dec 3rd, 2007 1:46 am
Re: How do i add music..
 
Quote:

Originally Posted by ithelp (Post 480813)
You can not code website using java, try some server side language like asp/php


I'm sorry (no I'M not), but BS. What is JSP? What do those three letters stand for? What are Servlets programmed in? What are they?


All times are GMT -4. The time now is 8:16 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC