|
I've been using "Sams Teaches you Java in 24 hours" and I found it to be amazing, have a look! (I know it's a late answer, but still)
|
|
|
|
|
Hello,
I have a code like this
public class Doc extends DefaultStyledDocument{
}
Doc doc= new Doc();
doc.insertString(0, "This is a working document", null);
AbstractDocument.AbstractElement rootElement = doc.createDefaultRoot();
Once I create a root element how do I assign or set its value from the doc string.Currently the element is blank.
thnaks
Pritha
|
|
|
|
|
Am not adding full code .. jus sample
import com.lowagie.text.*;
Paragraph pH = new Paragraph("Title",FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD, new Color(0, 0, 255)));
Paragraph pF1 = new Paragraph("Conditions Apply",FontFactory.getFont(FontFactory.HELVETICA, 7, Font.BOLD, new Color(0, 0, 255)));
Paragraph pF2 = new Paragraph("*Coupon Valid till 1 month of date issued",FontFactory.getFont(FontFactory.HELVETICA, 7, Font.BOLD, new Color(0, 0, 255)));
Paragraph pF3 = new Paragraph("*tamil translation");
Paragraph pNEXT = new Paragraph("\n");
Paragraph p3 = new Paragraph();
p3.add(new Chunk(""));
Chunk separator = new Chunk(new DottedLineSeparator());
p3.add(separator);
pH.setAlignment(Paragraph.ALIGN_CENTER);
document.add(pH);
document.add(pNEXT);
document.add(tab);
document.add(pNEXT);
document.add(pF1);
document.add(pF2);
document.add(p3);
//document;
document.add(pNEXT);
|
|
|
|
|
hello
thanks for your reply
I am using swing libraries and there i am able to create a leaf or a branch of a document but the leafelement doesnt seem to get added to the default root .
public class MyDoc extends DefaultStyledDocument {
protected void insertUpdate(AbstractDocument.DefaultDocumentEvent e,
AttributeSet attr){
Element root = getDefaultRootElement();
Element branchroot = new BranchElement(root, null);
branchroot = createBranchElement(root,null);
Element leafElement = new LeafElement(branchroot, null, 0,0);
leafElement = createLeafElement(branchroot,null,"p");
}
public Element createBranchElement(Element parent,AttributeSet a)
{
return super.createBranchElement(parent, a);
}
protected Element createLeafElement(Element parent,AttributeSet a, String arg) throws BadLocationException
{
return super.createLeafElement(parent, null, startOffset(arg),startOffset(arg)+5);
}
}
|
|
|
|
|
Hi all!
I want to get the database info( eg.instance;username)by using only IP.I don't know how to start.
thank you!
modified 5-Nov-12 10:27am.
|
|
|
|
|
XMafei wrote: I don't know how to start. You could start by giving some more details about your problem. You do not get information from a database just by giving the IP address, but by creating a connection to a database server and making requests, the IP address is just part of the connection string.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
eg
input IP,UserName,UserPwd
output database info such as database instance,database user
|
|
|
|
|
XMafei wrote: eg
input IP,UserName,UserPwd
output database info such as database instance,database user
I have no idea what that is supposed to mean. However, I suggest you spend some time reading about Java Database Access[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
XMafei wrote: I don't know how to start.
You are referring to information that is database specific. So you research database specific protocols.
As an example of one such possibility you can look at the following
http://www.sqlmag.com/article/active-directory-service-interfaces-adsi/publishing-sql-server-in-active-directory[^]
And keep in mind that it is possible that one cannot get that information for some databases either because the database doesn't support it or because it is not published. That of course suggests that the best way and certainly the easiest is to just require that the user must provide that information.
|
|
|
|
|
Please develop a simple console base application, which reads some persons records from a “.txt” file and displays each person’s information in form of table. The program should also count and display the number of alphabets, spaces, integers, words, characters and lines from the file in tabular form.
please make this application file (.java) and driver file (.java) separately.
(All three files will be in one folder for execution through driver file)
text file is containing the follwing text.
David, 51, IT, 40006, Bachelor
Tomb, 85, Computer, 40502, Master
Stephen, 97, Maths, 40652, Phd
..............................
it is infact
name, rollNo, grade, phoneNo, program
variables.
|
|
|
|
|
This is not a "homework on demand" site. These instructions were given to you, and you are expected to do the work.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
sdfsd
|
|
|
|
|
simple pro of more then one int no sum
|
|
|
|
|
If you cannot make the effort to write a proper question then do not be surprised if you do not get a proper answer. And if you are looking for a complete solution to your homework you are likely to be disappointed.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
|
do you have a list of codes and thier function?
thanks
|
|
|
|
|
dear all iam new in java and using jdk1.6 and netbeans ide with sql server 2005 i want to update content of JtextField using submit button in sql server 2005 and how to make connection in java and sql server 2005 please suggest
|
|
|
|
|
Lots of suggestions here[^] for accessing SQL server from Java.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi,
sorry for my bad English.
I need in JAVA.
I have a log file from a Web server with 120,000 lines.
Example of input file:
10.160.0.10;16.11.2011 12:56;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0"
10.160.0.100;14.11.2011 7:22;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0"
10.160.0.100;14.11.2011 10:45;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0"
10.160.0.100;14.11.2011 10:53;/;-;"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)"
I need to compare the IP address in the first line with IP in the second line
and at the same time
to compare the last box that contains the version of the web browser with version in the second line.
And second line with third line etc.
If first IP is same as second IP and together first version is same as second version
then add to the end of line info example #1 (that will be mean that it is first user)
If IP or version are different then add to the end of line #2 (second user).
It identifies users based on IP address and User-Agent field (based on different versions of a web browser).
Example of ouput file:
10.160.0.10;16.11.2011 12:56;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0";#1
10.160.0.100;14.11.2011 7:22;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0";#2
10.160.0.100;14.11.2011 10:45;/;-;"Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0";#2
10.160.0.100;14.11.2011 10:53;/;-;"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)";#3
Do you have any idea how to do this?
Which method to use?
Thank you for help.
|
|
|
|
|
Yes.
Manual attempt:
Simplest: make a *.csv from the log file. A *.csv file is a Excel compatible file. You can use notepad++ to change the "/" into ";" to format the data.
As a coding:
Split each String on the slash "/" and use only first and last part - insert a semicolon (";") in between.
Write to file and name it "funnyname.csv". You can import that file into MS Excel / OO Calc for inspection - or extend your snippet to make the comparison for you (if there is a certain thingy you're looking for).
|
|
|
|
|
how to do tower in java by using GUI
|
|
|
|
|
Why have you reposted this same question? One post is sufficient.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
how to do tower in java by using GUI
|
|
|
|
|
Please give more details about your problem; "how to do tower" is not very clear.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|