Text editor problems
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TextEditor extends JApplet {
//Declare and create image icons
private ImageIcon openImageIcon = ImageViewer.createImageIcon(
"image/open.gif", this);
private ImageIcon saveImageIcon = ImageViewer.createImageIcon(
"image/save.gif", this);
//Create menu items
private JMenuItem jmiOpen = new JMenuItem("Open", openImageIcon);
private JMenuItem jmiSave = new JMenuItem("Save", saveImageIcon);
private JMenuItem jmiClear = new JMenuItem("Clear");
private JMenuItem jmiExit = new JMenuItem("Exit");
private JMenuItem jmiForeground = new JMenuItem("Foreground");
private JMenuItem jmiBackground = new JMenuItem("Background");
//Create buttons to be placed in a tool bar
private JButton jbtOpen = new JButton(openImageIcon);
private JButton jbtSave = new JButton(saveImageIcon);
private JLabel jlblStatus = new JLabel();
//Create a JFileChooser with the current directory
private JFileChooser jFileChooser1
= new JFileChooser(new File("."));
//Create a text area
private JTextArea jta = new JTextArea();
public TextEditor() {
//Add Menu Items to the menu
JMenu jMenu1 = new JMenu("File");
jMenu1.add(jmiOpen);
jMenu1.add(jmiSave);
jMenu1.add(jmiClear);
jMenu1.addSeparator();
jMenu1.add(jmiExit);
//Add menu items to the OTHER menu
JMenu jMenu2 = new JMenu("Edit");
jMenu2.add(jmiForeground);
jMenu2.add(jmiBackground);
//Add menus to menus lol
JMenuBar jMenuBar1 = new JMenuBar();
jMenuBar1.add(jMenu1);
jMenuBar1.add(jMenu2);
//Set the menu bar
setJMenuBar(jMenuBar1);
//Create toolbar
JToolBar jToolBar1 = new JToolBar();
jToolBar1.add(jbtOpen);
jToolBar1.add(jbtSave);
jmiOpen.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
open();
jmiSave.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
save();
jmiClear.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
jta.setText(null);
jmiExit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
System.exit(0);
jmiForeground.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
Color selectedColor =
JColorChooser.showDialog(null, "Choose Foreground Color",
jta.getForeground());
if (selectedColor != null)
jta.setForeground(selectedColor);
jmiBackground.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
Color selectedColor =
JColorChooser.showDialog(null, "Choose Background Color",
jta.getForeground());
if (selectedColor != null)
jta.setBackground(selectedColor);
jbtOpen.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent evt){
open();
jbtSave.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent evt){
save();
getContentPane().add(jToolBar1, BorderLayout.NORTH);
getContentPane().add(jlblStatus, BorderLayout.SOUTH);
getContentPane().add(new JScrollPane(jta), BorderLayout.CENTER);
/** Open file*/
private void open() {
if (jFileChooser1.showOpenDialog(this) ==
JFileChooser.APPROVE_OPTION)
open(jFileChooser1.getSelectedFile());
/** Open file with specified File instance*/
private void open(File file){
try{
//Read from the specified file and store it in jta
BufferedInputStream in = new BufferedInputStream(
new FileInputStream(file));
byte[] b = new byte[in.available()];
in.read(b, 0, b.length);
jta.append(new String(b, 0, b.length));
in.close();
//Display the staus of the file opening
jlblStatus.setText(file.getName()+ "opened.");
catch (IOException ex) {
jlblStatus.setText("Error opening "+ file.getName());
/** Save file*/
private void save() {
if (jFileChooser1.showSaveDialog(this) ==
JFileChooser.APPROVE_OPTION){
save(jFileChooser1.getSelectedFile());
/**Save file with specified File instance */
private void save(File file) {
try{
//Write the sext in jta to the specified file
BufferedOutputStream out = new BufferedOutputStream(
new FileOutputStream(file));
byte[] b = (jta.getText()).getBytes();
out.write(b, 0, b.length);
out.close();
//Display this status of the save file operation
jlblStatus.setText(file.getName() + "saved.");
catch (IOException ex) {
jlblStatus.setText("Error saving" + file.getName());
}There is a problem with this part of the code:
private ImageIcon openImageIcon = ImageViewer.createImageIcon(
"image/open.gif", this);
private ImageIcon saveImageIcon = ImageViewer.createImageIcon(
"image/save.gif", this);It says it can't find the variable ImageViewer .
Please help :(
Thanks in advance.
What is ImageViewer? It doesn't appear to be a class in Java 5.0 or Java 6.0.
I can't see an import statement for it -are you expecting it to exist in the same folder as your TextEditor class?
Similar Messages
-
In smartform Text editor problem
In smartform in text editor i writing text Invoice number it will in first line Invoice and second line number , Exactly very line taken 7 characters what is problem please give me advise.
hi,
welcome to SDN
just increase ur window width.
or u can adjust it with font size.
do formatting andeach time check print preview.
coz not alwys print preview and text editor is same. -
Module Pool Text Editor Problem
Hi
I have developed module pool program which has 3 tab strips. In the last (3rd) Tab Strip I need to input Long Text. I have the done the coding but when I go to the Last tab and then come back to any other tabs, the text editor is overwriting the other fields in the other tabs. Can any tell how to solve this problem
This is he code I have written
****90000******Screen
PROCESS BEFORE OUTPUT.
MODULE status_9000.
MODULE modify_screen9000.
module test_me.
LOOP AT t_operation INTO s_operation WITH CONTROL toperation.
MODULE move_data.
MODULE modiy_screentblctrl.
ENDLOOP.
CALL SUBSCREEN sub1 INCLUDING sy-repid '9001'.
CALL SUBSCREEN sub2 INCLUDING sy-repid '9002'.
CALL SUBSCREEN sub3 INCLUDING sy-repid '9003'.
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
CHAIN.
FIELD zaodheader-heatnum MODULE check_heatnumber.
ENDCHAIN.
LOOP AT t_operation.
MODULE update_itab.
ENDLOOP.
MODULE user_command_9000.
CALL SUBSCREEN sub1.
CALL SUBSCREEN sub2.
CALL SUBSCREEN sub3.
**************9003*****
PROCESS BEFORE OUTPUT.
MODULE STATUS_9003.
MODULE display_texteditor.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_9003.
**************9003*****
DATA : ccont TYPE REF TO cl_gui_custom_container,
tedit TYPE REF TO cl_gui_textedit.
MODULE display_texteditor OUTPUT.
CREATE OBJECT ccont
EXPORTING
parent =
container_name = 'CC'
style =
lifetime = lifetime_default
repid =
dynnr =
no_autodef_progid_dynnr =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6 .
IF sy-subrc <> 0.
ENDIF.
CREATE OBJECT tedit
EXPORTING
max_number_chars =
style = 0
wordwrap_mode = wordwrap_at_windowborder
wordwrap_position = -1
wordwrap_to_linebreak_mode = false
filedrop_mode = dropfile_event_off
parent = ccont
lifetime =
name =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " DISPLAY_TEXTEDITOR OUTPUT
Edited by: kumar1819 on Apr 7, 2010 8:05 AM
SolvedHi kumar,
**************9003*****
PROCESS AFTER INPUT.
MODULE USER_COMMAND_9003.
Case SY-UCOMM.
When 'TAB2'.
Call screen 9002.
**************9003*****
In 9001 and 9002 screen what code u r writing.
Regards,
Raj. -
Hi,
I'm using stellent 7.5.1.
I cannot upload pics and/or update text via the rich text editor .. The editor field opens, but just stays grey, i.e. they don’t have any option of entering or saving text.
I have even checked Java version its fine.
Do i need to change any config setting to enable to editor again?
ThanksThe 7.5 editor uses an ActiveX plugin, so it only works in Internet Explorer. There may also be security settings in Internet Explorer that might interfere with the way it works.
If you get it going, try this article for some enhancements to the editor.
http://webmonkeymagic.blogspot.com/2007/12/get-enhanced-contributor-editing.html -
Hi, my editor auto format my code as below. How to reset the
newline symbol and ">>>"?
http://i69.photobucket.com/albums/i59/ddlam2/why2.pngYou can change this from the actions panel menu at the top
right of the actions panel, but the easiest way is:
Use Ctrl-Shift-8 to toggle hidden characters -
Long text editor - sign problem
Hi,
Currently I am facing an issue that the & sign is not being displayed correctly in the Long text editor. It is shown as '<(>&<)>' in the transaction once I input my value in the graphical editor , save and come back.
Please help...
Thanks
PraneethHi Sandra,
I am also talking about the same issue in IW32 and the internal SAP program is not doing a correct conversion due to which the wild characters are entered into the long text window on IW32.
I received an answer for my OSS note and they say it is how the system is ..please see the comments from SAP below ...
26.08.2011 - 12:37:23 CET - Reply by SAP
Hi,
I am sorry, but the behaviour which you describe is correct.
I will try to explain the meaning of the special characters and
why they have to be there: In Sapscript there are some characters,
which have a special meaning. E.g. a '&' starts a symbol, a '<'
starts a character format, etc. So if you use e.g. a '&' in your
text, this Sapscript needs the information, whether the '&' shall
start a symbol or whether it shall be printed as '&'.
So if you want to print the '&' as '&', the character must be masked.
This is done via the characters <(>...<)>. So when you enter
a '&' (and when it is not sure, whether it may start a symbol),
the Sapscript internally saves the character as <(>&<)>.
Usually this should be no problem: If you process the text via
the Sapscript, you will not notice the masking characters. The
graphical editor will not display them. And if you print the text
via a Sapscript form or a Smartform, you will not see them.
Only if you look into the internal table, which is returned
by EDIT_TEXT or READ_TEXT, you will see the characters.
(and the old Sapscript editor displays them, too, because it
is displays the text in the Sapscript-internal format).
If you process the internal table yourself, you must take this
into consideration. E.g. if you want to convert the
Sapscript-internal ITF format which is returned by EDIT_TEXT
into 'normal' text format, you can use the function module
CONVERT_ITF_TO_ASCII.
Kind Regards,
Marian O'Connell
Support Consultant
AGS Primary Support
Visit the Enterprise Asset Management (EAM) forums:
Enterprise Asset Management (SAP EAM) -
PC Suite 6.83.14.1 problem with Text Editor
Hi,
I'm getting error while executing the Text Editor of PC Suite and Click on To. for selecting the address.
I'm using USB cable to connect my phone with the Notebook.
I found the below error.
AppName: textmessageeditor.exe AppVer: 6.83.108.5 ModName: msvcr71.dll
ModVer: 7.10.3052.4 Offset: 00010440
In order to troubleshoot, I have carried out the following activities :-
1. Uninstalled the PC Suite 6.83.14.1
2. Used the Nokia PC Suite Cleaner
3. Installed the PC Suite 6.83.14.1
But the problem still persists.
My System details are as follows:
Operating system:
Microsoft Windows XP
Build 2600
Service Pack 2
Language: English
Language for non-Unicode programs: English
Locale: English
Input language: English
Nokia PC Suite:
Version 6.83.14.1
Language: English
Connectivity Cable Drivers:
Version 6.83.9.0
PC Connectivity Solution:
Version 7.7.10.0
No supported Bluetooth stack found
Regards,
DwarikaPlease find the logs attached.
Attachments:
e8a5_appcompat.txt 1 KB -
Hiii..
Actually I am facing some problems with the text editor font. Since I have some part of text was written in arabic (For labels), currently these parts are not readable and appears like this:
"ط§ط³ظ⦠ط§ظâط¥ط¯ط§ط±ط© ط§ظâطھط¯ط±ظٹط¨ظٹط©"
I have tryed to fix that using:
Tools --> Preferences --> Code Editor --> Font
However it still arise.
Please reply me the solution if you have some idea about this..
Regard'sWhich JDeveloper version?
What is the character encoding settings for your project's compiler in the project properties? -
I am displaying a network graphics screen. Now in 1 of the user-command i want to display a text editor in a popup. I used CALL FUNCTION 'TERM_CONTROL_EDIT' . But when the editor is coming it is actually not a editor just a pop-up window, and i cannot write anything in that.I dont understand where the problem is.Cant i call a text editor as a popup in default screen 1000 (used by sap to generate network graphics)
Hi Have used the Class
use this it will help to you.
g_text_container TYPE REF TO cl_gui_custom_container,
g_text_editor TYPE REF TO cl_gui_textedit,
CREATE OBJECT g_text_container
EXPORTING
container_name = 'EMAIL_BOX'.
CREATE OBJECT g_text_editor
EXPORTING
parent = g_text_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
CALL METHOD g_text_editor->set_toolbar_mode
EXPORTING
toolbar_mode = 0.
CALL METHOD g_text_editor->set_statusbar_mode
EXPORTING
statusbar_mode = 0.
For this u need to craete a screen se 51.
Thanks, -
Problem in reading the modified text from text editor
Hi all,
Im using text editor for saving the long text entered in the text editor as standard text in So10 tcode.
Here im facing an issue in reading the text from text editor. That is, when the text is entered by the user for first time, then the below method reads the text successfully. But when i do some changes in the existing text present in the text editor and try to read, then the modified text is not returned by the below method.
I use the "CALL METHOD g_editor_ftext1->get_text_as_stream" to read the text. Given below is my code.
CALL METHOD g_editor_ftext1->get_text_as_stream
IMPORTING
text = ig_text_table
is_modified = g_xthead_updkz
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
OTHERS = 3.
The return value of "is_modified" is always returned as 0.
Could anyone pls help how to read the modified text using the above method?Check if this works and if it works then there should be some mistake in your coding
REPORT abc.
PARAMETERS:pa1 TYPE bwart.
DATA: container TYPE REF TO cl_gui_docking_container,
editor TYPE REF TO cl_gui_textedit,
report TYPE syrepid,
mod TYPE i,
modon TYPE i.
DATA:tlines TYPE TABLE OF tdline,
wa_tlines TYPE tdline.
AT SELECTION-SCREEN OUTPUT.
report = sy-repid.
IF container IS INITIAL.
CREATE OBJECT container
EXPORTING repid = report
dynnr = sy-dynnr
side = container->dock_at_left
extension = 1070.
CREATE OBJECT editor
EXPORTING
parent = container.
ENDIF.
wa_tlines = 'This is test before a change'.
APPEND wa_tlines TO tlines.
CALL METHOD editor->set_text_as_r3table
EXPORTING
table = tlines
EXCEPTIONS
OTHERS = 1.
CALL METHOD editor->go_to_line( 1 ).
START-OF-SELECTION.
CLEAR tlines[].
CALL METHOD editor->get_text_as_stream
EXPORTING
only_when_modified = '1'
IMPORTING
text = tlines
is_modified = modon
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
OTHERS = 3.
IF modon = 1.
WRITE 'Changed'.
ELSE.
WRITE 'Not changed'.
ENDIF.
WRITE modon. -
Making Rich Text Editor with PHP in Dreamweaver - Problem with CKEditor...
Hi,
I am developing a website in Dreamweaver and using the platform of PHP and MYSQL. I need to develop a Rich Text Editor just like the one I am typing at the moment. With my recent searches I have come across with CKEditor as one of the possibilities to add a Rich Text Editor to my website. I have seen older versions of CKEditor also known as FCKEditor which I believe unfortunatley is out of date and obsolete now (discontinued). I cannot find any of the downloads now from anywhere on the web.
I can find FCKEditor tutorials with PHP, but can not find CKEditor tutorials for PHP (when I try googling it, it always gives me FCKEditor page). Can anyone please help me and tell me if I can still make Rich Text Editor using CKEditor and PHP?
If yes, please guide me how? Any tutorials or reading material will be very helpful.
Regards,
Bilal . KhanYes, you absolutely can use CKEditor to create a rich text editor with PHP/MySQL.I have tried several editors and it's my choice.
Here is a link to the documentation page:
http://docs.cksource.com/
CKFinder is also very good in conjunction with CKEditor. Although it costs $59/per website, it's better than the free alternatives. -
Rich text editor (apex 4.0)
using blue gray theme and a page with a rich text editor. Expanding the rich text options displays the text body p below the text area that persists even if you close the rich text options. Anybody know how to get rid of that behavior?
I think your mixing 2 technologies.
At 1 side you have xml in combination with xsl (style sheets used in BI Publisher and FOP) to generate your pdf. And at the other side you have HTML...
XML and HTML are 2 entirely different technologies which you can not mix this simple. I investigated the same problem as you had, and in the end I ended up using jasperreports instead of FOP.
Maybe BI Publisher has some html regions which you could insert into your word document but I doubt it cause more people have asked the same question on this board...
So my advice: use jasperreports (also it is free for commercial usage)
Success
Br,
Nico -
Text editor in Score module agonizingly clunky! Fix?
When creating scores from midi regions, the text editor drives me nuts when adding lyrics: The word/character positioning is different between text edit/create mode and what appears on the screen after editing, and different again between that and what appears in print preview mode or actual print-out. This is absolutely crazy-making when trying to line words/syllables up with their corresponding notations!
Also the cut & paste functions don't work as in any other text editor I've seen.
Also-also I can't get it to accept a new default font and size.
Suggestions? Dr. Kevorkian's phone number?
Thanks!Hi,
it looks like you have some problem with RFC. It stopped on the following line:
* Communication error in RFC-Call
message x628(ke) with 'RFC_ERROR' subrc msg_text.
Ask your basis guy to check it. The job on application server tried to connect to the central instance and it failed. The job run on central instance does not need to make any RFC call. Hence there is no problem in this case.
Regards -
Hi,
I am facing the problem that when I read the content of the
texteditor, store it in a javascript variable, and then write it
again into the editor area, all line breaks (not html line breaks,
just the line breaks for the code structure) are gone.
For Example if the content of the Editor is the following:
Test line 1
Test line 5
If I know call my function the value of the texteditor will
be somethign like: "Test line1 Test line 5"
I tried finding the linebreaks and replacing them (either \n,
\r or \n\r) but had no success in doing that.
My code of the function:
var theDom=dw.getDocumentDOM();
var temp = theDom.documentElement.outerHTML;
theDom.documentElement.outerHTML="";
theDom.documentElement.outerHTML=temp;
So I assume Javascript and dw are using different formats,
but I cant find much information about whats being used.
Any help appreicated!
Best,
DavidHi Brent,
Use CHR(10) in text editor for a new line. for example( 'SAP' & CHR(10) & 'Visual' & CHR(10) & 'Composer') will display like,
SAP
Visual
Composer
Hope it helps....
Regards
Basheer -
How to call a text editor from a module pool program
Hi All,
I want to call the text editor from my modulepool program. Enter my text in it and save it.This text needs to be saved in a Z-program with 2 fields as primary keys. The next time while I call this same record from this z table, I need to fetch the existing text and display it.
The user now can put in additional text and can again save it. This process thus goes on..
If anyone has worked in this type of scenario, then please help me in doing this.
Useful answers will surely be rewarded.
Thanks,
Susanth.Hi Sushanth,
We save the text not as fields in a ztable directly but as a text.Please check the format below since it is based on a working code....
first you need to create a text in s010 transaction...
there should be some key based on which you plan to save the text..imagine it is Purchase order then..PO+item numner is always unique.eg:0090010(900PO/item10).so in the code you can append these two and they will be unique..so you can always retrieve them,overwrite,save them anytime you need
**************data declarations
TYPES: BEGIN OF TY_EDITOR,
EDIT(254) TYPE C,
END OF TY_EDITOR.
data: int_line type table of tline with header line.
data: gw_thead like thead.
data: int_table type standard table of ty_editor.
****************fill header..from SO10 t-code..when you save you need the unique key..youfill it here and pass it in save_text function module
GW_THEAD-TDNAME = loc_nam. " unique key for the text -> our unique key to identify the text
GW_THEAD-TDID = 'ST'. " Text ID from SO10
GW_THEAD-TDSPRAS = SY-LANGU. "current language
GW_THEAD-TDOBJECT = 'ZXXX'. "name of the text object created in SO10
*To Read from Container and get data to int_table
CALL METHOD EDITOR ->GET_TEXT_AS_R3TABLE
IMPORTING
TABLE = int_table
EXCEPTIONS
ERROR_DP = 1
ERROR_CNTL_CALL_METHOD = 2
ERROR_DP_CREATE = 3
POTENTIAL_DATA_LOSS = 4
others = 5.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop data from int_table and save to int_line-tdline appending it.
*save the text
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
HEADER = GW_THEAD
TABLES
LINES = InT_LINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5.
IF SY-SUBRC 0.
ENDIF.
*To pass to Container
CALL METHOD EDITOR ->SET_TEXT
hope that the above sample with helps you solve the problem
Please check and revert,
Reward if helpful
Regards
Byju
Maybe you are looking for
-
Problem with printing to a text document
Well to start off...here is my code. import java.io.*; import java.util.*; // Mike Hatch public class project12 static Scanner console = new Scanner(System.in); Scanner inFile = new Scanner(new FileReader("f:\\JAVA\\projects\\receipts.txt"));
-
Get the active cell in a table on a mouse click, so I can change its color
Hi guys, I am looking at a small application. I have a table. When a user clicks on a particular cell, I need the cell coordinates so that I can change its attributes (e.g. color change) by clicking a button. Edit position property of the table give
-
Planning function in process chains.
Hi there Can we include a planning function in a process chain directly or it needs to be via Planning sequence. Thanks Sarah
-
Hi Guys, I have a project requirement where I would create a custom application for financial institute. One of the requirements is, input and output could be in the form of pdf files. So in a way, I have to parse pdf files and use the data and gener
-
LOB locators cannot span transactions
Hi, I'm trying to call an Oracle stored procedure with one of the parameters being a Clob. First I select a clob from a temporary table, manipulate it and then call the stored procedure. I always get the error "java.sql.SQLException: ORA-22990: LOB l