How to have a new line text in JOptionPane
I have a String object (StringBuffer.toString) that I am displaying on a JoptionPane.
But my '\n's in it are not splitting the Strings to be on different lines. Is there anything else I need to do?
Swing related questions should be posted in the Swing forum.
Read the article on [url http://java.sun.com/developer/JDCTechTips/]Beyond the Basics of JOptionPane for a solution.
Similar Messages
-
Want to know how to check for new line character in text file
Hi All,
I`m trying to read data from text file. However I`m not sure whether the data is in 1st line or nth line. Now I`m trying to read the text from the readline. But if text is "" and not NULL then my code fails. So I want to know how to check for new line character and go to next line to find the data. Please help.
Thanks
static int readandwriteFile(Logger logger,String filepath){
BufferedWriter out = null;
BufferedReader in = null;
File fr = null;
int get_count = 0;
try {
if(new File(filepath).exists())
fr= new File(filepath);
System.out.println("FileName: "+fr);
if(fr != null){
in = new BufferedReader(new FileReader(fr));
String text = in.readLine();
if(text != null){
get_count = Integer.parseInt(text);
in.close();
else{
get_count = 0;
else{
out = new BufferedWriter(new FileWriter(filepath));
out.write("0");
out.close();
} //Reading of the row count file ended.
catch(Exception e) {
e.printStackTrace();
finally {
try{ if (in != null) {
in.close();
if (out != null) {
out.close();
catch(Exception e) {
e.printStackTrace();
return get_count;
}You are calling the readline() only once which means you are reading only the first line from the file...
Use a loop (Do-While preferably)
do{
//your code
}while(text == "") -
How to create a new line in label in Xcode
How to create a new line in label. for example I have two buttons & one label. when i press first button, l want to change the label text to "Hello World". then when I press the second button, on the same label I need to display"Good Bye" on the next line in xcode 5?
I want to display the lablel like below:
Hello World
Good ByeI am using Xcode to develop an app for iOS.
I tried using multi-line label & belwo is my code.
- (IBAction)change:(UIButton *)sender {
self.Screen.text = @"\nHello World";
- (IBAction)newChange:(UIButton *)sender {
self.Screen.text = @"\nGood bye";
everytime when i pressed the button, it replacing the whold lable text instead of adding the second line. -
How to create a muli line text area using JavaFx
Hi all,
Since the preview SDK does not contain TextArea any more, I am wondering how to create a muli line text area using JavaFX. The behaviour of this text area/field should be somehow similar to JTextArea in Swing or StyledTextWidget in SWT.
Does JavaFX have any support for this? What would be a sensible approach to create such a widget?
Thanks for your suggestions,
br michaelThis is a pretty old thread (I know I came across this while searching for something similar recently), but I figured I'd throw this out there in case other people might find this useful. As I write this, JavaFX's latest version is 1.3... which may have added the needed functionality since the last post.
You can now create a multi-line text area using a TextBox and by specifying the nubmer of lines and setting the "multiline" value to true. It may not offer all of the same functionality as JTextArea, but it did the job for what I needed... newlines by pressing enter, scrollbar if text surpasses height, etc.
Here's a simple example:
Group {
content: [
TextBox {
text: "This is a multi-line textbox"
lines: 10 // <-- this may/may not be necessary depending on your situation. Default is 5.
multiline: true
}Edited by: loeschg on Jul 29, 2010 2:59 PM -
How to add a new line in SMS(Line Break).
Hi All,
I need to send SMS from PL\SQL Procedure
The problem i have been facing is that the string being passed in as sms content is not parsing a newline character.
It shows all content in one line.
I need to break them in several lines.
Give me a direction how to add a new line in SMS.
Regards,
Raj.Hi,
Sure, Here it is
CREATE OR REPLACE PROCEDURE APPS.AUTO_SMS_RTV_REPORT
IS
sender VARCHAR2(1000);
recipient VARCHAR2(1000);
message VARCHAR2(4000);
sub VARCHAR2(1000) := 'HELLO';
dt1 varchar2(1000) := to_char(sysdate,'DD-MON-YY');
mailhost VARCHAR2(30) := '10.7.7.xxx';
mail_conn UTL_SMTP.CONNECTION;
v_crlf VARCHAR2(2) := CHR(13)||CHR(10);
CURSOR cur_Rejection_Records IS
SELECT DISTINCT
rt.VENDOR_SITE_ID ,
pvs.email_address VENDOR_MAIL_ID ,
pvs.PHONE vendor_contact_no ,
hre.EMAIL_ADDRESS Employee_mail_id ,
hre.FULL_NAME
FROM apps.rcv_transactions rt,
apps.po_vendors pv,
apps.po_vendor_sites_all pvs,
apps.mtl_transaction_reasons mtr,
apps.fnd_user fu,
apps.hr_employees hre
WHERE transaction_type = 'RETURN TO VENDOR'
--AND TRUNC(rt.transaction_date) = TRUNC(SYSDATE)
AND rt.vendor_id = pv.vendor_id
AND rt.vendor_site_id = pvs.vendor_site_id
AND rt.REASON_ID = mtr.REASON_ID(+)
AND fu.user_id = rt.last_updated_by
AND hre.EMPLOYEE_ID = fu.EMPLOYEE_ID
AND TRANSACTION_ID IN (
11902189,
11902253,
11902148)
BEGIN
FOR rec_Rejection_Records IN cur_Rejection_Records
LOOP
Begin
sender := '<[email protected]>';
recipient := rec_Rejection_Records.vendor_contact_no || '@aaaa.com';
mail_conn := utl_smtp.open_connection(mailhost, 8025);
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, sender);
utl_smtp.rcpt(mail_conn, recipient);
utl_smtp.DATA( mail_conn,
'Date: ' || TO_CHAR(SYSDATE, 'Dy, DD Mon YYYY hh24:mi:ss') || utl_tcp.crlf ||
'From: ' || sender || utl_tcp.crlf ||
'Subject: '|| sub || utl_tcp.crlf ||
'To: ' || recipient || utl_tcp.crlf ||
utl_tcp.crlf ||
'Dear Supplier,'||CHR(10)|| utl_tcp.crlf ||'\\\0x0A'|| -- HERE I NEED LINE BREAK
'Please.'|| utl_tcp.crlf
DBMS_OUTPUT.PUT_LINE('Yep !!! SMS Sent Sucessfully :) ');
utl_smtp.quit(mail_conn);
EXCEPTION
WHEN UTL_SMTP.PERMANENT_ERROR THEN
dbms_output.put_line('Error - ' || SQLCODE || ' - ' || SQLERRM);
WHEN OTHERS THEN
dbms_output.put_line('Error - ' || SQLCODE || ' - ' || SQLERRM);
END;
END LOOP;
END AUTO_SMS_RTV_REPORT;
/ -
REUSE_ALV_GRID_DISPLAY == How to add a new line?
Hello SDN community,
I'm using the "REUSE_ALV_GRID_DISPLAY" function with "i_save = 'X'". How can I solve the following problem: I want to insert a new line into the ALV and after a click on the SAVE Button, the internal table should have this new line too?
Best regards,
Marius Klaus
[click for an example picture|http://pic-hoster.net/upload/0a8b8c5c7a38434f4e0010ceb7f6fbe7.jpg]
Edited by: Marius Klaus on Nov 30, 2009 4:00 PMon the click of add button(for adding an line in grid_display) write the following code.
t_user_input is the table to be displayed in ALV_GRID.
DATA : ob_ref_grid TYPE REF TO cl_gui_alv_grid.
READ TABLE t_user_input INTO e_user_input INDEX 1 .
MODIFY e_user_input(as per user's requirement)
APPEND e_user_input TO t_user_input.
CALL METHOD ob_ref_grid->check_changed_data .
CALL METHOD ob_ref_grid->refresh_table_display.
Regards,
Shekhar -
How to insert a new line in MC1H(maintaining formula)
How to insert a new line in MC1H(maintaining formula)
Can anybody help me with the stepsHi,
1.run transaction SCC4 -> press Ctrl+F4 or the button for change ->double click one the row for your client -> on the field Cross Client Object Changes select Changes to the Repository and cross-client Customizing allowed -> SAVE
2. run MC1H and now you will have access to insert new line in the table
Regards Vassko!
Edited by: Vasil Pavlov on Sep 16, 2008 9:51 AM -
How do i read new line char in jtextarea.getText()?
guys, how do i read new line character in jTextArea.getText()? i'll appreciate ur help tnx..:))
Use a StringRead, then you can treat the text file a file.
-
How do you display multi line text
Hi
How does one display multi line text? I would like to display address information on the screen so that the user can select it and copy/paste it into another application (ms word).
I have the address information as separate columns (address1, address2, city, province, postal code) so I've changed the query on my view object to add it as address1 || chr(10) || address2 || chr(10) || city ....
If I display it on the page as an output text, it all displays as one line (okay, the chr(10) thing did not work but that's beside the point).
In general, is there a way to display multi line text? What component is suitable for this, if there is one?
ThanksYou can use normal outputText components in a panelGroupLayout (vertical layout) and add each attribute to it. The remove the labels or set the components to simple. You can then mark the data in the browser and use normal copy&paste to transfer the data.
If you want to output longer text with line breaks you can use an outputText with escape=false and use the br html tag to generate a line break;
<af:outputText escape="false"
value="+++++++long<br>test<br> this is a long text in multiple lines" id="ot10" truncateAt="#{viewScope.ToggleBean.truncateLength}"/>Timo -
How to Insert a new line in a clob
hi,
i want to create reports as multi-line clob data using PL/SQL procedures.
is there any standard way of inserting a new line when iam generating
this clob data based on the data i fetch from a different table.
i short my question is "How to insert a new line in a clob?"
i tried using the character '\n', but that was of no use.
thanks in advance
rameshYou could always do a:
newLine := '
Since PL/SQL allows a tring to span multiple lines. -
How to add EOL(new line char) to JCheckBox's text??
I need to add new line char to JCheckBox's text.
I have a string and I am adding new line char("\n") to that. Then I set that string as the text for JCheckBox. But it is not adding a new line. If you know the solution to this problem, please let me know.
thanks
amithi artntek,
thanks works well. However Since I have 3 or 4 lines (might have even more) of text for JCheckBox, JCheckBox is aligned to middle of text. Is there any way to align it with the top of the text??
amit -
How to start a new line in a text field?
I tried the following formula to break for a new line but it is not working.
stringvar notes;
stringvar newline;
newline := chr(100);
replace (notes := {HNO_NOTE_TEXT.NOTE_TEXT}, "\r\n", newline);
Any suggestions?How could I accomplish the following.?
Current data in the column.
PREOPERATIVE DIAGNOSES: 1. Right shoulder rotator cuff tear. 2. Right shoulder biceps tendon disease with superior labral tearing. POSTOPERATIVE DIAGNOSES: 1. Right shoulder rotator cuff tear. 2. Right shoulder biceps tendon disease with superior labral tearing. SURGEON: Jane, Doe, MD ASSISTANT: Jane, Doe, PA-C and Bob, Doe MD, orthopedic resident. The assistance of a physician's assistant was required for limb positioning and placement of anchors. ANESTHETIC: Interscalene block plus general. DRAINS: None. COUNTS: Sponge and needle count were correct. MATERIAL FORWARDED TO THE LABORATORY: None. OPERATION PERFORMED: 1. Right shoulder arthroscopic rotator cuff tear. 2. Right shoulder open subpectoral biceps tenodesis. 3. Right shoulder subacromial decompression with acromioplasty. 4. Right shoulder extensive glenohumeral debridement.
I would like the following in MS Excel. I would like to pull the header out into a separate column.
Header
NOTE_TEXT
PREOPERATIVE DIAGNOSES:
1. Right shoulder rotator cuff tear. 2. Right shoulder biceps tendon disease with superior labral tearing.
POSTOPERATIVE DIAGNOSES:
1. Right shoulder rotator cuff tear. 2. Right shoulder biceps tendon disease with superior labral tearing. -
How to add a new line at the end of eTEXT file
Hi,
I have modified the RTF template for the R12.1.3 Positive Pay File report (IBYPOS_PAY_en.rtf). Everything is good, except that the bank requires a "T" (Capital T) character in a new line at the end of the text file. Has any of you came across this before? How do I modify the template to achieve this?
Thank you,
Sinan TopuzI believe this is related to BI Publisher. Any comments would be greatly appreciated.
Thanks,
Sinan -
How to enter a new line or paragraph using voice recognition
Hello,
Does anyone know how to make the voice recognition enter new lines or paragraphs?
When I first got my phone I could simply say "enter", "new line" or "new paragraph" rather quickly and it would advance to the next line, or in the case of paragraph it would be two new lines giving a space between the paragraph.
However, in the last month or so this has stopped working. Now, when I say "enter", "new line" or "new paragraph" it will either spell out the words, or it will add a space.
It's really frustrating, making the feature almost useless because I have to keep popping out to the keyboard to hit the return key.
I'm using the voice recognition software to enter text for the applications "S.Memo" or "Google Drive Documents", on a Samsung Galaxy S3 phone with the 4.1.2 Android Version.
-=JohnYou cannot unintall "S.Memo", as it appears to be part of Samsung's base OS. I can do a force stop and disable on it as well as clear the data, but I cannot uninstall it. That is simply not an option for the app. I'm not going to clear the data because that deletes all the files I've made for it.
I did a force stop on "S.Memo" and then started the app, and the problem persists.
I power cycled the phone and the problem persists.
I did uninstall and reinstall "Google Drive Document" but that did not resolve the problem either.
Also it seems silly to remove and reinstall these apps, when it's the voice recognition software that is having the problem. This problem happens if you simply use voice input. It even happens when editing the phone's contact's information. -
How to display the multiple lines text in a single - String, StringBuffer
Hi,
I have a textarea field named Decription which contains more than one line seperated by new line.I need to display those five lines in a single text without breaking. Is it possible? I am getting ArrayIndexOutOfBoundsException while i reached to the end of the line. Plz help me how to align the below code so that i can display the lines as a single line in my excel sheet.
if(op.getDescription()!=null)
String[] oppDescs = op.getDescription().split("\n");
StringBuffer sb = new StringBuffer();
for(int i1=0; i<=oppDescs.length-1;++i1)
*writeFile(sb.append(oppDescs[i1]), valueWriter);*
} else {
writeFile(op.getDescription(), valueWriter);
private void writeFile(java.lang.Object value,PrintWriter valueWriter)
if(value!=null)
valueWriter.print(value);
}Thanks and Regardsprevious was java1.5
heres a 1.1 - 1.4 version
String[] oppDescs = op.getDescription().split("\n");
StringBuffer sb = new StringBuffer();
for(int i = 0; i < oppDescs.length : i++){
sb.append(oppDescs);
sb.append( '\t' );
writeFile(sb.toString(), valueWriter );Edited by: simon_orange on 31-Oct-2008 13:02
Maybe you are looking for
-
This is more than annoying, the attempt to update my iOS Apps via iTunes 11.4 (18) ends each and every time with a crash of itunes, no way to update. The iPhone refuses to update via WLAN, the only way to update is to get updates via mobile data conn
-
How can I restart media import in final cut pro?
The operation of background activities on Final Cut Pro is often convenient, except when an import gets interrupted by an inadvertant media removal. I usually have multiple SD cards connected to my Mac doing imports, and if I have more media than I
-
my iPhone unexpectedly shut down and now is not turning back on, charging and is not being detected by my laptop, help
-
Camera aren't working, can't take pictures:(
so when i try to open my camera app, then it either wont open or it wil work for a short period of time and then it will start to act wierd and lack and make funny colors:( restarting and reset doesnt help! and my warranty is gone...
-
How to check installed server is ABP + JAVA
Hi, Please let me know , how to check the installed server is ABP+JAVA. and also how do i know whether its an SR2 or SR3.. Thanks