CAN ANYBODY TELL ME WHAT WRONG WITH THIS RSS FEED IT WONT WORK
CAN ANYBONE TELL ME WHATS WRONG WITH THIS FEED BECAUSE IT WONT WORK AND ALSO HOW DO I GET A LINK TO THE PODCAST RSS FEED FOR THE SUBMIT PODCAST PAGE ON ITUNES,
ANY HELP WILL BE MUCH APRECIATED
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>DJ Hybrid Coventry Drum n Bass Podcast</title>
<link>http://www.djhybridcoventry.com/podcast.htm</link>
<language>en-us</language>
<copyright>℗ & © 2007 DJ Hybridb& </copyright>
<itunes:subtitle>DJ Hybrid Drum n Bass Podcast brings you all the latest and greatest from the Drum n Bass scene, updated every two weeks</itunes:subtitle>
<itunes:author>DJ Hybrid</itunes:author>
<itunes:summary>The DJ Hybrid Coventry Drum n Bass Podcast will showcase a selection of the latest and greatest tunes that are getting rinsed on the scene, mixed down with sharp cuts and nasty double drops by Dj Hybrid the podcast will also feature other DJ's and Mc's on different shows. Updated every two weeks this is guarenteed to be an original style of drum n bass mashup, for more info check www.djhybridcoventry.com</itunes:summary>
<description>DJ Hybrid Drum n Bass Podcast brings you all the latest and greatest from the Drum n Bass scene, updated every two weeks</description>
<itunes:owner>
<itunes:name>DJ Hybrid</itunes:name>
<itunes:email>[email protected]</itunes:email>
</itunes:owner>
<itunes:image href="http://i100.photobucket.com/albums/m8/djhybrid/PODCASTLOGOBLUE.jpg" />
<itunes:category text="Music">
<itunes:category text="Drum n Bass"/>
</itunes:category>
<itunes:category text="music"/>
<item>
<title>DJ Hybrid Podcast - 1st Show 03/6/07</title>
<itunes:author>DJ Hybrid</itunes:author>
<itunes:subtitle>The first show of the new drum n bass podcast from DJ Hybrid</itunes:subtitle>
<itunes:summary>Welcome to the 1st show from DJ Hybrid because its the first show im goin to play what tunes i think represent me as a DJ aswell as my favourite drum n bass tunes at the moment for tracklistings check www.djhybridcoventry.com</itunes:summary>
<enclosure url="http://fs06n5.sendspace.com/dl/603942da730253766c5157920e810d3e/46771dd931 3f824d/v3adp4/DJ%20Hybrid%20Podcast%201%20%20-%20%203rd%20June%202007.mp3" length="8727310" type="audio/x-m4a" />
<guid>http://fs06n5.sendspace.com/dl/603942da730253766c5157920e810d3e/46771dd9313f824d /v3adp4/DJ%20Hybrid%20Podcast%201%20%20-%20%203rd%20June%202007.mp3</guid>
<pubDate>Sun, 03 Jun 2007 20:00:00 GMT</pubDate>
<itunes:duration>53:36</itunes:duration>
<itunes:keywords>DJ, Hybrid, Podcast, Drum, Bass, Jungle, Coventry, Double Drop, Latest, Tunes, Vinyl, Liquid, Rave, Reggae, Urban</itunes:keywords>
</item>
</channel>
</rss>
First...Stop screaming. It's rude.
Next...there are some minor problems with your feed. "Drum n Bass" is not a iTunes category. Stick with <itunes:category text="Music" /> remove the others.
Not required, but recommend to add an <itunes:explicit> tag with a Y or N depending on what suits your podcast. The iTunes staff will remove your feed if it isn't tagged properly.
MP3 audio files should have a type="audio/mpeg".
Keep the Podcast spec handy...the categories and other info listed in the spec.
Test your feed with http://www.feedvalidator.org it will point out problems with your feed.
The bigger problems stem from your podcast enclosure, specifically the URL.
The URL you have listed to the podcast mp3 apparently has changed so iTunes can't download the file. It also appears that you are using a "free download" kind of service that uses web page based downloads, which might account for why the URL keeps changing. Don't think that iTunes will be able to properly download the file.
Erik
Similar Messages
-
Can't figure out whats wrong with this IF statement
Hey.
I must be tired cause I just can't figure out why this IF statement doesn't work. It's probably something silly but please help me get it right. The user is prompted with a form (textfield) and I'm gonna check if its the right password (this is not the reason im doing this but it works good for this example).
if(displayable == form){
String correctPassword = "abcd";
System.out.println("Input: " + textfield.getString());
System.out.println("Correct: " + correctPassword);
if(textfield.getString() == correctPassword) {
System.out.println("Password is correct");
Display.getDisplay(this).setCurrent(mList);
else {
System.out.println("Wrong password");
destroyApp(true);
notifyDestroyed();
}Even though i enter the correct password, it still thinks it is incorrect. This is how the WTK compiler outputs the above statement.
Input: abcd
Correct: abcd
Wrong passwordObviously the passwords DO match, so what am I doing wrong?The == comparison operator returns true for equal primitives OR for variable references to the same object.
Classes (usually) override the .equals (Object obj) method inherited from Object to return true when objects of the class are essentially equivalent.
Run this java code segment and try to understand the output.String aStr = "A string";
String bStr = aStr;
if (aStr == bStr) System.out.println ("== true");
else System.out.println("== false");
if (aStr.equals (bStr)) System.out.println (".equals true");
else System.out.println(".equals false");
System.out.println();
bStr = new String ("A string");
if (aStr == bStr) System.out.println ("== true");
else System.out.println("== false");
if (aStr.equals (bStr)) System.out.println (".equals true");
else System.out.println(".equals false");
System.out.println();
bStr = new String ("Some String");
if (aStr == bStr) System.out.println ("== true");
else System.out.println("== false");
if (aStr.equals (bStr)) System.out.println (".equals true");
else System.out.println(".equals false");Ask again if it's not clear enough. But first, read the API for Object.equals (Object obj) to understand the contract of .equals (...)
db -
Can anybody tell me the problem with this code when compiled in jdk1.4
Can anybody help me find out the error in this code.
Try to drag a file from your desktop and drop it on the first textpane on my GUI. Then try to drag another file. This time the dragdrop event handler throws a null pointer exception. This happened when I compiled the code with jdk1.4. With jdk1.3 it is working fine. Actually, I need jdk1.4 to get the systemicons for the files I drop on my desktop.
/* Client.java*/
import java.util.Vector;
import java.util.Enumeration;
import java.util.Arrays;
import java.awt.*;
import java.awt.event.*;
import java.rmi.*;
import java.rmi.server.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.filechooser.*;
import java.io.*;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import java.util.Iterator;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import java.util.Hashtable;
import javax.swing.text.*;
import javax.swing.event.*;
public class Client extends JFrame{
static String newline = System.getProperty("line.separator");
static Client client;
//ServerInterface server;
//ClientProperties clp;
Vector v1=new Vector();
ByteArrayOutputStream out;
Runtime r1;
//file objects,together with array of bytes
Hashtable files=new Hashtable(); //files sent
Hashtable rfiles=new Hashtable(); //files received
//file objects,together with button handlers
Hashtable hfiles=new Hashtable(); //files sent,files received
JButton button1=new JButton();
JButton button2=new JButton();
JButton button3=new JButton();
JLabel label1=new JLabel();
JLabel label2=new JLabel();
JLabel label3=new JLabel();
JLabel label4=new JLabel();
JLabel label5=new JLabel();
JLabel label6=new JLabel();
JLabel label7=new JLabel();
JLabel label8=new JLabel();
JOptionPane dialog=new JOptionPane();
JFileChooser chooser = new JFileChooser();
JPanel panel1;
JPanel panel2;
DropTarget dtarget;
DragSource dsource;
JTextPane textArea1=new JTextPane();
TextArea textArea2=new TextArea();
JTextPane textpanel=new JTextPane();
Style defstyle,style;
StyledDocument doc,doc1;
JPopupMenu popup;
JTree tree;
JScrollPane jsppane;
JScrollPane jsp,jsp2;
DefaultMutableTreeNode top;
Container cp;
private String toalias;
private String togroup;
private String fromalias;
private String fromgroup;
private boolean CONNECT;
public Client()
cp=getContentPane();
cp.setLayout(null);
setForeground(java.awt.Color.red);
setFont(new Font("Dialog", Font.PLAIN, 14));
setVisible(false);
label1.setText(" CHAT APPLICATION");
cp.add(label1);
label1.setFont(new Font("Dialog", Font.BOLD, 16));
label1.setBounds(72,20,319,30);
label2.setText("List of Users Connected.");
cp.add(label2);
label2.setForeground(java.awt.Color.blue);
label2.setFont(new Font("Dialog", Font.BOLD, 12));
label2.setBounds(24,60,192,26);
label8.setBounds(280,60,100,26);
cp.add(label8);
cp.add(textArea2);
textArea2.setBounds(204,120,268,90);
jsppane=new JScrollPane(textArea1);
doc1=textArea1.getStyledDocument();
jsppane.setBounds(12,264,456,109);
cp.add(jsppane);
label3.setText("TO::");
cp.add(label3);
label3.setFont(new Font("Dialog", Font.BOLD, 12));
label3.setBounds(12,228,36,20);
cp.add(label4);
label4.setBackground(java.awt.Color.lightGray);
label4.setBounds(60,228,172,19);
label5.setText("SERVER RESPONSE");
cp.add(label5);
label5.setFont(new Font("Dialog", Font.BOLD, 12));
label5.setBounds(204,96,204,21);
label7.setText("MESSAGE FOR YOU.");
cp.add(label7);
label7.setFont(new Font("Dialog", Font.BOLD, 14));
label7.setBounds(12,371,288,25);
jsp2=new JScrollPane(textpanel);
setTextPaneStyle();
jsp2.setBounds(12,401,456,109);
cp.add(jsp2);
button1.setLabel("Send");
button1.setEnabled(false);
cp.add(button1);
button1.setBackground(java.awt.Color.lightGray);
button1.setForeground(java.awt.Color.black);
button1.setFont(new Font("Dialog", Font.BOLD|Font.ITALIC, 10));
button1.setBounds(60,520,78,36);
button2.setLabel("Attach");
//button2.setEnabled(false);
cp.add(button2);
button2.setBackground(java.awt.Color.lightGray);
button2.setForeground(java.awt.Color.black);
button2.setFont(new Font("Dialog", Font.BOLD|Font.ITALIC, 10));
button2.setBounds(180,520,72,36);
button3.setLabel("Connect");
cp.add(button3);
button3.setBackground(java.awt.Color.lightGray);
button3.setForeground(java.awt.Color.black);
button3.setFont(new Font("Dialog", Font.BOLD|Font.ITALIC, 10));
button3.setBounds(288,520,72,33);
setSize(500,620);
show();
addWindowListener(new WindowEventHandler());
button1.addActionListener(new ButtonHandler());
button2.addActionListener(new ButtonHandler());
button3.addActionListener(new ButtonHandler());
textArea1.addContainerListener(new ComponentHandler());
dtarget=new DropTarget(textArea1,new DragDropHandler());
textArea2.setEnabled(false);
textpanel.setEnabled(false);
r1=Runtime.getRuntime();
r1.addShutdownHook(new onshutdown());
addMenu();
cp.repaint();
//adds attachments to the textArea1
synchronized private void addAttach(java.util.List fileList)
Iterator iterator=fileList.iterator();
JButton bw;
while(iterator.hasNext())
File file=(File)iterator.next();
Icon icon=chooser.getIcon(file);
bw=new JButton(icon);
bw.setBackground(java.awt.Color.gray);
bw.setToolTipText(file.getAbsolutePath());
bw.addMouseListener(new AttachmentHandler());
Dimension d1=new Dimension(icon.getIconWidth(),icon.getIconHeight());
bw.setMaximumSize(d1);
hfiles.put(bw,file);
textArea1.insertComponent(bw);
textArea1.setCaretPosition(doc1.getLength());
bw.setSize(icon.getIconWidth(),icon.getIconHeight());
//only one file at a time
break;
cp.repaint();
public void setAudioStream(ByteArrayOutputStream out)
this.out=out;
private void addMenu()
JMenuBar mbar=new JMenuBar();
mbar.setVisible(true);
mbar.setBounds(0,0,500,20);
mbar.setBackground(java.awt.Color.gray);
//first menu
JMenu m1=new JMenu("Connection");
m1.setBounds(0,0,80,20);
m1.setBackground(java.awt.Color.gray);
JMenuItem mitem1=new JMenuItem("Connect");
JMenuItem mitem2=new JMenuItem("Disconnect");
m1.add(mitem1);
m1.add(mitem2);
mitem1.addActionListener(new ButtonHandler());
mitem2.addActionListener(new ButtonHandler());
mbar.add(m1);
//second menu
JMenu m2=new JMenu("Send...");
m2.setBounds(90,0,80,20);
m2.setBackground(java.awt.Color.gray);
JMenuItem mitem3=new JMenuItem("Send");
JMenuItem mitem4=new JMenuItem("Send with Audio...");
mitem3.addActionListener(new ButtonHandler());
mitem4.addActionListener(new ButtonHandler());
m2.add(mitem3);
m2.add(mitem4);
mbar.add(m2);
cp.add(mbar);
private void setTextPaneStyle()
StyleContext stylecontext =StyleContext.getDefaultStyleContext();
defstyle=stylecontext.getStyle(StyleContext.DEFAULT_STYLE);
doc= textpanel.getStyledDocument();
//style 1
style= textpanel.addStyle("bold",defstyle);
StyleConstants.setBackground(style,Color.white);
StyleConstants.setForeground(style,Color.blue);
StyleConstants.setItalic(style, false);
StyleConstants.setBold(style, true);
StyleConstants.setFontSize(style,16);
//style 2
style= textpanel.addStyle("normal",defstyle);
StyleConstants.setBackground(style,Color.white);
StyleConstants.setForeground(style,Color.black);
StyleConstants.setItalic(style, false);
StyleConstants.setBold(style, false);
StyleConstants.setFontSize(style,14);
//style3
style= textpanel.addStyle("attach",defstyle);
StyleConstants.setBackground(style,Color.white);
StyleConstants.setForeground(style,Color.red);
StyleConstants.setItalic(style, true);
StyleConstants.setBold(style, false);
StyleConstants.setFontSize(style,12);
//remote method called by server
public void addClient(String alias,String group,JTree tree)
//if old client remove old tree
if(!alias.equals(""))
cp.remove(this.jsp);
//add new tree
this.tree=tree;
setTreeModel();
getSound(2);
if(!alias.equals(""))
textArea2.append("\nNew Client:" + alias + "has joined");
else
textArea2.append("\nYou have been connected to the Server.");
jsp=new JScrollPane(this.tree);
jsp.setBounds(12,96,168,120);
jsp.setBackground(java.awt.Color.lightGray);
cp.add(jsp);
this.tree.addMouseListener(new MouseHandler());
//remote method called by server
public void sendMessage(String str,Hashtable rfiles,String alias,String group) throws RemoteException
receiveMessage(str,rfiles,alias,group);
//remote method called by server
public void removeClient(JTree tree,String alias,String group) throws RemoteException
cp.remove(this.jsp);
this.tree=tree;
setTreeModel();
getSound(3);
jsp=new JScrollPane(this.tree);
jsp.setBounds(12,96,168,120);
jsp.setBackground(java.awt.Color.lightGray);
cp.add(jsp);
this.tree.addMouseListener(new MouseHandler());
textArea2.append("\nClient:" + alias + "has disconnected");
private void receiveMessage(String str,Hashtable rfiles,String alias,String group)
boolean flag=true;
UIManager.put("JFrame.activeTitleBackground", new Color(64,128,255));
UIManager.put("JFrame.activeTitleForeground", Color.white);
UIManager.put("JFrame.inactiveTitleBackground", new Color(128,128,128));
UIManager.put("JFrame.inactiveTitleForeground", Color.black);
SwingUtilities.updateComponentTreeUI(this);
try{
if(alias.equals(""))
doc.insertString(doc.getLength(),"CHATMASTER>>",textpanel.getStyle("bold"));
doc.insertString(doc.getLength(),str+ newline,textpanel.getStyle("normal"));
else
doc.insertString(doc.getLength(),alias + "@" + group + ">>",textpanel.getStyle("bold"));
doc.insertString(doc.getLength(),str,textpanel.getStyle("normal"));
//add files to textpanel
if(rfiles!=null && rfiles.size()>0)
doc.insertString(doc.getLength(),newline+"Attachments>>",textpanel.getStyle("attach"));
showattach(rfiles);
addtoList(rfiles);
doc.insertString(doc.getLength(),newline,textpanel.getStyle("normal"));
catch(Exception e)
e.printStackTrace();
dialog.showMessageDialog(client,e.toString(),"Error:ChatApplication",JOptionPane.ERROR_MESSAGE);
cp.repaint();
protected boolean ContactServer(String alias,String servername,String group)
try{
//UnicastRemoteObject.exportObject(this);
//server=(ServerInterface)Naming.lookup("//gpt02d05:5500/" + servername);
// server.notifyMe(this,alias,group);
//change the settings of buttons
button1.setEnabled(true);
button2.setEnabled(true);
button3.setLabel("Disconnect");
label8.setVisible(true);
label8.setText(" Welcome::" + alias);
//putting values of alias and group for sending messages
fromalias=alias;
fromgroup=group;
CONNECT=true;
return true;
catch(UnsupportedOperationException e)
dialog.showMessageDialog(client,"Client with the Same Alias in " + group + " already exists","Error:ChatApplication",JOptionPane.ERROR_MESSAGE);
try{
// UnicastRemoteObject.unexportObject(client,true);
catch(Exception ev){System.out.println(ev.toString());}
catch(Exception e)
dialog.showMessageDialog(client,"Unable to connect to Server","Error:ChatApplication",JOptionPane.ERROR_MESSAGE);
try{
// UnicastRemoteObject.unexportObject(client,true);
catch(Exception ev){System.out.println(ev.toString());}
return false;
public static void main(String args[]) throws RemoteException{
client=new Client();
}//main ends
public void getSound(int count)
Toolkit t1=getToolkit();
for(int i=0;i<count;i++)
t1.beep();
try{
Thread.sleep(500);
catch(Exception e){}
public void setTreeModel()
ImageIcon i1=new ImageIcon("Lock.gif","No Users");
ImageIcon i2=new ImageIcon("Connec.gif","Users in Group");
ImageIcon i3=new ImageIcon("authorbn.gif","An User");
DefaultTreeCellRenderer dr1= new DefaultTreeCellRenderer();
dr1.setClosedIcon(i1);
dr1.setOpenIcon(i2);
dr1.setLeafIcon(i3);
dr1.setTextSelectionColor(java.awt.Color.red);
tree.setCellRenderer(dr1);
//add received files to the list
private void addtoList(Hashtable rfiles)
Enumeration filelist=rfiles.keys();
while(filelist.hasMoreElements())
File file=(File)filelist.nextElement();
this.rfiles.put(file,rfiles.get(file));
//show the attachments received
private void showattach(Hashtable rfiles)
Enumeration filelist=rfiles.keys();
dsource=DragSource.getDefaultDragSource();
JButton b1=null;
while(filelist.hasMoreElements())
File file=(File)filelist.nextElement();
Icon icon=chooser.getIcon(file);
b1=new JButton(icon);
b1.setBackground(java.awt.Color.gray);
b1.setToolTipText(file.getName());
b1.addMouseListener(new AttachmentHandler());
Dimension d1=new Dimension(icon.getIconWidth(),icon.getIconHeight());
b1.setMaximumSize(d1);
hfiles.put(b1,file);
textpanel.setCaretPosition(doc.getLength());
textpanel.insertComponent(b1);
b1.setSize(icon.getIconWidth(),icon.getIconHeight());
dsource.createDefaultDragGestureRecognizer(b1, DnDConstants.ACTION_COPY_OR_MOVE,new DragGestureHandler());
cp.repaint();
private void savefile(File file,Object parent)
//ExtensionFileFilter filter = new ExtensionFileFilter(false);
//filter.addExtension("txt",true);
//chooser.setFileFilter(filter);
int returnVal = chooser.showSaveDialog(client);
if(returnVal ==JFileChooser.APPROVE_OPTION)
try{
FileOutputStream fstream=new FileOutputStream(chooser.getSelectedFile());
//decide whether the file received or sent is to be saved
if(((Container)parent).equals(textArea1))
fstream.write((byte[])files.get(file));
else
fstream.write((byte[])rfiles.get(file));
fstream.close();
System.out.println(file.getName());
catch(Exception e)
{System.out.println(e.toString()); }
private void openfile(File file,Object parent)
File tempfile=null;
try{
String fname=file.getName();
tempfile=File.createTempFile("temp",fname.substring(fname.lastIndexOf(".")));
FileOutputStream fstream=new FileOutputStream(tempfile);
System.out.println(tempfile.getAbsolutePath());
//decide whether the file received or sent is to be saved
if(((Container)parent).equals(textArea1))
fstream.write((byte[])files.get(file));
else
fstream.write((byte[])rfiles.get(file));
fstream.close();
catch(Exception e){System.out.println(e.toString());}
try{
Process p1=r1.exec("cmd /c start " + tempfile.getAbsolutePath());
p1.waitFor();
catch(Exception e){System.out.println(e.toString());}
//inner classes
class ComponentHandler implements ContainerListener{
public void componentRemoved(ContainerEvent ev)
Container cont=(Container)ev.getChild();
if(cont.getComponentCount()>0)
JButton but=(JButton)cont.getComponent(0);
files.remove((File)hfiles.get(but));
hfiles.remove(but);
public void componentAdded(ContainerEvent ev){}
class AttachmentHandler extends MouseAdapter{
public void mouseClicked(MouseEvent ev){
if(ev.getModifiers()==4)
Component comp=(Component)ev.getSource();
File file=(File)hfiles.get(comp);
popup=new JPopupMenu();
JMenuItem popopen=new JMenuItem("Open");
JMenuItem popsave=new JMenuItem("Save As..");
popup.add(popopen);
System.out.println(comp.getParent().getParent().getClass().toString());
popopen.addActionListener(new ButtonHandler(file,comp.getParent().getParent()));
popup.add(popsave);
popsave.addActionListener(new ButtonHandler(file,comp.getParent().getParent()));
popup.show(comp,12,12);
class DragGestureHandler extends Vector implements DragGestureListener,DragSourceListener,Transferable{
final static int FILE = 0;
final static int STRING = 1;
final static int PLAIN = 2;
DataFlavor flavors[] = {DataFlavor.javaFileListFlavor,DataFlavor.stringFlavor,DataFlavor.plainTextFlavor};
public void dragDropEnd(DragSourceDropEvent ev){}
public void dragEnter(DragSourceDragEvent ev){}
public void dragExit(DragSourceEvent ev){}
public void dragOver(DragSourceDragEvent ev){}
public void dropActionChanged(DragSourceDragEvent ev){}
public void dragGestureRecognized(DragGestureEvent ev)
System.out.println("recognized");
File file=(File)hfiles.get(ev.getComponent());
addElement(file);
ev.startDrag(DragSource.DefaultCopyDrop,this,this);
/* Returns the array of flavors in which it can provide the data. */
public synchronized DataFlavor[] getTransferDataFlavors() {
return flavors;
/* Returns whether the requested flavor is supported by this object. */
public boolean isDataFlavorSupported(DataFlavor flavor) {
boolean b = false;
b |=flavor.equals(flavors[FILE]);
b |= flavor.equals(flavors[STRING]);
b |= flavor.equals(flavors[PLAIN]);
return (b);
public synchronized Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException,IOException
if(flavor.equals(flavors[FILE])){return this;}
else if (flavor.equals(flavors[PLAIN])) {
return new StringReader(((File)elementAt(0)).getAbsolutePath());
} else if (flavor.equals(flavors[STRING])) {
return((File)elementAt(0)).getAbsolutePath();
} else {
throw new UnsupportedFlavorException(flavor);
//inner class for draging in the files on java frame
class DragDropHandler implements DropTargetListener{
public void dragEnter(DropTargetDragEvent ev){
public void dragExit(DropTargetEvent ev){
public void dragOver(DropTargetDragEvent ev){
public void drop(DropTargetDropEvent ev){
Transferable tf1=ev.getTransferable();
DataFlavor fl[]=ev.getCurrentDataFlavors();
if(ev.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
ev.acceptDrop (DnDConstants.ACTION_COPY_OR_MOVE);
try{
java.util.List fileList = (java.util.List)tf1.getTransferData(DataFlavor.javaFileListFlavor);
Iterator iterator = fileList.iterator();
while (iterator.hasNext())
File file = (File)iterator.next();
if(file.isFile())
Icon icon=chooser.getIcon(file);
FileInputStream fstream=new FileInputStream(file);
int filedata=(new Double(file.length())).intValue();
byte bytes[]=new byte[filedata];
fstream.read(bytes);
files.put(file,bytes);
ev.getDropTargetContext().dropComplete(true);
addAttach(fileList);
catch(Exception e)
{System.out.println(e.toString() + "here");}
public void dropActionChanged(DropTargetDragEvent ev){
class MouseHandler extends MouseAdapter{
public void mouseClicked(MouseEvent me)
TreePath tp=tree.getPathForLocation(me.getX(),me.getY());
if(tp!=null)
if(tp.getPathCount()==3)
toalias=tp.getPathComponent(2).toString();
togroup=tp.getPathComponent(1).toString();
System.out.println(toalias);
if (!(toalias.equals(fromalias) && togroup.equals(fromgroup)))
System.out.println("hh " + toalias);
label4.setText(tp.getPathComponent(2).toString() + "_@" + tp.getPathComponent(1).toString());
class ButtonHandler implements ActionListener{
private File file;
private Object parent;
//constructors
public ButtonHandler()
public ButtonHandler(File file,Object parent)
this.file=file;
this.parent=parent;
//other functions
public void actionPerformed(ActionEvent ev){
String s=ev.getActionCommand();
System.out.println(s);
if(s.equals("Send with Audio..."))
//Audio audio=new Audio(client,false,"CAPTURE");
if(s.equals("Disconnect"))
try{
// server.disconnect(client);
client.getSound(3);
cp.remove(jsp);
label6.setVisible(false);
//UnicastRemoteObject.unexportObject(client,true);
button3.setLabel("Connect");
textArea2.append("\nYou have been disconnected to Server");
client.repaint();
catch(Exception e)
System.out.println(e.toString());
if(s.equals("Connect"))
// clp=new ClientProperties(client,false);
if(s.equals("Save As.."))
savefile(file,parent);
if(s.equals("Open"))
openfile(file,parent);
if(s.equals("Attach"))
//ExtensionFileFilter filter = new ExtensionFileFilter(false);
//filter.addExtension(".txt",true);
//filter.setDescription("Text Files(.txt)");
// chooser.setFileFilter(filter);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
//chooser.setMultiSelectionEnabled(true);
int returnVal = chooser.showOpenDialog(client);
if(returnVal ==JFileChooser.APPROVE_OPTION)
//File fp[]=chooser.getSelectedFiles();
File fp[]=new File[1];
fp[0]=chooser.getSelectedFile();
int i=0;
while(i<fp.length)
try{
File file=fp;
Icon icon=chooser.getIcon(file);
FileInputStream fstream=new FileInputStream(file);
int filedata=(new Double(file.length())).intValue();
byte bytes[]=new byte[filedata];
fstream.read(bytes);
files.put(file,bytes);
catch(Exception e){dialog.showMessageDialog(client,e.toString(),"Error:ChatApplication",JOptionPane.ERROR_MESSAGE);
return; }
i++;
java.util.List fileList=Arrays.asList(fp);
addAttach(fileList);
if(s.equals("Send"))
try{
if(toalias==null)
dialog.showMessageDialog(client,"Select the Recepient First!!","Error:ChatApplication",JOptionPane.ERROR_MESSAGE);
return;
if(toalias!=null && togroup!=null && (!toalias.equals(fromalias)))
// server.sendMessage(textArea1.getText(),files,toalias,togroup,fromalias,fromgroup);
textArea1.setText("");
catch(Exception e)
e.printStackTrace();
}//if ends
class WindowEventHandler extends WindowAdapter{
public void windowClosing(WindowEvent ev){
try{
//server.disconnect(client);
client.getSound(3);
// UnicastRemoteObject.unexportObject(client,true);
catch(Exception e){System.out.println(e.toString());}
dispose();
private class onshutdown extends Thread{
public void run(){
try{
//server.disconnect(client);
//UnicastRemoteObject.unexportObject(client,true);
catch(Exception e){}
}//run endsHere is the working code :
There was an error line 724
File file=fp; -> File file=fp[0];
Several method were deprecated and try to replace the deprecated static field : DataFlavor.plainTextFlavor which was deprecated since 1.4.
/* Client.java*/
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.rmi.*;
import java.rmi.server.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.filechooser.*;
import java.io.*;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import javax.swing.text.*;
import javax.swing.event.*;
public class Client extends JFrame{
static String newline = System.getProperty("line.separator");
static Client client;
//ServerInterface server;
//ClientProperties clp;
Vector v1=new Vector();
ByteArrayOutputStream out;
Runtime r1;
//file objects,together with array of bytes
Hashtable files=new Hashtable(); //files sent
Hashtable rfiles=new Hashtable(); //files received
//file objects,together with button handlers
Hashtable hfiles=new Hashtable(); //files sent,files received
JButton button1=new JButton();
JButton button2=new JButton();
JButton button3=new JButton();
JLabel label1=new JLabel();
JLabel label2=new JLabel();
JLabel label3=new JLabel();
JLabel label4=new JLabel();
JLabel label5=new JLabel();
JLabel label6=new JLabel();
JLabel label7=new JLabel();
JLabel label8=new JLabel();
JOptionPane dialog=new JOptionPane();
JFileChooser chooser = new JFileChooser();
JPanel panel1;
JPanel panel2;
DropTarget dtarget;
DragSource dsource;
JTextPane textArea1=new JTextPane();
TextArea textArea2=new TextArea();
JTextPane textpanel=new JTextPane();
Style defstyle,style;
StyledDocument doc,doc1;
JPopupMenu popup;
JTree tree;
JScrollPane jsppane;
JScrollPane jsp,jsp2;
DefaultMutableTreeNode top;
Container cp;
private String toalias;
private String togroup;
private String fromalias;
private String fromgroup;
private boolean CONNECT;
public Client()
cp=getContentPane();
cp.setLayout(null);
setForeground(java.awt.Color.red);
setFont(new Font("Dialog", Font.PLAIN, 14));
setVisible(false);
label1.setText(" CHAT APPLICATION");
cp.add(label1);
label1.setFont(new Font("Dialog", Font.BOLD, 16));
label1.setBounds(72,20,319,30);
label2.setText("List of Users Connected.");
cp.add(label2);
label2.setForeground(java.awt.Color.blue);
label2.setFont(new Font("Dialog", Font.BOLD, 12));
label2.setBounds(24,60,192,26);
label8.setBounds(280,60,100,26);
cp.add(label8);
cp.add(textArea2);
textArea2.setBounds(204,120,268,90);
jsppane=new JScrollPane(textArea1);
doc1=textArea1.getStyledDocument();
jsppane.setBounds(12,264,456,109);
cp.add(jsppane);
label3.setText("TO::");
cp.add(label3);
label3.setFont(new Font("Dialog", Font.BOLD, 12));
label3.setBounds(12,228,36,20);
cp.add(label4);
label4.setBackground(java.awt.Color.lightGray);
label4.setBounds(60,228,172,19);
label5.setText("SERVER RESPONSE");
cp.add(label5);
label5.setFont(new Font("Dialog", Font.BOLD, 12));
label5.setBounds(204,96,204,21);
label7.setText("MESSAGE FOR YOU.");
cp.add(label7);
label7.setFont(new Font("Dialog", Font.BOLD, 14));
label7.setBounds(12,371,288,25);
jsp2=new JScrollPane(textpanel);
setTextPaneStyle();
jsp2.setBounds(12,401,456,109);
cp.add(jsp2);
button1.setText("Send");
button1.setEnabled(false);
cp.add(button1);
button1.setBackground(java.awt.Color.lightGray);
button1.setForeground(java.awt.Color.black);
button1.setFont(new Font("Dialog", Font.BOLD|Font.ITALIC, 10));
button1.setBounds(60,520,78,36);
button2.setText("Attach");
//button2.setEnabled(false);
cp.add(button2);
button2.setBackground(java.awt.Color.lightGray);
button2.setForeground(java.awt.Color.black);
button2.setFont(new Font("Dialog", Font.BOLD|Font.ITALIC, 10));
button2.setBounds(180,520,72,36);
button3.setText("Connect");
cp.add(button3);
button3.setBackground(java.awt.Color.lightGray);
button3.setForeground(java.awt.Color.black);
button3.setFont(new Font("Dialog", Font.BOLD|Font.ITALIC, 10));
button3.setBounds(288,520,72,33);
setSize(500,620);
show();
addWindowListener(new WindowEventHandler());
button1.addActionListener(new ButtonHandler());
button2.addActionListener(new ButtonHandler());
button3.addActionListener(new ButtonHandler());
textArea1.addContainerListener(new ComponentHandler());
dtarget=new DropTarget(textArea1,new DragDropHandler());
textArea2.setEnabled(false);
textpanel.setEnabled(false);
r1=Runtime.getRuntime();
r1.addShutdownHook(new onshutdown());
addMenu();
cp.repaint();
//adds attachments to the textArea1
synchronized private void addAttach(java.util.List fileList)
Iterator iterator=fileList.iterator();
JButton bw;
while(iterator.hasNext())
File file=(File)iterator.next();
Icon icon=chooser.getIcon(file);
bw=new JButton(icon);
bw.setBackground(java.awt.Color.gray);
bw.setToolTipText(file.getAbsolutePath());
bw.addMouseListener(new AttachmentHandler());
Dimension d1=new Dimension(icon.getIconWidth(),icon.getIconHeight());
bw.setMaximumSize(d1);
hfiles.put(bw,file);
textArea1.insertComponent(bw);
textArea1.setCaretPosition(doc1.getLength());
bw.setSize(icon.getIconWidth(),icon.getIconHeight());
//only one file at a time
break;
cp.repaint();
public void setAudioStream(ByteArrayOutputStream out)
this.out=out;
private void addMenu()
JMenuBar mbar=new JMenuBar();
mbar.setVisible(true);
mbar.setBounds(0,0,500,20);
mbar.setBackground(java.awt.Color.gray);
//first menu
JMenu m1=new JMenu("Connection");
m1.setBounds(0,0,80,20);
m1.setBackground(java.awt.Color.gray);
JMenuItem mitem1=new JMenuItem("Connect");
JMenuItem mitem2=new JMenuItem("Disconnect");
m1.add(mitem1);
m1.add(mitem2);
mitem1.addActionListener(new ButtonHandler());
mitem2.addActionListener(new ButtonHandler());
mbar.add(m1);
//second menu
JMenu m2=new JMenu("Send...");
m2.setBounds(90,0,80,20);
m2.setBackground(java.awt.Color.gray);
JMenuItem mitem3=new JMenuItem("Send");
JMenuItem mitem4=new JMenuItem("Send with Audio...");
mitem3.addActionListener(new ButtonHandler());
mitem4.addActionListener(new ButtonHandler());
m2.add(mitem3);
m2.add(mitem4);
mbar.add(m2);
cp.add(mbar);
private void setTextPaneStyle()
StyleContext stylecontext =StyleContext.getDefaultStyleContext();
defstyle=stylecontext.getStyle(StyleContext.DEFAULT_STYLE);
doc= textpanel.getStyledDocument();
//style 1
style= textpanel.addStyle("bold",defstyle);
StyleConstants.setBackground(style,Color.white);
StyleConstants.setForeground(style,Color.blue);
StyleConstants.setItalic(style, false);
StyleConstants.setBold(style, true);
StyleConstants.setFontSize(style,16);
//style 2
style= textpanel.addStyle("normal",defstyle);
StyleConstants.setBackground(style,Color.white);
StyleConstants.setForeground(style,Color.black);
StyleConstants.setItalic(style, false);
StyleConstants.setBold(style, false);
StyleConstants.setFontSize(style,14);
//style3
style= textpanel.addStyle("attach",defstyle);
StyleConstants.setBackground(style,Color.white);
StyleConstants.setForeground(style,Color.red);
StyleConstants.setItalic(style, true);
StyleConstants.setBold(style, false);
StyleConstants.setFontSize(style,12);
//remote method called by server
public void addClient(String alias,String group,JTree tree)
//if old client remove old tree
if(!alias.equals(""))
cp.remove(this.jsp);
//add new tree
this.tree=tree;
setTreeModel();
getSound(2);
if(!alias.equals(""))
textArea2.append("\nNew Client:" + alias + "has joined");
else
textArea2.append("\nYou have been connected to the Server.");
jsp=new JScrollPane(this.tree);
jsp.setBounds(12,96,168,120);
jsp.setBackground(java.awt.Color.lightGray);
cp.add(jsp);
this.tree.addMouseListener(new MouseHandler());
//remote method called by server
public void sendMessage(String str,Hashtable rfiles,String alias,String group) throws RemoteException
receiveMessage(str,rfiles,alias,group);
//remote method called by server
public void removeClient(JTree tree,String alias,String group) throws RemoteException
cp.remove(this.jsp);
this.tree=tree;
setTreeModel();
getSound(3);
jsp=new JScrollPane(this.tree);
jsp.setBounds(12,96,168,120);
jsp.setBackground(java.awt.Color.lightGray);
cp.add(jsp);
this.tree.addMouseListener(new MouseHandler());
textArea2.append("\nClient:" + alias + "has disconnected");
private void receiveMessage(String str,Hashtable rfiles,String alias,String group)
boolean flag=true;
UIManager.put("JFrame.activeTitleBackground", new Color(64,128,255));
UIManager.put("JFrame.activeTitleForeground", Color.white);
UIManager.put("JFrame.inactiveTitleBackground", new Color(128,128,128));
UIManager.put("JFrame.inactiveTitleForeground", Color.black);
SwingUtilities.updateComponentTreeUI(this);
try{
if(alias.equals(""))
doc.insertString(doc.getLength(),"CHATMASTER>>",textpanel.getStyle("bold"));
doc.insertString(doc.getLength(),str+ newline,textpanel.getStyle("normal"));
else
doc.insertString(doc.getLength(),alias + "@" + group + ">>",textpanel.getStyle("bold"));
doc.insertString(doc.getLength(),str,textpanel.getStyle("normal"));
//add files to textpanel
if(rfiles!=null && rfiles.size()>0)
doc.insertString(doc.getLength(),newline+"Attachments>>",textpanel.getStyle("attach"));
showattach(rfiles);
addtoList(rfiles);
doc.insertString(doc.getLength(),newline,textpanel.getStyle("normal"));
catch(Exception e)
e.printStackTrace();
dialog.showMessageDialog(client,e.toString(),"Error:ChatApplication",JOptionPane.ERROR_MESSAGE);
cp.repaint();
protected boolean ContactServer(String alias,String servername,String group)
try{
//UnicastRemoteObject.exportObject(this);
//server=(ServerInterface)Naming.lookup("//gpt02d05:5500/" + servername);
// server.notifyMe(this,alias,group);
//change the settings of buttons
button1.setEnabled(true);
button2.setEnabled(true);
button3.setText("Disconnect");
label8.setVisible(true);
label8.setText(" Welcome::" + alias);
//putting values of alias and group for sending messages
fromalias=alias;
fromgroup=group;
CONNECT=true;
return true;
catch(UnsupportedOperationException e)
dialog.showMessageDialog(client,"Client with the Same Alias in " + group + " already exists","Error:ChatApplication",JOptionPane.ERROR_MESSAGE);
try{
// UnicastRemoteObject.unexportObject(client,true);
catch(Exception ev){System.out.println(ev.toString());}
catch(Exception e)
dialog.showMessageDialog(client,"Unable to connect to Server","Error:ChatApplication",JOptionPane.ERROR_MESSAGE);
try{
// UnicastRemoteObject.unexportObject(client,true);
catch(Exception ev){System.out.println(ev.toString());}
return false;
public static void main(String args[]) throws RemoteException{
client=new Client();
}//main ends
public void getSound(int count)
Toolkit t1=getToolkit();
for(int i=0;i<count;i++)
t1.beep();
try{
Thread.sleep(500);
catch(Exception e){}
public void setTreeModel()
ImageIcon i1=new ImageIcon("Lock.gif","No Users");
ImageIcon i2=new ImageIcon("Connec.gif","Users in Group");
ImageIcon i3=new ImageIcon("authorbn.gif","An User");
DefaultTreeCellRenderer dr1= new DefaultTreeCellRenderer();
dr1.setClosedIcon(i1);
dr1.setOpenIcon(i2);
dr1.setLeafIcon(i3);
dr1.setTextSelectionColor(java.awt.Color.red);
tree.setCellRenderer(dr1);
//add received files to the list
private void addtoList(Hashtable rfiles)
Enumeration filelist=rfiles.keys();
while(filelist.hasMoreElements())
File file=(File)filelist.nextElement();
this.rfiles.put(file,rfiles.get(file));
//show the attachments received
private void showattach(Hashtable rfiles)
Enumeration filelist=rfiles.keys();
dsource=DragSource.getDefaultDragSource();
JButton b1=null;
while(filelist.hasMoreElements())
File file=(File)filelist.nextElement();
Icon icon=chooser.getIcon(file);
b1=new JButton(icon);
b1.setBackground(java.awt.Color.gray);
b1.setToolTipText(file.getName());
b1.addMouseListener(new AttachmentHandler());
Dimension d1=new Dimension(icon.getIconWidth(),icon.getIconHeight());
b1.setMaximumSize(d1);
hfiles.put(b1,file);
textpanel.setCaretPosition(doc.getLength());
textpanel.insertComponent(b1);
b1.setSize(icon.getIconWidth(),icon.getIconHeight());
dsource.createDefaultDragGestureRecognizer(b1, DnDConstants.ACTION_COPY_OR_MOVE,new DragGestureHandler());
cp.repaint();
private void savefile(File file,Object parent)
//ExtensionFileFilter filter = new ExtensionFileFilter(false);
//filter.addExtension("txt",true);
//chooser.setFileFilter(filter);
int returnVal = chooser.showSaveDialog(client);
if(returnVal ==JFileChooser.APPROVE_OPTION)
try{
FileOutputStream fstream=new FileOutputStream(chooser.getSelectedFile());
//decide whether the file received or sent is to be saved
if(((Container)parent).equals(textArea1))
fstream.write((byte[])files.get(file));
else
fstream.write((byte[])rfiles.get(file));
fstream.close();
System.out.println(file.getName());
catch(Exception e)
{System.out.println(e.toString()); }
private void openfile(File file,Object parent)
File tempfile=null;
try{
String fname=file.getName();
tempfile=File.createTempFile("temp",fname.substring(fname.lastIndexOf(".")));
FileOutputStream fstream=new FileOutputStream(tempfile);
System.out.println(tempfile.getAbsolutePath());
//decide whether the file received or sent is to be saved
if(((Container)parent).equals(textArea1))
fstream.write((byte[])files.get(file));
else
fstream.write((byte[])rfiles.get(file));
fstream.close();
catch(Exception e){System.out.println(e.toString());}
try{
Process p1=r1.exec("cmd /c start " + tempfile.getAbsolutePath());
p1.waitFor();
catch(Exception e){System.out.println(e.toString());}
//inner classes
class ComponentHandler implements ContainerListener{
public void componentRemoved(ContainerEvent ev)
Container cont=(Container)ev.getChild();
if(cont.getComponentCount()>0)
JButton but=(JButton)cont.getComponent(0);
files.remove((File)hfiles.get(but));
hfiles.remove(but);
public void componentAdded(ContainerEvent ev){}
class AttachmentHandler extends MouseAdapter{
public void mouseClicked(MouseEvent ev){
if(ev.getModifiers()==4)
Component comp=(Component)ev.getSource();
File file=(File)hfiles.get(comp);
popup=new JPopupMenu();
JMenuItem popopen=new JMenuItem("Open");
JMenuItem popsave=new JMenuItem("Save As..");
popup.add(popopen);
System.out.println(comp.getParent().getParent().getClass().toString());
popopen.addActionListener(new ButtonHandler(file,comp.getParent().getParent()));
popup.add(popsave);
popsave.addActionListener(new ButtonHandler(file,comp.getParent().getParent()));
popup.show(comp,12,12);
class DragGestureHandler extends Vector implements DragGestureListener,DragSourceListener,Transferable{
final static int FILE = 0;
final static int STRING = 1;
final static int PLAIN = 2;
DataFlavor flavors[] = {DataFlavor.javaFileListFlavor,DataFlavor.stringFlavor,DataFlavor.plainTextFlavor};
public void dragDropEnd(DragSourceDropEvent ev){}
public void dragEnter(DragSourceDragEvent ev){}
public void dragExit(DragSourceEvent ev){}
public void dragOver(DragSourceDragEvent ev){}
public void dropActionChanged(DragSourceDragEvent ev){}
public void dragGestureRecognized(DragGestureEvent ev)
System.out.println("recognized");
File file=(File)hfiles.get(ev.getComponent());
addElement(file);
ev.startDrag(DragSource.DefaultCopyDrop,this,this);
/* Returns the array of flavors in which it can provide the data. */
public synchronized DataFlavor[] getTransferDataFlavors() {
return flavors;
/* Returns whether the requested flavor is supported by this object. */
public boolean isDataFlavorSupported(DataFlavor flavor) {
boolean b = false;
b |=flavor.equals(flavors[FILE]);
b |= flavor.equals(flavors[STRING]);
b |= flavor.equals(flavors[PLAIN]);
return (b);
public synchronized Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException,IOException
if(flavor.equals(flavors[FILE])){return this;}
else if (flavor.equals(flavors[PLAIN])) {
return new StringReader(((File)elementAt(0)).getAbsolutePath());
} else if (flavor.equals(flavors[STRING])) {
return((File)elementAt(0)).getAbsolutePath();
} else {
throw new UnsupportedFlavorException(flavor);
//inner class for draging in the files on java frame
class DragDropHandler implements DropTargetListener{
public void dragEnter(DropTargetDragEvent ev){
public void dragExit(DropTargetEvent ev){
public void dragOver(DropTargetDragEvent ev){
public void drop(DropTargetDropEvent ev){
Transferable tf1=ev.getTransferable();
DataFlavor fl[]=ev.getCurrentDataFlavors();
if(ev.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
ev.acceptDrop (DnDConstants.ACTION_COPY_OR_MOVE);
try{
java.util.List fileList = (java.util.List)tf1.getTransferData(DataFlavor.javaFileListFlavor);
Iterator iterator = fileList.iterator();
while (iterator.hasNext())
File file = (File)iterator.next();
if(file.isFile())
Icon icon=chooser.getIcon(file);
FileInputStream fstream=new FileInputStream(file);
int filedata=(new Double(file.length())).intValue();
byte bytes[]=new byte[filedata];
fstream.read(bytes);
files.put(file,bytes);
ev.getDropTargetContext().dropComplete(true);
addAttach(fileList);
catch(Exception e)
{System.out.println(e.toString() + "here");}
public void dropActionChanged(DropTargetDragEvent ev){
class MouseHandler extends MouseAdapter{
public void mouseClicked(MouseEvent me)
TreePath tp=tree.getPathForLocation(me.getX(),me.getY());
if(tp!=null)
if(tp.getPathCount()==3)
toalias=tp.getPathComponent(2).toString();
togroup=tp.getPathComponent(1).toString();
System.out.println(toalias);
if (!(toalias.equals(fromalias) && togroup.equals(fromgroup)))
System.out.println("hh " + toalias);
label4.setText(tp.getPathComponent(2).toString() + "_@" + tp.getPathComponent(1).toString());
class ButtonHandler implements ActionListener{
private File file;
private Object parent;
//constructors
public ButtonHandler()
public ButtonHandler(File file,Object parent)
this.file=file;
this.parent=parent;
//other functions
public void actionPerformed(ActionEvent ev){
String s=ev.getActionCommand();
System.out.println(s);
if(s.equals("Send with Audio..."))
//Audio audio=new Audio(client,false,"CAPTURE");
if(s.equals("Disconnect"))
try{
// server.disconnect(client);
client.getSound(3);
cp.remove(jsp);
label6.setVisible(false);
//UnicastRemoteObject.unexportObject(client,true);
button3.setText("Connect");
textArea2.append("\nYou have been disconnected to Server");
client.repaint();
catch(Exception e)
System.out.println(e.toString());
if(s.equals("Connect"))
// clp=new ClientProperties(client,false);
if(s.equals("Save As.."))
savefile(file,parent);
if(s.equals("Open"))
openfile(file,parent);
if(s.equals("Attach"))
//ExtensionFileFilter filter = new ExtensionFileFilter(false);
//filter.addExtension(".txt",true);
//filter.setDescription("Text Files(.txt)");
// chooser.setFileFilter(filter);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
//chooser.setMultiSelectionEnabled(true);
int returnVal = chooser.showOpenDialog(client);
if(returnVal ==JFileChooser.APPROVE_OPTION)
//File fp[]=chooser.getSelectedFiles();
File fp[]=new File[1];
fp[0]=chooser.getSelectedFile();
int i=0;
while(i<fp.length)
try{
File file=fp[0];
Icon icon=chooser.getIcon(file);
FileInputStream fstream=new FileInputStream(file);
int filedata=(new Double(file.length())).intValue();
byte bytes[]=new byte[filedata];
fstream.read(bytes);
files.put(file,bytes);
catch(Exception e){dialog.showMessageDialog(client,e.toString(),"Error:ChatApplication",JOptionPane.ERROR_MESSAGE);
return; }
i++;
java.util.List fileList=Arrays.asList(fp);
addAttach(fileList);
if(s.equals("Send"))
try{
if(toalias==null)
dialog.showMessageDialog(client,"Select the Recepient First!!","Error:ChatApplication",JOptionPane.ERROR_MESSAGE);
return;
if(toalias!=null && togroup!=null && (!toalias.equals(fromalias)))
// server.sendMessage(textArea1.getText(),files,toalias,togroup,fromalias,fromgroup);
textArea1.setText("");
catch(Exception e)
e.printStackTrace();
}//if ends
class WindowEventHandler extends WindowAdapter{
public void windowClosing(WindowEvent ev){
try{
//server.disconnect(client);
client.getSound(3);
// UnicastRemoteObject.unexportObject(client,true);
catch(Exception e){System.out.println(e.toString());}
dispose();
private class onshutdown extends Thread{
public void run(){
try{
//server.disconnect(client);
//UnicastRemoteObject.unexportObject(client,true);
catch(Exception e){}
}//run ends
I hope this helps,
Denis -
Please tell me whats wrong with this code for sendRedirect
/**AckController.java**/
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.sql.*;
import java.util.*;
* @version 1.0
* @author
public class AckController extends HttpServlet {
* @see javax.servlet.http.HttpServlet#void (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("in AckController.doGet():action: "+req.getParameter("action"));
String viewName = "";
viewName = "/TransportersLogin/jsp/dealerAck/DealerAddAck.jsp";
req.setAttribute("temp","temp");
System.out.println("1..in AckController.doGet():viewName: "+viewName);
resp.sendRedirect(viewName);
* @see javax.servlet.http.HttpServlet#void (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req,resp);
/*********end of servlet**********/
/****DealerAddAck.jsp****/
<%@ page session="true" language="java" %>
<%@ page import="javax.servlet.*,javax.servlet.http.*,java.net.*"%>
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
response.setHeader("Pragma","no-cache"); //HTTP 1.0
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<link rel="stylesheet" href="/TransportersLogin/theme/stylesecure.css">
<%
out.println("in jsp");
out.println("in jsp: temp value: "+(String)request.getAttribute("temp"));
%>
<script>
function consolidate()
alert("wait");
//document.forms[0].action = "DealerConfirmAck.html";
//document.forms[0].submit();
</script>
</head>
<body>
<form name="frmaddclaim">
<table border="0" cellpadding="3" cellspacing="1" width="100%">
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td class="TDHeader" height="18" colspan="2">Add Acknowledgement Receipt</td>
</tr>
<tr>
<td class="TDcolorgreybold" height="18" align="left">
Available Invoices
</td>
</tr>
</table>
<table width="100%" border="0" height="26" cellpadding="3" cellspacing="0">
<tr>
<td class="tdheader" colspan="2" height="22" align="right">
<input type="button" value="Add Receipt" name="B3" onClick="javascript:consolidate();"></td>
</tr>
</table>
<table width="100%" border="0" height="26" cellpadding="3" cellspacing="0" align="left">
<tr>
<td class="labeltextRed" height="18" align="left">Select an Invoice from the
list and click "Add Receipt". </td>
</tr>
</table>
</form>
</body>
</html>I am trying to set an attribute in the request object (attribute name is temp). But in the jsp it is not getting the value of the attribute. The request is not getting transferred. Please let me know what correction is needed.
I have used RequestDispatcher as well but in that case the control doesnt go the jsp when i used sendRedirect the control goes only if there isnt any request.getattribute in the JSP page.
Thanks
NikeshYou can;t transfer the request object using response.sendRedirect;
Use RequestDispatcher to transfer the request object into another page.
For Example:
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(viewName);
dispatcher.include(req, resp); -
I upgraded to 5.0 and now I can't take advantage of the 'all in one click' feature.
See:
*[/questions/840221] -
As mentioned in the subject line: my Mid 2009 MBA freezes frequently. The hardware test provides the error code.
It sounds like a failed RAM but it still works when booted.
Can anybody tell me what was wrong with this MBA and what else can I do to save it?
Thanks!Welcome to the Apple Support Communities
That's a RAM issue. If you want, you can still use your Mac until it gets damaged, but that message tells something bad with your RAM, and what it's worse, the RAM in the MacBook Air is soldered onto the logic board, so if you take the Mac to an Apple Store or reseller to get it repaired, the whole logic board will have to be replaced, making this repair so expensive -
When i try to start itunes i get a message saying that the MSVCR80.dll file is missing and to reinstall itunes. When I try to reinstall itunes it tells me that I have an Error 7 (windows error 126). Can anybody tell me what this means? Thanks
Go to Control Panel > Add or Remove Programs (Win XP) or Programs and Features (later)
Remove all of these items in the following order:
iTunes
Apple Software Update
Apple Mobile Device Support (if this won't uninstall move on to the next item)
Bonjour
Apple Application Support
Reboot, download iTunes, then reinstall, either using an account with administrative rights, or right-clicking the downloaded installer and selecting Run as Administrator.
The uninstall and reinstall process will preserve your iTunes library and settings, but ideally you would back up the library and your other important personal documents and data on a regular basis. See this user tip for a suggested technique.
Please note:
Some users may need to follow all the steps in whichever of the following support documents applies to their system. These include some additional manual file and folder deletions not mentioned above.
HT1925: Removing and Reinstalling iTunes for Windows XP
HT1923: Removing and reinstalling iTunes for Windows Vista, Windows 7, or Windows 8
tt2 -
Hi,
as of today I can't access Gmail via Apple Mail anymore. Last night I updated on Macbook Pro and ipad, and both don't allow me to access gmail anymore. Gmail still works on my iphone, I guess, because I didn't update that one.
Can anybody tell me what happended and how to fix it?
Thx
ChrisChrisK21,
Make sure your settings match up with this:
http://support.google.com/mail/bin/answer.py?hl=en&answer=180188
if wouldn't hurt to delete the account entirely and just re-set it up in preferences. -
My ipad mini keeps on crashing when i play games (eversince i updated it)...can anybody tell me what i need to do to prevent this?
_Jet wrote:
My ipad mini keeps on crashing when i play games (eversince i updated it)...can anybody tell me what i need to do to prevent this?
Try this First...
Close All Open Apps... Sign Out of your Account,,,, Perform a Reset... Try again...
Reset ( No Data will be Lost )
Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
http://support.apple.com/kb/ht1430
If no joy...
Connect to iTunes on the computer you usually Sync with and “ Restore “...
http://support.apple.com/kb/HT1414
Note:
Also consider Deleting any Apps you have Purchased / Downloaded but you now never use.. -
my ipod had a full battery but when i took it off charge and put my earphones in it, it went completly dead and hasnt come back on. Can anybody tell me what is wrong and how to fix it?
Try here to fix it. I doubt that you will ever find out why it did that.
iPod touch: Hardware troubleshooting -
Updating iphone 4 to iOS 5 - while doing the Backup I receive an error message no 402636788 - backup has failed. Can anybody tell me what this means or how I can fix this?
I am working on a Win 7 Machine and I have disabled all Firewall and Antivirus Tasks as this caused problems on an other update.Well - I synced before - that was successful - but I am a bit scared to ignore this error and just to continue? You think I should ignore that?
-
When laptop booths there is a folder with a question mark. Can someone tell me whats wrong?
The Mac cannot find the hard drive or a valid boot folder.
You can try to reboot with Command and R and hold down until you see recovery partition. Launch that and then in the menu bar at the top look for Disk Utilities. Run that and see what it says when you scan your hard drive,
Any errors there are bad. If it can't even read the drive that is worse.
I suspect with the ? issue you will be reformatting and reinstalling OS X after getting a new hard drive. -
select CASE WHEN TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0 AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)||'00',SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),'DD-MM-YYYY HH24:MI:SS') end
from table;
i have written this query.whats wrong with this query..........
the error is "literal does not match format string"
Reegards soumenWhy does your date_format loose, ununify and not fix ?
And what is your exact requirement?
>>
CASE WHEN
TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0
AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
<<
This is
CASE WHEN TO_CHAR(START_TIME_TIMESTAMP,'MM') between '01' and '13'
>>
THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)
||'00',
SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),
'DD-MM-YYYY HH24:MI:SS')
<<
This is
TO_DATE(
TO_CHAR(START_TIME_TIMESTAMP,'MM"00"SS"00"),
'DD-MM-YYYY HH24:MI:SS')
Obviously, format is not matching !
SQL> select to_char(sysdate,'MM"00"SS"00') from dual;
TO_CHAR(
06004900
SQL> select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual;
select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual
ERROR at line 1:
ORA-01861: literal does not match format string -
I have a video that has sound, I brought it into afteraffects, made a composition and made some changes. I exported the composition (rendered it) for quick time to edit in photoshop - the video is about 7 minutes.
Playing the video there is no sound....why?
Bringing the video into photoshop for editing with content aware fill creates 500+ frames......is that normal?
also whats the easiest way to move between aftereffects and photoshop in terms of editing frames? can I make changes in photoshop and watch it update in after effects?What wrong with this?
Everything! Sorry, it's simply the most ill-conceived workflow I could imagine.
Playing the video there is no sound....why?
http://forums.adobe.com/thread/426347?tstart=0
Bringing the video into photoshop for editing with content aware fill creates 500+ frames......is that normal?
Yes. All video editing in PS is limited to 500 or 1000 frames, repsectively. There is no way to extend that range. Read the PS help!
also whats the easiest way to move between aftereffects and photoshop in terms of editing frames?
You don't. What you have in mind won't work, anyways. Content Aware Fill only works per frame and has no temporal stabilization, so each frame will have a different pattern and the resulting animation would flicker and wobble.
can I make changes in photoshop and watch it update in after effects?
That's what use File --> Reload Footage for or simply close and reopen the project.
Mylenium -
I have just purchased the ipad and trying to log onto itunes and it tells me I am not connected . i typed in my apple sign on and it states cannot connect to itunes store. Can anyone tell me whats wrong?
I'm sort of confused by your response. Did your iPad start up? If I DO understand - you are frozen on the sign in setting for the Store?
Try this - force quit the settings app.
Force quit the app by holding down on the sleep button until the red slider appears. Let go of the sleep button and then hold down on the home button until the app quits. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
Maybe you are looking for
-
Where can I buy a new 5D mark ii ?
I want another new 5D Mark ii but am leary to buy from just any store. Can someone suggest a dealer, store, or website that they know is trustworthy?
-
Modifying a section's primary page template through API
Hi all, I'm trying to remove the association between a placeholder on a given section and its data file from a remote machine (running automated tests). Using JDeveloper, I open the site structure, find the section, and update the Primary Page to rem
-
Dialog process vs Background process
Hi, What is the difference between dialog and background process? Can a dialog process is used in a process chain? Does an ABAP program followed by change run be a dialog process or background process in a process chain? What is the standard maximum
-
"Invalid Metadata Objects" when creating materialized views
Hi experts, I have run into some trouble. I had an analytic workspace that grew too fast (see 11.2.0.2 AW size grows steadily with every cube build so I deleted it and created a new one. It seemed to build fine using the tip that David Greenfield gav
-
Dear All , our's is the 100 % EOU unit . Pl guide for following : 1) Which material need to go entry in duty free register , like CT3 type is any other type is there against we can receive the duty free material . 2) In above all cases , How the syst