How to blink the text with in JTable Cell?
Hi Friends,
I am relatively new to Java Swings. I have got a requirement to blink the text with in the JTable cell conditionally. Please help with suggestions or sample codes if any.
Thanks in Advance.
Satya.
I believe Swing components support HTML tags.
So you might be able to wrap your text in <BLINK>I am blinking !</BLINK>
tags.
If that doesn't work, you probably have to create your own cell renderer, and force a component repaint every second or so... messy.
regards,
Owen
Similar Messages
-
How to aling the text in a JTable???
I use this code to make a vertical header like in excel. The thing is that i want to aling the text in that column but i couldn´t. I try to set the render, but i loose the header render in the column. Anyone know how to aling the text in that column with out loosing the header effect????
i post a code that i use as model for my project.
package com.chuidiang.ejemplos;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.WindowConstants;
import javax.swing.table.DefaultTableModel;
* Ejemplo de cómo hacer una "cabecera" lateral en un JTable. Idea original de
* Leunamal en
* http://foro.chuidiang.com/java-j2se/tabla-de-referencias-cruzadas-en-java/
* Básicamente consiste en hacer que la primera columna: - No sea editable. - No
* sea seleccionable. - Tenga el mismo render que el JTableHeader superior.
* @author chuidiang
public class CabeceraLateral {
* Crea y visualiza una ventana con un JTable que tiene cabecera en la parte
* superior y en la columna izquierda
* @param args
public static void main(String[] args) {
// Un modelo de datos que hace la primera columna (la de
// la cabecera lateral) no editable.
DefaultTableModel tm = new DefaultTableModel(10, 5) {
@Override
public boolean isCellEditable(int row, int column) {
if (0 == column)
return false;
return super.isCellEditable(row, column);
// Titulos para la cabecera superior. El primero es vacio,
// puesto que corresponde
tm.setColumnIdentifiers(new String[] { "", "A", "B", "C", "D" });
// Valores para la primera columna, que es la cabecera lateral.
for (int i = 0; i < 10; i++)
tm.setValueAt(i + 1, i, 0);
// JTable al que se le pasa el modelo recien creado y se
// sobreescribe el metodo changeSelection para que no permita
// seleccionar la primera columna.
JTable t = new JTable(tm) {
@Override
public void changeSelection(int rowIndex, int columnIndex,
boolean toggle, boolean extend) {
if (columnIndex == 0)
super.changeSelection(rowIndex, columnIndex + 1, toggle,
extend);
else
super.changeSelection(rowIndex, columnIndex, toggle,
extend);
// Se pone a la primera columna el render del JTableHeader
// superior.
t.getColumnModel().getColumn(0).setCellRenderer(t.getTableHeader().getDefaultRenderer()); //here i set the render for the column. But when i try to aling the text, this column loose the effect.
// Creación y visualización de la ventana completa.
JFrame v = new JFrame("Cabecera lateral");
JScrollPane sp = new JScrollPane(t);
v.getContentPane().add(sp);
v.pack();
v.setVisible(true);
v.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}The word is "align" not aling.
To right-align the first column, you can do this in a prepareRenderer override. JTable t = new JTable(tm) {
@Override
public void changeSelection(int rowIndex, int columnIndex,
boolean toggle, boolean extend) {
if (columnIndex == 0) {
super.changeSelection(rowIndex, columnIndex + 1, toggle,
extend);
} else {
super.changeSelection(rowIndex, columnIndex, toggle,
extend);
@Override
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
Component c = super.prepareRenderer(renderer, row, column);
if (column == 0) {
((JLabel) c).setHorizontalAlignment(JLabel.RIGHT);
return c;
};You can find other alternatives to your approach by searching the net for "[JTable row header|http://www.google.com/search?q=JTable+row+header]"
db -
Details: Numbers not translating an Excel document with column headings where the text is rotated counter clockwise 90 degrees with-in the cell. Can you tell me how I can rotate the contents with-in a cell?
Numbers does not have rotated text within cells. You can place a text box over the cell that has rotated text but you cannot rotate text within a cell.
-
How to align the text in justify format with SQL Server Reporting Services?
How to align the text in justify format In SQL server Reporting Services? Is there any code to do so?
Hi,
I'm afraid that if you want to have this kind of functionality, you will need to write a custom control. Here is an example: http://msdn2.microsoft.com/en-us/library/ms345265.aspx. The issue with custom controls is that it needs to be known by all the reportservers that will render your report.
Greetz,
Geert
Geert Verhoeven
Consultant @ Ausy Belgium
My Personal Blog -
How to find the text id & object name to be used with read_text ?
Hi All
how to determine the text id & object name associated with PO to be used with FM read_text ?
Regards
JamanHi,
For PO there will be Header Texts and Item texts.
For header texts just Take the PO number as TDNAME.
for Item texts Conactenate the PO number and Item Number and use as TDNAME.
in ME23N Go to any text.Double click on it
It will take you to text editor.
GOTO-> header
it will display the TEXT ID,TEXTNAME,LANG and TEXT OBJECT etc
Similarly for every text you will find and use;
Regards,
Anji -
I cannot figure out how to make the text larger in a received email. The finger method doesn't work and I can find no tool bar as I can for composing emails. I can find nothing in settings. Please help and thank you in advance.
Hi there,
Download a piece of software called TinkerTool - that might just solve your problem. I have used it myself to change the system fonts on my iMac. It is software and not an app.
Good wishes,
John. -
How to print the text in only last but one page in sapscripts
hiiiiiiiiiii,
explian how to print the text in only last but one page in sapscripts? wher to write the code? plz if possible explain in detail with an example?Hello,
The total no pages is given by &SAPSCRIPT-FORMPAGES& command.
So u can handle the situation in ur form like this
/: if &PAGE& = &SAPSCRIPT-FORMPAGES&
p1 TEXT
/: endif
Try in this way it may help u.
Regards -
How to clear the text in the Text Editor
Hi all,
I created a Text editor and also i am having language field in the screen.
whenever i change the language auomatically the text has to change when the text exists for that
language.
this is working fine, but when the Text exist , the text editor should be blank.
But it is carrying the Previous editor text itself into it .
How to clear the text in the Editor.
Regards,
MadhaviHello Madhavi
The simple report ZUS_SDN_TEXTEDIT_CONTROL shows how to switch the texteditor contents when changing the language.
*& Report ZUS_SDN_TEXTEDIT_CONTROL
*& Thread: how to clear the text in the Text Editor
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1145272"></a>
*& By default the itab GT_OUTTAB contains texts in DE and EN.
*& To switch the language directly enter into the command window:
*& LANGU=DE, LANGU=EN or LANGU=FR
REPORT zus_sdn_textedit_control.
TYPE-POOLS: abap.
TYPES: ty_t_text TYPE TABLE OF as4text
WITH DEFAULT KEY.
TYPES: BEGIN OF ty_s_outtab.
TYPES: language TYPE spras.
TYPES: text TYPE ty_t_text.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA: gt_outtab TYPE ty_t_outtab,
gs_outtab TYPE ty_s_outtab.
DATA: gd_language TYPE spras.
DATA: go_docking TYPE REF TO cl_gui_docking_container,
go_textedit TYPE REF TO cl_gui_textedit.
DATA: gd_okcode TYPE ui_func,
gd_repid TYPE syst-repid.
START-OF-SELECTION.
PERFORM fill_texts.
gd_language = syst-langu.
PERFORM init_controls.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM set_text_editor.
* NOTE: dynpro does not contain any elements
" ok-code => GD_OKCODE
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
TRANSLATE gd_okcode TO UPPER CASE.
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'LANGU=DE' OR
'LANGU=EN' OR
'LANGU=FR'.
PERFORM get_text_editor.
SPLIT gd_okcode AT '=' INTO gd_okcode gd_language.
PERFORM set_text_editor.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form FILL_TEXTS
* text
* --> p1 text
* <-- p2 text
FORM fill_texts .
* define local data
DATA: ld_string TYPE string.
gs_outtab-language = 'EN'. REFRESH: gs_outtab-text.
ld_string = 'Good morning'.
APPEND ld_string TO gs_outtab-text.
APPEND gs_outtab TO gt_outtab.
gs_outtab-language = 'DE'. REFRESH: gs_outtab-text.
ld_string = 'Guten Morgen'.
APPEND ld_string TO gs_outtab-text.
APPEND gs_outtab TO gt_outtab.
gs_outtab-language = 'FR'. REFRESH: gs_outtab-text.
ld_string = space.
APPEND ld_string TO gs_outtab-text.
APPEND gs_outtab TO gt_outtab.
ENDFORM. " FILL_TEXTS
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
* repid =
* dynnr =
* side = dock_at_left
* extension = 50
* style =
* lifetime = lifetime_default
* caption =
* metric = 0
ratio = 90
* no_autodef_progid_dynnr =
* name =
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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_textedit
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 = go_docking
* 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.
ENDFORM. " INIT_CONTROLS
*& Form SET_TEXT_EDITOR
* text
* --> p1 text
* <-- p2 text
FORM set_text_editor .
BREAK-POINT.
CLEAR: gs_outtab.
READ TABLE gt_outtab INTO gs_outtab
WITH KEY language = gd_language.
CALL METHOD go_textedit->set_text_as_stream
EXPORTING
text = gs_outtab-text
EXCEPTIONS
error_dp = 1
error_dp_create = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " SET_TEXT_EDITOR
*& Form GET_TEXT_EDITOR
* text
* --> p1 text
* <-- p2 text
FORM get_text_editor .
CLEAR: gs_outtab.
CALL METHOD go_textedit->get_text_as_stream
EXPORTING
only_when_modified = cl_gui_textedit=>true
IMPORTING
text = gs_outtab-text
* is_modified =
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
MODIFY gt_outtab FROM gs_outtab
TRANSPORTING text
WHERE ( language = gd_language ).
ENDFORM. " GET_TEXT_EDITOR
Regards
Uwe -
How to enlarge the text in the "email subject/header plane"
in Thunderbird email, the subject of the email and the email message are in to different planes. No problem enlarging the "message text, words" in the "body" of the email. How to enlarge the "text, font or words" of the "subject" in the subject/header plane? Don't want to open email if I'm not sure of it, and can't be sure of opening emails if I can't SEE the subject of the email. Surely I'm not the only one with this problem.
Thanks! Works great!
-
How to Insert the Text in Selected Text Frame-Reg.
Dear all,
I am using the SnipperRunner - SDK, and create the TextFrame, but I can't insert the Text in the Particular Frame. so please give me the soultions,
(*) Create TextFrame is ok,
(*) Select TextFrame is also ok,
(*) now, my Query ->
How to Insert the Text in the Selected Frame?. (or)
How to Link the Selectable Frame and my Text.? (or)
How come to know the TextFrame is select?.
Please any one can suggest me through the Coding....I will appreciate you...
Thanks & Regards,
T.R.Harihara SudhaNHi,
you have to get the TextModel associated with the textframe. Once you got that, ITextModel has an Insert()-method. You could also process kInsertTextCmdBoss - there are quite a few examples around. I believe WriteFishPrice also inserts text into a frame, just as an example. Good luck ...
Bernt -
How to wrap the text in column headers?
Hi Friends,
Can anyone please suggest how to wrap the text in column headers of a Java WebDynpro table?
I believe that caption is the only UI element that a column header can have and it does not allow wrapping of the text.
My original requirement is as follows,
In a table I need to dynamically set the width of the columns according to the width configured by the user in some other view. All the columns of the table are dynamically rendered.
Now what happens is when the user sets the width of the column to a rather low value, say 15 pixels, then the column is displayed like
Supplier Catalog Name
Sheila
Catalog
Name
Dropdown
As you can see it looks rather odd.
Supplier Catalog Name is the header of the column and I use IWDCaption for header.
Sheila Catalog Name Dropdown is the value of a particular row at the specified column. I am using a TextView as the TableCellEditor.
I think what is happening here is that the framework wraps the text in the TextView according to the width specified (15px) and then the column width is extended because it can not accommodate the text (Supplier Catalog Name ) of the column header.
We are using SAP NetWeaver Development Studio 7.0.12 as the IDE.
I searched some forums and many people have suggested using scrollable columns but I don't understand how it will help in wrapping the text in a column header.
Any help would be of great advantage.
Thanks
AmitHi Deepti,
Thanks a lot for the answer but the option that you have specified does not wrap the text. Instead it truncates the text being displayed and only the substring of the text which could be displayed in the given pixels is displayed.
I need to show the whole text wrapped (Meaning if the width of the column is not sufficient then the text goes into the next line).
Ayyapparaj,
Thanks to you too for an helpful answer. It seems that the Netweaver has finally come up with a way to wrap the text in the column headers but as Manoj pointed out, I do not see the property headerTextWrapping for a table column, Can you please specify which version of netweaver supports it?
We are using SAP NetWeaver Development Studio 7.0.12 as the IDE.
Thanks
Amit Kapoor -
How to print the texts retrived by using READ_TEXT fun module in Smartform
Please tell me how to print the text which is rertrived by using the READ_TEXT function module in smartform.
I have coded all things in the program lines and in that i am retriveing the long texts.
I am getting the text lines in my internal table clearly, the thing is that I am not able to pass these lines to the text.
I have to print the trouble ticket. in that the notes log I have to pass.
its urgent. Points will be rewarded for any type of clue. whether it will work or not.There are a few ways to do it. If you need to take all of the text in the text type, in your SF text element choose "Include Text".
Populate the fields with the data that corresponds to the text type. It is similar to the interface to the FM "Read_Text.
Text Name
Text Obje
Text ID
Language
Encase any variables with the "&" symbol.
If you have already coded the call to the FM "READ_TEXT" and loaded the text into an internal table, create a loop and loop through the itab. Inside of the loop create a text element and add a variable in the text element for the field you are looking to output. -
How to encrypt the text in password field in Oracle Forms version 6i
Need help!
How to encrypt the text in password field in Oracle Forms version 6i?
one way is to change the settings in the property palette. Can somebody provide me some script to be run while the form is running which will enable the password to be encrypted?
Thanks!Hello,
Do you mean "hidden" (replaced with stars) or encrypted (that needs to be decrypted ?
Francois -
How to get the text in a label which is imbeded in a JTextPane
I have created a JTextPane that has 5 JLabels inserted in the text. I have attempted to get the text with the following code snippet.
Component[] lbl = new Componennt[DisplayLetterPane.getComponentCount()];
// JTextPane DisplayLetterPane; is defined previously
lbl = DisplayLetterPane.getComponents();
int componentIndex = 0;
String lblText = new String(((JLabel)lbl[componentIndex]).getText());I have run a dump of the sytledDocument of the JTextPane and I see the JLabel listed as a component.
When this snippet is executed I get the following:
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.text.ComponentView$Invalidator
When I check the character where the component for the JLabel is located in the styled document it does not find an instanceof JLabel.
How can I get the text from the labels.
Thank you in advance!JTextPane jtp = new JTextPane();
for (int i = 0; i <5; i++) {
jtp.add(new JLabel("labelText"+i));
Component[] lbl = new Component[jtp.getComponentCount()];
// JTextPane DisplayLetterPane; is defined previously
lbl = jtp.getComponents();
int componentIndex = 0;
for (int i = 0; i < lbl.length; i++) {
System.out.println(((JLabel)lbl).getText());
When I do like the above, it just works fine. Can u share a little bit more of your code? -
How to display the text as a Bold in the Text Element of a Smart Form
Hi,
I created one Smart Form.
In that i created the Text element.
I provide some data also in that.
It is coming as a MS WORD.
I executed my smart form.
Customer Number: &WA_KNA1-KUNNR&
it display the data of the particular customer.
But i need to display the Customer Number as BOLD or else Increase the Size.
For this also I created one SMARTSTYLE.
In that I created the Paragraph and Character Formats also.
Now i assignee that SMARTSTYLE in the Output Option Tab of the Text Element also.
But i unable to get the CUSTOMER NUMBER in Bold.
In MS WORD we have BOLD button.
I selected the Text and Press the BOLD button. At that time it is Highlighted.
Whenever i press the SAVE Button.
Then it is not saved with BOLD.
It is coming in Normal Format.
In the ECC 6.0. I am unable to get the Text as a BOLD.
This text Element is like a MS WORD.
Can you please tell me how to display the Data with BOLD. please tell me. I am unable to get that one.
Thank You.
Regards,
B. Krishna.Hi,
Check where u have given BOLD. In character Format or in Paragraph format.
In SMART FORM,
1. Change to OLD EDITOR if u are confused with the new one.
(This can be done by clicking the button left to new editor ).
2. If it is PARAGRAPH FORMAT,
Give the name of paragraph format in the editor.
P1 &WA_KNA1-KUNNR&
If it is CHARACTER FORMAT,
<C1> &WA_KNA1-KUNNR&
Thanks,
Nithya.
Maybe you are looking for
-
Error while calling a procedure from ESB
Hi, I am calling a procedure from ESB using DB adapter. and in the routing rules i am mapping the i/p values for schema to procedure input variables using mappings(transformation) but the values are going as null to the procedure call. Please help me
-
How can I transfer Voice Memos from my iPhone to my computer?
Dear Iphone users, I have a very nice Iphone. I know how to transfer the pictures on my Iphone to my computer but I do not know how to transfer my "audios" (from the "dictaphone" function in French). How can I do that ? Thank you very much
-
Need help reinstalling my cd/dvd-rom
Some how I deleted my cd/dvd-rom. I can't play cd's or movies. I have not found the software to reinstall my driver. My laptop is p105-6114 with windows xp. I did not get a disk when I bought it.
-
Unable to restore/update iPhone. Error 14
I was about to update my iPhone today when iTunes gave me an error and now I'm stuck in an endless loop with a non-working phone. The update failed and iTunes prompted me to restore the phone. I went ahead with it and after about 5 minutes i receive
-
Best Page size in BI Publisher
hi 2 all Kindly confirm that which page size is best for every printer in BI Publisher. Actually my report have 22 columns , 15 columns are numeric and amount fields , which i adjust column with narrow that half portion of amount display at top and o