this is the code I used for the restaurant bill. I want the outcome like a real recipe, but the problem is the text I get is next to each other instead of underneath. This is the outcome..
Can someone help me with this?
BonField.setText("\tKassabon\n" +
"Klantnummer:" + klant +
"\n=================================================================\t " +
"\n======================================================\t " +
"\nBtw 6%:\t\t\t\t\t" + BTW +
"\nSub Totaal:\t\t\t\t\t" + SubTotaal +
"\nTotaal bedrag:\t\t\t\t\t" + Totaal +
"\nContant betaald:\t\t\t\t\t" + Totaal +
"\n======================================================\t " +
"\nDatum: " + Tdate.format(timer.getTime()) +
"\t\tTijd: " + tTime.format(timer.getTime()) +
"\n\n\tBedankt voor uw bezoek, graag tot ziens\n" );
First things first: Never format your textbox or any other visual element by it content directly in final builds of your applications. Although it is understandable for debug usage and stuff, you'll probably need to handle auto adjustment things within final builds.
Secondly: Too few info to help you, bro. Think and express properly when asking questions or you'll keep having your questions underrated.
Good luck with your work!
Related
I am a new programmer in javafx.
Using java FX in IDE I want to make a student information application.
I want to print the input data into the text area but it prints out in the console now.
(After clicking display button I want to show all the input data in textarea)
please help me out to solve this problem.
I am attaching my code below for your suggestion..
Main.java
Just place
textArea.setText("Name: " + t1.getText() +"\nAddress: " + t2.getText()
+"\nProvince: " + t3.getText() +"\nCity: " + t4.getText()
+"\nPostal Code: " + t5.getText() +"\nPhone Number: " + t6.getText()
+"\nEmail: " + t7.getText() + "\nCourses: "+comboBox.getItems()
+ "\nActivities: "+c1.getText() + "\n"+c2.getText());
into the action handler.
And remove the imports
import javax.swing.JTextArea;
import java.awt.*;
They are not JavaFX.
You are printing your result into the standard output stream (System.out). I assume you want to display what is printed by:
System.out.println("Name: " + t1.getText() +"\nAddress: " + t2.getText()
+"\nProvince: " + t3.getText() +"\nCity: " + t4.getText()
+"\nPostal Code: " + t5.getText() +"\nPhone Number: " + t6.getText()
+"\nEmail: " + t7.getText() + "\nCourses: "+comboBox.getItems()
+ "\nActivities: "+c1.getText() + "\n"+c2.getText());
Please visit the documentation of the TextArea class. Printing your result into the standard output stream has nothing to do with printing your result in your TextArea. Simply use a normal String that contains your result and set the text of your TextArea accordingly.
I have a control that must be highly customizable, and that means being able to use an image for the control background. To that end I need to know how I can, in code, set the CSS Style to point to the image specified by the user.
I have the following (which didn't work, I get a warning about "unknown protocol: c" (which I don't even know what that means)):
BG = //The CSS String
"-fx-background-position : 50% 50%;\n" +
"-fx-background-repeat : no-repeat;\n" +
"-fx-background-size : contain;\n" +
"-fx-background-image : url(\"" + GS.bgImage.getAbsolutePath() + "\");\n";
BG += "-fx-border-width : " + GS.borderWidth + ";\n" //For adding the Border
+ "-fx-border-color : " + GS.borderColor.toString();
this.setStyle(BG);
GS is a class I constructed from which the control reads the information to know what to make itself look like. GS.bgImage is the background image control is trying to use as it's background. So... what am I doing wrong here? Should i not be using .getAbsolutePath()? Is it something else?
Okay so it turns out trying to do it with File.getPath() or File.getAbsolutePath() was the issue. Turns out to make it work in code you need to use File.toURI().toURL().
So the proper method would be:
BG = //The CSS String, you need to wrap with a Try/Catch to capture a MalformedURLException, but I'm too lazy to do that here...
"-fx-background-position : 50% 50%;\n" +
"-fx-background-repeat : no-repeat;\n" +
"-fx-background-size : contain;\n" +
"-fx-background-image : url(\"" + GS.bgImage.toURI().toURL + "\");\n";
BG += "-fx-border-width : " + GS.borderWidth + ";\n" //For adding the Border
+ "-fx-border-color : " + GS.borderColor.toString();
I've some customized models into Alfresco and I need to extract the aspect information and the content from Repository.
I need, passing the keywords and the model name (it's an aspect), to extract content or the aspects associated to the model.
search/{keywords}?model={model?}
this is the javascript I'm using to extract the content passing the model
var docs = search.luceneSearch("#kd\\:commonname_content_type_tag:\"" + model + "\"");
How can I concatenate two aspects properties?
I did it into Java but the syntax in Javascript seems quite different:
queryString = "+TYPE:\"" + Constants.createQNameString(CommonAspects.NAMESPACE_KD_CONTENT_MODEL, DrugModel.TYPE_SUPPLIER) + "\" ";
queryString += "+#kd\\:SupplierID:" + drugBrandNameBean.getSupplierID();
String supplier = contentQuery.getUUID(queryString);
Another question, how can I process the Javascript docs? Can I access to my aspects?
I tried something like that but it didn't works:
var docs = search.luceneSearch("#kd\\:commonname_content_type_tag:\"" + model + "\"");
for (var i=0; i<docs.length; i++) {
log += "Searching " + commonName + " - Name: " + docs[i].name + "\tPath: " + docs[i].displayPath;
log += "\tType: " + docs[i].commonname_content_type_tag + "\r\n";
}
The rows extracted are correct but the commonname_content_type_tag properties is always not defined:
Searching acarbose - Name: exenatide - Contraindication Path: /Company Home/CommonName Type: undefined
Thanks for the help!
Andrea
Try something like that:
docs[i].properties["kd:commonname_content_type_tag"]
I have following lines of code that just don't want to be wrapped:
tran = TransactionFactory.generateDoubleEntryTransaction(cAcc, acc, qTran.amount, qTran.date, qTran.memo, qTran.payee, qTran.number);
logger.info("Different currencies, Credit: " + entry.getCreditAmount() + " " + creditCurrency.getSymbol() + " -> " + entry.getDebitAmount() + " " + debitCurrency.getSymbol());
Both lines are 150 respective 190 chars long. In my Code formatting settings the maximum line length is set to 100, the Line wrapping settings for Function Calls are all set to "Wrap when necessary". In the preview pane at least it looks like right. Just it doesn't wrap.
I'm using Eclipse 3.6.2 here.
You have to press CTRL+SHIFT+F
Java newbie here, I'm having trouble setting a new line in this code:
String FnameTextboxText = FnameTextbox.getText();
String LastnameTextboxText = LastnameTextbox.getText();
String CourseTextboxText = CourseTextbox.getText();
Summary.setText("Firstname:" + " " + FnameTextboxText + "\nLastname:" + " " + LastnameTextboxText + "\nCourse:" + " " + CourseTextboxText);
Also tried something like: "\n" + "Lastname" But its no good.
Do you have any idea on how to make new lines. So that it'll look like this;
Firstname: x
Lastname: y
Course: Z
Using netbeans 6.8. On windows.
I guess you need to use TextArea.
First, use TextArea
Second, test using \r or \n or \r\n
Sometimes, people use \n to make new line and sometimes, like me, use \r\n to make new line