|
Please enclose your code in <pre> tags to make it readable.
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
|
|
|
|
|
bijalvadher wrote: its too confusing as jpanel creates its component from top left corner and pdf from bottom left.
converted_value = (value * -1) + max_value
that is how you can easily convert the positions.
the resize: I don't know much about IText, but can't you make a full size document and then resize it to the paper format? That would be much simpler.
|
|
|
|
|
<pre> Hello
i want to implement a central weather station( is the class KentrikosMeteorologikosStathmos) where you can add or remove regional weather stations. In the regional station(is the classPeriferiakosMeterologikosStathmos) you can add or remove sensors . There are 3 kinds of sensors SensorAnemou, SensorVroxis and SensorFoteinotitas
When i compile the programm it shows
java.lang.NoClassDefFoundError:
Caused by: java.lang.ClassNotFoundException:
thanks
</pre>
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author ΝΙΚΟΣ
*/
import java.util.ArrayList;
public class KentrikosMeteorologikosStathmos {
String poli;
private ArrayList<PeriferiakosMeterologikosStathmos> p;
public void addPeriferiakos()
{
p=new ArrayList<PeriferiakosMeterologikosStathmos>();
}
public void removePeriferiakos()
{
int i=p.indexOf(p);
if(i>=0){
p.remove(i);
}
}
public void collectPerif()
{
ArrayList<PeriferiakosMeterologikosStathmos> per=new ArrayList<PeriferiakosMeterologikosStathmos>();
for(PeriferiakosMeterologikosStathmos var)
per.add(var);
System.out.println("Periferiakoi");
for(int count=0;count<per.size();count++)
System.out.println(per.get(count));
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author ΝΙΚΟΣ
*/
import java.util.ArrayList;
public class PeriferiakosMeterologikosStathmos {
private ArrayList<Sensor> o;
public PeriferiakosMeterologikosStathmos()
{
o=new ArrayList<Sensor>();
}
public void addSensor(Sensor s)
{
//ArrayList<Sensor> o=new ArrayList();
o.add(s);
}
public void removeSensor(ArrayList<Sensor> s)
{
int i=o.indexOf(o);
if(i>=0){
o.remove(i);
}
}
public void collectSensors()
{
ArrayList<Sensor> sens=new ArrayList<Sensor>();
for(Sensor var)
sens.add(var);
System.out.println("Sensores");
for(int count=0;count<sens.size();count++)
System.out.println(sens.get(count));
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author ΝΙΚΟΣ
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
KentrikosMeteorologikosStathmos s=new KentrikosMeteorologikosStathmos();
s.collectPerif();
}
}
import java.util.Random;
public class SensorVroxis extends Sensor {
@Override
public double getValue()
{
Random r=new Random();
int d;
d=r.nextInt(10);
return d;
}
}
import java.util.Random;
public class SensorAnemou extends Sensor {
public double getValue()
{
double d;
Random r=new Random();
int meters=r.nextInt();
int seconds=r.nextInt();
d=r.nextInt(meters/seconds);
return d;
}
}
import java.util.Random;
public class SensorFoteinotitas {
Random r=new Random();
public double getValue()
{
double d;
double cov=r.nextInt();
d=cov/100;
return d;
}
}
import java.util.Random;
public abstract class Sensor {
public abstract double getValue();
}
|
|
|
|
|
What command did you use and what was the full text of the error message?
Note: please edit the above question and place <pre> tags round your code for readability.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi All,
I have added a jPanel Form in my applet project. Now i want to place this jPanel over other forms(Applet window) at run time. For that i created its object in Main applet window and try to place it. But its not visible there. Is there anyone who can catch something and help me . I am adding code as well
//SaveContact is jPanel Form class i want to add
SaveContact objFormSaveContact = new SaveContact();
this.getContentPane().add(objFormSaveContact);
this.getContentPane().validate();
objFormSaveContact.setLocation(200, 50);
objFormSaveContact.setVisible(true);
Thanks.
|
|
|
|
|
Seems like you need to repaint() .
|
|
|
|
|
Hi everyone,
Can someone guide me to a code in java that implements a multithreaded proxy server.
Thanks
|
|
|
|
|
Maybe these guys can.
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
prateek.rajan89 wrote: Can someone guide me to a code in java that implements a multithreaded proxy server.
Java doesn't implement that.
Perhaps you were looking for a server written in java that implements a proxy server. Since "proxy server" can mean different things that can influence the outcome but in general full function proxy servers are not written in java because java doesn't (easily) support functionality that other languages, such as C++, do.
|
|
|
|
|
import java.io.*;
class print
{
public static void main(String[] args)
{
int[] a = new int[20];
int i=0;
while(i<20)
{
a[i] = i;
System.out.println(a[i]);
i++;
}
}
}
output of above code is :<pre lang="vb">0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
while output of:
import java.io.*;
class print
{
public static void main(String[] args)
{
int[] a = new int[20];
int i=0;
while(i<20)
{
a[i] = i;
i++;
System.out.println(a[i]);
}
}
}
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 20
at print.main(print.java:12)
Plz expalin why "i++" make large difference..
Thnx in advance..
modified 19-Jan-12 17:16pm.
|
|
|
|
|
class Code1{
public static void main(String[] args) {
int[] a = new int[20];
int i=0;
while(i<20) {
a[i] = i;
System.out.println(a[i]);
i++;
}
}
}
class Code2{
public static void main(String[] args) {
int[] a = new int[20];
int i=0;
while(i<20) {
a[i] = i;
i++;
System.out.println(a[i]);
}
}
}
That fit's better to my display, which is more wide than high Also check the renaming of the classes
Code1 increments the value i after the value of a[i] is print out.
Therefor each value of a[] is set and print out different.
in Code2 the Array a[] is initialized. That set's all values of a[] to "0".
After that you set a value of a[] and increment i before print out.
So you get in the print out the next value - which is still "0" and you exceed the limit of the array in the endposition (you try to print a[20] , but the array goes from 0-19 ).
That's why.
|
|
|
|
|
thnx Torsten...thnx very much dear.....
|
|
|
|
|
Nice description
Thanks and Regards,
RK_PRABAKAR
|
|
|
|
|
What is the problem here?
you just incrementing the integer 'i' for checking condition but the value you intend to print is integer array a[] of size 20.For that you must modify your code into
import java.io.*;
class print
{
public static void main(String[] args)
{
int[] a = new int[20];
int i=0;
while(i<=20)
{
i++;
a[i] = i;
System.out.println(a[i]);
}
}
}
output of above code is :
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<div class="signature">Thanks and Regards,
RK_PRABAKAR</div>
|
|
|
|
|
i need the source code for image encryption in java based on hill cipher.somebody plz help............
|
|
|
|
|
bhanu.pratap.99 wrote: i need the source code
Then you need to go and search for it; this site is not here to provide source code to order.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Go write it then!
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
|
|
|
|
|
don't listen to them - I'll give you a jump start: JCA[^]
Have fun.
|
|
|
|
|
|
|
Start here[^] and you will find lots of samples that will help.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Show us your homework and we will contribute some advice.
We will help, but we are not doing your work.
|
|
|
|
|
ya help me by giving some instruction don't do my work it is a request sir not an order
|
|
|
|
|
ok, so here are some of MY requirements:
- Make it a Windows-Service[^] (visible in the bottom right task corner). It should start with the OS and as a first log date time and name of the log in.
- You'll need a KeyListener[^]
- Make the log by log4j[^] -> I want daily log files. (Tutorial[^])
- on request I want a print out[^] in PDF Format[^] (Yes, I know the F stands for "Format" but it sounds wired when one says PD Format).
Let's see what you've got in mind.
|
|
|
|
|
anilgoyal1289 wrote: guys
And why would you want that? It sounds like a key-logger to me, which is bad[tm].
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
|
|
|
|