|
I used Google to check; it's a while since I sat and read the latest documentation and guidance notes.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
tell me about Layout Managers
i want to use it in my applet programes
|
|
|
|
|
I have already made a suggestion here[^]. Please do not repeat the same question in multiple forums.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
hi...I'm writing a program for converting nfa to dfa...for getting alphabet and rules(which are array) and other elements in nfa (which are not arrays) I've defined a "NFA" class and for converting another class "NfaToDfa"...when I create an object from "NFA" class and I want to use for example "getrules" method in "NfaToDfa" there's an error...notice that for the other elements which are integer or...(anything except array) there's no error...what can I do ?
NFA NFATo=new NFA();
String[ ][ ] Rules=new String[100][3];
Rules=NFATo.getRule();
String[] alphabet=new String[27];
alphabet=NFATo.getAlpha();
I have error in line 3 and 5...the error is "cannot find symbol"...can anyone help me with this problem ?
|
|
|
|
|
What symbol can the compiler not find, i.e. post the full text of the error message.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
the error is :
cannot find symbol
symbol: class Rules
location: class nfa2dfa.NfaToDfa
<identifier> expected
cannot find symbol
symbol: method getRule()
location: class nfa2dfa.NFA
|
|
|
|
|
and the same error for "getAlpha"...
|
|
|
|
|
Well that seems quite clear, the run time system cannot find method getRule() .
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
well...I know what the problem is but I don't know how to solve it ! because I've already defined "getRules" method in NFA class...and there's no error in that method...
|
|
|
|
|
Then I can only assume that you are running a different version of your program, or some class is not in the correct place. Given the information you have provided here I cannot begin to guess what the structure of your classes is or how you are running the program. I would suggest you use your debugger to try and find out what is happening.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I just copied the 5 lines of code in your original message into a Java program, added implementations for the constructor and two methods and it works fine. What are you doing that is different?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
OK, I've figured out what the problem may be. If you are manually compiling the class that uses NFA then you need to be in the correct directory for the compiler to find the class. If these classes are in a package then you need to start from the directory above the package directory. For example if class NFA is in directory test , and NFA is part of package test then you need to compile from the next higher directory as follows:
C:\Documents\Java\testing>dir test
Volume in drive C is System
Volume Serial Number is F28F-2710
Directory of C:\Documents\Java\testing\test
28/01/2012 13:20 <DIR> .
28/01/2012 13:20 <DIR> ..
28/01/2012 12:44 1,000 MyTest.java
28/01/2012 12:44 1,598 NFA.class
28/01/2012 12:44 917 NFA.java
2 File(s) 3,515 bytes
2 Dir(s) 177,110,560,768 bytes free
C:\Users\Richard\Documents\Java\testing>
javac -cp . test/MyTest.java
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Member 8586072 wrote: but I don't know how to solve it ! because I've already defined "getRules"
Presumably that is just a problem in your post rather than in what you implemented because that is not the method that is missing.
|
|
|
|
|
See my last answer above.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
What is this to do with Java?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Sorry posted in the wrong Forum
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
|
no complete sentence - no complete answer
|
|
|
|
|
Hello,
Can anyone please help me.
I am new to itext and dont know much...
I have a jpanel having approx 380 components.I have to create the respective components on itext pdf document.i am trying to take a graphics 2d of each component and placing it in pdf but how should i reduce the size and give respective cordinates..
its too confusing as jpanel creates its component from top left corner and pdf from bottom left.
i also need to calculate proprtionate width and height.
public void convertPageToIText(Form form, Page page,
PagePanel pagePanel,
PageController pageController,ZipOutputStream zos, String pageModel,int i) throws DocumentException, IOException
{
pageController.resetFieldsChecked();
pageController.prepareBeforeSynchronizeFrom(form, page);
pagePanel.synchronizeFrom(page);
pageController.prepareAfterSynchronizeFrom(form, page);
UI.setEnabled(pagePanel, true);
Document doc = new Document(PageSize.A4);
File file=null;
FileInputStream fis=null;
file = File.createTempFile("IR Mobility1-", ".pdf");
ByteArrayOutputStream baos=new ByteArrayOutputStream();
PdfWriter writer =PdfWriter.getInstance(doc, baos);
writer.setPdfVersion(PdfWriter.VERSION_1_5);
doc.open();
PdfContentByte cb=writer.getDirectContent();
Graphics2D g2 =null;
int pagenumber=1;
for (Field field :pagePanel.getClass().getSuperclass().getDeclaredFields())
{
Object o = pagePanel.get(field);
if (o instanceof JLabel)
{
JLabel jLabel = (JLabel)o;
float llx=jLabel.getX()*(594/750);
float lly=((jLabel.getY()*(842/pagePanel.getHeight()))+(jLabel.getHeight()*(842/pagePanel.getHeight())));
PdfTemplate template = cb.createTemplate(jLabel.getWidth()*0.5f, jLabel.getHeight()*0.5f);
g2 = template.createGraphics(jLabel.getWidth()*0.5f, jLabel.getHeight()*0.5f);
jLabel.print(g2);
g2.dispose();
cb.addTemplate(template, jLabel.getX(),842-jLabel.getY());
// cb.stroke();
// cb.restoreState();
continue;
}
// if (o instanceof JTextField)
// {
// JTextField jLabel = (JTextField)o;
//
// PdfTemplate template = cb.createTemplate(jLabel.getWidth(), jLabel.getHeight());
// template.stroke();
// g2 = template.createGraphics(jLabel.getWidth(), jLabel.getHeight());
// g2.scale(1,1);
//
// jLabel.print(g2);
//
// g2.dispose();
// cb.addTemplate(template, jLabel.getX(), 842-jLabel.getY());
//
// continue;
// }
if (o instanceof JTextArea) {}
if (o instanceof JTextPane) {}
if (o instanceof JCheckBox) {}
if (o instanceof JRadioButton) {}
if (o instanceof JDateField) {}
if (o instanceof SignaturePanel) {
}
if (o instanceof DrawingPanel) {}
if (o instanceof HelperObjectComboBox) {}
}
doc.close();
PdfReader reader = new PdfReader(baos.toByteArray());
PdfStamper stamper =new PdfStamper(reader, new FileOutputStream(file));
stamper.setRotateContents(false);
stamper.setFormFlattening(true);
stamper.close();
fis = new FileInputStream(file);
byte[] b = new byte[1 * 1024];
while (true) {
int k = fis.read(b);
if (k == -1) {
break;
}
zos.write(b, 0, k);
}
fis.close();
fis = null;
file.delete();
file = null;
}
}
|
|
|
|
|
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.
|
|
|
|