|
Usage of inner classes is one of those things that some Java coders get very worked up about, for and against. Personally, I don't much like them but they have their uses.
There are plenty of opinions on the net about whether to use them, when to use them, how to use them. For every one person who says "Do it this way" you will find another who says "Don't do it that way".
The one thing I would say is: if you are making AST Visitor publicly visible outside Analysis, why not just make it an outer class on its own? What do you gain by making it an inner class of Analysis?
|
|
|
|
|
I want to run an exe file in my project.
I mean when I run my codes,a specific executable file run.
How can I do that?
|
|
|
|
|
I expect you want to use the Runtime[^] class.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Since 1.5 ProcessBuilder has been recommended over Runtime. Having said that, I still use Runtime because it's what I'm used to and old habits die hard.
|
|
|
|
|
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
|
|
|
|