|
That was done ages ago by Pete.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Something new is hard to find - good luck on that.
But also if you do something that is already available in other form - why not improve it and make it a better tool?
regards Torsten
I never finish anyth...
|
|
|
|
|
Pick one of your subject which more prefer during your studies. Try to map the concepts you learned with the nature. I am sure you can find a new idea for the project. Exactly I did the same and it works.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
|
When you search and find something, then definitely it won't be new!
-Shenbaga Murugan Paramasivapandian
I hate computers and I just mess them up with my code!
|
|
|
|
|
Hi,
My web page runs a signed applet when loaded. After a user clicks a button on that page it makes the applet control Visible='false' and makes another signed applet Visible='true'.
When the first applet initially loads with the web page I am asked for permission to run signed applet but when the second one is loaded I don't see such security dialog box and I think that's why it don't work properly.
Is there any way to force that security dialog box on the second applet or to completely unload the first one (with JVM together?)?
Thanks.
|
|
|
|
|
Hello,
I have a signed applet. a web page (asks for permissions and) loads and the applet and performs some information processing and writes data to a text file.
Then the web page refreshes a few components and gives the applet a different CSS class (to move it to other position on the page) and the applet reloads, reads data from file and must load it as html into JTextPane.
The problem: when the applet reloads it is given a parameter from html code. This way it knows the now it must display the information to the JTextPane as a list of links in html format. But the JTextPane displays nothing.
I tried to load the html as a simple text and it worked. I also tried to run the applet with the parameter to display data from the very start (when webpage asks for permission to run the applet) and it worked.
So in short I the problem is that when the applet initializes and loads data from the start everything is fine but if it first performs inf. processing and then reloads it cant display html in JTextPane.
I am using javax.swing.JApplet; for applet.
This is the initialization of the applet. It starts the applet as a thread.
<pre lang="java">
public void init() {
try {
jbInit();
new Thread(this, "processFunctionThread").start();
</pre>
jbInit() builds/adds visulal components on the applet.
<pre lang="java">
displayEditorPane = new JEditorPane();
displayEditorPane.setContentType("text/html");
displayEditorPane.setEditable(true);
displayEditorPane.addHyperlinkListener(this);
displayEditorPane.setBounds(new Rectangle(10, 10, 260, 365));
displayEditorPane.setContentType("text/html");
dataScrolling = new JScrollPane(displayEditorPane);
dataScrolling.setBounds(new Rectangle(10, 10, 260, 365));
dataScrolling.setVisible(true);</pre>
public void run() has the main function that (depending on the passed from html parameter) performs actions.
<pre lang="java">
if ( getParameter("scan").equals("doscan") ) {
// performs initial information processing
} else if(getParameter("scan").equals("scanresults")) {
// after the web page gives the applet a different css class it reloads and displays data to JTextPane.
}
</pre>
It's the same either with JEditorPane or with JTextPane.
Please, help me! Thanks
|
|
|
|
|
I need to forma network with 4 hosts and 2 routers.How to do that,I need a start from where I can start.And then I have to implement IP and Link layer interfacing and also IP packet fragmentation.If anyone of you can help with anypart of the project.Thank You in advance.
|
|
|
|
|
I don't think anyone can give an answer to such a far reaching question; this is a case for some Google research about networking. BTW what does this have to do with Java?
|
|
|
|
|
csepratik wrote: And then I have to implement IP and Link layer interfacing and also IP packet
fragmentation
Java doesn't do "IP".
It does TCP, UDP and sort of ICMP (but normally good enough.)
|
|
|
|
|
hi how are you all
<b>(SORRY FOR MY BAD ENGLISH)</b>
i have a server (localhost) and want to send pdf file from my servlet on server to the client
how can i do it
thank you very much
|
|
|
|
|
response.setHeader("Content-type","application/pdf");
response.setHeader("Content-Disposition","attachment; filename=\"destination filename\"");
BufferedOutputStream bo=new BufferedOutputStream(response.getOutputStream());
byte buffer[]=new byte[1024];
FileInputStream fis=new FileInputStream("File in server");
while(fis.read(buffer)>0){
bo.write(buffer);
}
fis.close();
bo.close();
|
|
|
|
|
ty very much for help
plz can u tell me how to catch the in the client
|
|
|
|
|
The codes written is used to send back response to client and it is compliant with html...
So you just use the browser, surf to the site with the above code and you will get the file...
|
|
|
|
|
but first i have to catch the file in Client side
have i use Inputstream or what ?
ty for help
|
|
|
|
|
In fact, this question may not be in this forum. Because, it is all about web and html
you can use .... to upload the file ...
and in server side, you can use request.getInputStream().....
or use third party library to handle upload request as ref site:
ref: http://www.andowson.com/posts/list/197.page
modified 12-Oct-11 3:09am.
|
|
|
|
|
But he doesn't want to upload the file from the client to the server. He wants to download the file from the server to the client. Completely the opposite way round from your answer.
|
|
|
|
|
So you need the permission of that client and he/she open a port for you :
java.net.Socket s=new Socket();
s.connect(new InetSocketAddress(InetAddress.getByName(hostname),portNo));
s.getInputStream();
......
Or remote login to that computer, it is depends on what methods that computer use to get the connection.
|
|
|
|
|
Original question from assignment:
3. Write a driver program (where the main() method is) that would utilize all of your classes. The driver class can be in a separate package or in any of the already existing four packages. In the main() method you must:
a. Create various objects from the 6 classes, and display all their information using the toString() method;
b. Test the equality of some to the created objects using the equals() method;
c. Create an array of 10 Vehicule objects and fill that array with various objects from the 6 classes (each class must have at least one entry in that array);
d. Trace that array to find the object that has the cheapest price. Display all information of that object along with its location (index) in the array.
--------------------------------
I can figure out how to use a for loop to figure out the lowest price in the array. We were told to use the accessor method to get the price but how do i get the lowest price.
I have a total of 6 class. but these 2 should be enough to get the idea. and the driver.
Driver:
import java.util.ArrayList;
import Package1.Vehicule;
import Package2.Car;
import Package2.FamilyCar;
import Package2.FamilyCar.CarType;
import Package2.SportsCar;
import Package3.Truck;
import Package3.Truck.TruckType;
import Package4.Bus;
import Package4.Bus.BusType;
public class Driver {
public static void main(String[] args) {
CarType ct = null;
TruckType tt = null;
BusType bt = null;
Vehicule vTest = new Vehicule("Hybrid", 1.9, 12000);
System.out.println(vTest);
Vehicule vvTest = new Vehicule("Hybrid", 1.9, 12000);
System.out.println(vvTest);
Car cTest = new Car("Honda", "Civic", 2009, "Unleaded", 2.8, 13000);
System.out.println(cTest);
FamilyCar fTest = new FamilyCar(7, ct.Sedan, "Honda", "Odessey",
2009, "Unleaded", 2.8, 13000);
System.out.println(fTest);
SportsCar sTest = new SportsCar(false, 250, "Mazda", "Rx8", 2004,
"Unleaded", 1.5, 15000);
System.out.println(sTest);
Truck tTest = new Truck(tt.Tank, "Diesel", 1.2, 10000);
System.out.println(tTest);
Bus bTest = new Bus(bt.city, "Hybrid", 1.9, 12000);
System.out.println(bTest);
System.out.println(vTest.equals(vvTest));
System.out.println(vTest.equals(bTest));
Vehicule[] vehicules = new Vehicule[10];
vehicules[0] = cTest;
vehicules[1] = vTest;
vehicules[2] = tTest;
vehicules[3] = cTest;
vehicules[4] = cTest;
vehicules[5] = cTest;
vehicules[6] = cTest;
vehicules[7] = cTest;
vehicules[8] = bTest;
vehicules[9] = cTest;
int fin = 0;
int ii = 1;
for (int i = 0; i<10; i++, ii++)
{
for (;vehicules[i].getPrice() < vehicules[ii].getPrice();)
fin = i;
}
}
}
Vehicule class:
package Package1;
public class Vehicule {
protected String fuelT;
protected double consum;
protected int price;
public Vehicule ()
{
fuelT = "";
consum = 0.0;
price = 0;
}
public Vehicule(String f, double c, int p)
{
this.fuelT = f;
this.consum = c;
this.price = p;
}
public String toString()
{
return "This Vehicule is a " + fuelT
+ ", consumes " + consum + "liters/100km and costs $"
+ price + ".";
}
public String getFuelT() {
return this.fuelT;
}
public double getConsum() {
return this.consum;
}
public int getPrice() {
return this.price;
}
public void setFuelT(String f) {
this.fuelT = f;
}
public void setConsum(double c) {
this.consum = c;
}
public void setPrice(int p) {
this.price = p;
}
public boolean equals(Vehicule e)
{
boolean ans;
if(this.fuelT == e.fuelT &&
this.consum == e.consum &&
this.price == e.price ){
ans = true;
}
else
ans = false;
return ans;
}
}
Car class:
package Package2;
import Package1.Vehicule;
public class Car extends Vehicule {
String carBrand;
String carMake;
int year;
public Car()
{
super();
carBrand = "";
carMake = "";
year = 0;
}
public Car(String b, String m, int y, String f, double c, int p)
{
super (f,c,p);
this.carBrand = b;
this.carMake = m;
this.year = y;
}
public String toString()
{
return "This Car is a " + fuelT
+ ", consumes " + consum + "liters/100km and costs $"
+ price + ". It is a " + year + " " + carBrand
+ " " + carMake + ".";
}
public String getCarBrand() {
return this.carBrand;
}
public String getCarMake() {
return this.carMake;
}
public int getYear() {
return this.year;
}
public void setCarBrand(String b) {
this.carBrand = b;
}
public void setCarMake(String m) {
this.carMake = m;
}
public void setYear(int y) {
this.year = y;
}
public boolean equals(Car e)
{
boolean ans;
if(this.fuelT == e.fuelT &&
this.consum == e.consum &&
this.price == e.price &&
this.carBrand == e.carBrand &&
this.carMake == e.carMake &&
this.year == e.year){
ans = true;
}
else
ans = false;
return ans;
}
}
|
|
|
|
|
If you can find the lowest price in the array you have satisfied your requirements. Or perhaps your question needs to be clarified.
|
|
|
|
|
Don't take this the wrong way, but are you planning to post all your course work on here for the entire school year? You won't learn too much if you keep saying, "I don't understand this, will you do it for me" every time the teacher sets you a problem.
|
|
|
|
|
We've just had a decleration from up high that our standard programming language should be Java. But no more details than that
Currently we have a large number of Access 97 databases and visual basic 6 apps, that we were planning to migrate to .NET and SQL Server, with future plans to make it ASP.NET.
From previous research it seems that Java is little less organised, there being a number of IDE's/UI widgets/test frameworks etc. I was wondering if anybody can give me pointers on what the leaders are...if you had a greenfield java site, which tools etc would you recommend?
|
|
|
|
|
sounds like you have no Java experience - so WHY do you want to switch to Java?
regards Torsten
I never finish anyth...
|
|
|
|
|
Read the post. OP doesn't, management does.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Are you in a position to question this choice? If you are a Microsoft house, it may be better to stay that way unless there is good reason. Jumping from VB6 is a good start anyway. Whatever the new language used, a complete re-write is a better choice. That way you can work around bad decisions, there always are, made in the original system.
As for Java IDE's, it really is your choice. The two most popular are Netbeans and Eclipse, and I'd choose one of them. My personal recomendation is Netbeans but that is because I use it and am familiar with the way it works.
Have a look at the Java tutorials on oracle.com. Then buy some books and put them on expenses.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|