Rawat (Zeon)

Greenhorn
+ Follow
since Feb 12, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rawat (Zeon)

Hi Joe,


The problem with the following line of code is that it is concating the tdaysDateYearTemp and "Calendar." + todayDateMonth + ", " + todaysDateDayTemp.


Calendar todaysDate1 = new GregorianCalendar(todaysDateYearTemp + ", Calendar." + todaysDateMonth + ", " + todaysDateDayTemp);


Change it to :

Calendar todaysDate1 = new GregorianCalendar(todaysDateYearTemp ,("Calendar." + todaysDateMonth),todaysDateDayTemp);


-Zeon
16 years ago
Hi Adam,

What I think that you need to send the byte array also to the server from client. I did like to look at your client code before I could say anything else on it.

-Zeon
16 years ago
Hi Dave,


To reslove ths issue I had to add few lines of code to the following two files. The class headers are same.

1. myCircle.java
2. myFrame.java


Code for myCircle.java

// ----------------- Code for myCircle.java --------------------------------
import java.awt.*;
import javax.swing.*;
public class myCircle extends myShape
{
int shapeWidth;
int shapeHeight;
int pad =5;
public myCircle(int w, int h)
{
super();
shapeWidth=w;
shapeHeight=h;
setSize(w,h);
setBorder(BorderFactory.createEmptyBorder(this.pad,
this.pad,
this.pad,
this.pad));
System.out.println("in myCircle constructor");
}
protected void paintComponent(Graphics g)
{
if (isOpaque()) { //paint background
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
}
g.setColor(Color.red);
g.fillOval(0,0,shapeWidth,shapeHeight);
}



public Dimension getPreferredSize() {

return new Dimension(shapeWidth, shapeHeight);
}

public Dimension getMinimumSize() {

return new Dimension(shapeWidth, shapeHeight);

}


}


// --------------------- End of myCircle.java ------------------



Code for myFrame.java

// ----------------------- Code for myFrame.java ---------------------


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.lang.Integer;
public class myFrame extends JFrame implements ActionListener {
JButton jButtonCir = new JButton();JPanel myPanel = new JPanel();public myFrame()
{
jButtonCir.setLocation(160, 320);
jButtonCir.setSize(110, 40);
jButtonCir.setVisible(true);
jButtonCir.setText("Circle");
jButtonCir.addActionListener(this);
myPanel.setBackground(Color.white);
myPanel.setLocation(10, 10);
myPanel.setSize(433,295);
myPanel.setVisible(true);
getContentPane().add(jButtonCir);
getContentPane().add(myPanel);
getContentPane().setLayout(null);
setLocation(0, 0);
setTitle("myFrame");
setSize(460, 480);

addWindowListener(new java.awt.event.WindowAdapter()
{
public void windowClosing(java.awt.event.WindowEvent e) {
setVisible(false);
dispose();
System.exit(0);
}});
}
public void actionPerformed( ActionEvent ae) {
if(ae.getSource()==jButtonCir){
myCircle circle=new myCircle(50,50);
circle.setLocation(160,350);
circle.setVisible(true);
getContentPane().add(circle);
repaint();
System.out.println("button pressed");
}
}
}


// ------------------- end of myFrame.java ----------------------


Do go to the following link to know more about Custom JComponents

http://java.sun.com/docs/books/tutorial/uiswing/14painting/practice.html


-Zeon
16 years ago
Hi

If it's just copying a file from one folder to another you can use copy method given below.


// Copies src file to dst file.
// If the dst file does not exist, it is created
void copy(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);

// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}

Thank,
Zeon
16 years ago
Hi

Try to use the following code and see if it works

Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = st.executeQuery(query);
if(rs.next()) {
if(rs.absolute(y)) // this throws SQLException check JDK API's
{
// get data
} // end of if
else
// row doesn't exsist
} // end of else
} // end of outer if