How to Capture Multiple Line String using Regular Expression?
Hi,
I have a simple program like this:
What I want to accomplish is to capture everything between >>start and >>end using a single Match Regular Expression node. It seems that setting multiple? to True or False does not help.
I am using LabVIEW 2012.
If it is impossible to capture it using a single node, that is fine. But I want to make sure that I can make full use of this node without combining serveral others.
Thank you!
TailOfGon
Certified LabVIEW Architect 2013
Solved!
Go to Solution.
Thank you for the fast response! Your solution worked in the example case
After I saw your post, I was finally able to step forward. But I still wanted to make use of dot notation due to the limitation of characters that match with \w.
I made some more modification to your regular expression then now it seems working for all characters:
>>start((?:\s|.)*)>>end
Thanks!
TailOfGon
Certified LabVIEW Architect 2013
Similar Messages
-
Format string using Regular Expression
Input string output format...
SELECT q'<select ab_c "ABC", efg "EFG" from dual>' str FROM DUAL
Output:
STR
select ab_c "ABC", efg "EFG" from dual
Required output format using regular expression...
STR
select 'ab_c' "ABC", 'efg' "EFG" from dualRegular expressions have many limitations as parsing tools, and you didn't specify the rules you wanted. This expression puts quotes around the non blank string before a quoted string:
SELECT regexp_replace(q'<select ab_c "ABC", efg "EFG" from dual>',
'([^" ]+)( +"[^ ]*")' , '''\1''\2' ) str FROM DUAL;
STR
select 'ab_c' "ABC", 'efg' "EFG" from dual
{code}
It is not robust - a missing " will confuse it, and you should be using bind variables anyway. -
Spliting a large string using regular expression which contain special char
I have huge sting(xml) containing normal character a-z,A-Z and 0-9 as well as special char( <,>,?,&,',",;,/ etc.)
I need to split this sting where it ends with </document>
for e.g.
Original String:
<document>
<item>sdf</item>
<item><text>sd</text</item>
</document>
<document>hi</document>
The above sting has to be splited in to two parts since it is having two document tag.
Can any body help me to resolve this issue. I can use StringTokenizer,String split method or Regular expression api too.manas589 wrote:
I used DOM and sax parser and got few exception. Again i don't have right to change xml. so i thought to go with RegularExpression or some other way where i can do my job.If the file actually comes in lines like what you posted, you should just be able to compare the contents of each line to see if it contains "</document>" or whatever you're looking for. I wouldn't use regex unless I needed another problem.
I got excpetion like: Caused by: org.xml.sax.SAXParseException: The entity "nbsp" was referenced, but not declared.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)So then it isn't even XML.
Edit: sorry, I just realized why you're considering all of these heavy-duty ideas. It's just that you don't know how to break the string into lines. You do it like this:
BufferedReader br = new BufferedReader(new StringReader(theNotXMLString)); -
Multi-line String - Match Regular Expression
I am trying to figure out the format of a regular expression in order to pull select lines out of a multi-line string and populate those lines as individual elements of a string array while using Match Regular Expression. The overall length of the multi-line string can vary as well as the text contained within the string. The string can contain letters, numbers, and special characters. I have attached an example VI. Within the example VI I only want to return the lines beginning with "Device #" into the array. The number of lines beginning with "Device #" can vary but I want to capture them all.
Or is there a better function to use instead of Match Regular Expression that will give me the desired outcome?
Solved!
Go to Solution.
Attachments:
MultiLine Regular Expression.vi 22 KBaaronb wrote:
I am trying to figure out the format of a regular expression in order to pull select lines out of a multi-line string and populate those lines as individual elements of a string array while using Match Regular Expression. The overall length of the multi-line string can vary as well as the text contained within the string. The string can contain letters, numbers, and special characters. I have attached an example VI. Within the example VI I only want to return the lines beginning with "Device #" into the array. The number of lines beginning with "Device #" can vary but I want to capture them all.
Or is there a better function to use instead of Match Regular Expression that will give me the desired outcome?
Match Regular Expression works well for this.
Ben64 -
Filter String using Regular Expression
Hello,
I have an application that monitors serial communication between a PC and device. The message protocol is a byte stream that I convert to a string to parse into pretty messages. The start of the string is always "10 02", but if the string is preceded with another "10" like this "10 10 02" it is part of a message. I've been trying to use a regular expression with the Search and Replace VI. My regex is "[^10]\s10\s02" which almost works but it cuts off part of the message:
Before:
10 03 10 02
After:
10 0 <= missing the "3"
10 02
Here's what I'm doing:
Any ideas on what I'm missing? I've attached a simple example.
Thanks
Message Edited by Derek Price on 02-14-2008 08:37 PM
Attachments:
Filter Beginning Message1.vi 14 KB
FilterMessageRegex1.png 7 KBTry this approach.
Do search and replace on '10\s02' and replace with '\r\n10\s20'
Then do another search and replace on '10\r\n\10\s20' with '10\s10\s20'
See attached.
Randall Pursley
Attachments:
Message Filter.PNG 18 KB -
Replace a string using regular expression from powershell
I want to replace the following:
'browserName': 'firefox'
with :
'browserName': 'chrome'
then I tried this:
(get-content $conffile) -replace "^('browserName': ')\S+","browserName': 'chrome' |set-content $conffile
But nothing happened.
Could someboby tell me how to write the regular expression here? Thanks a lot.Second person today with the same question.
get-content $conffile |%{$_ -replace "'browserName':\s+'firefox'","'browserName': 'chrome'" | set-content $conffile
\_(ツ)_/ -
Dumbfounded by Scanner processing String using regular expression
I was reading Bruce Eckel's book when I came across something interesting: extending Scanner with regular expressions. Unfortunately, I was confronted with an issue that doesn't make much sense to me: if the String that I am scanning contains a hyphen, the Scanner doesn't produce anything. As soon as I take it out, it all works like a charm. Here is my example:
import java.util.Scanner;
import java.util.regex.*;
public class StringScan {
public static void main (String [] args){
String input = "there's one caveat when scanning with regular expressions";
Scanner scanner = new Scanner (input);
String pattern = "[a-z]\\w+";
while (scanner.hasNext(pattern)){
scanner.next(pattern);
MatchResult match = scanner.match();
String output = match.group();
System.out.println(output);
}What could be the reason? I imagined it could be because the hyphen for some reason gets given a special meaning but when I tried escaping it, it still didn't work.Thanks for your prompt reply.
I have figured out what was wrong with my code, by the way. Since a single quote is not a word character, it does not match w+. And as the very first input token does not match, the scanner stops immediately. I rewrote my regex to "[a-z].*" and now it does work. -
How to draw multiple line graph using bi graph in JHeastart?
hello,
i have a problem when displaying a multiple graph in JHeadstart.i had created a graph that represent the report of medical testing.my x-axis is "report date",my y-axis is "observation value" then my series attributes is depend on "item description" .
One patient has many "item description",each "item description" has one "observation value" and each "item description" has many "report date".
when the graph was displayed,it only show me in 1 line,then it is depend on the id patient but not like what i set in the graph wizard.actually,it should be display fews line accroding to the "item description".
then,the "observation value" and "item description" are get from defferent entity object.
i dun know what was happen.any hits are welcome.
thanksyes,finally i found how to draw it.Actually the series attributes is depend on VO's primary key .
thanks to who was view my problem. -
Filter Strings using regular expressions
Requirements.
1.I have a table with different names.
2.I input a word(string) through a text box.
3.I filter table using the input string through text box using the code
((DefaultRowSorter)table_customer.getRowSorter()).setRowFilter(RowFilter.regexFilter(regex, indices));
4.regex is obtained as follows.
String regex = "";
String text = txtFilterText.getText();
regex = "^(?i)"text".*"; //for starts with filter
regex = "." + text + ".";//for contains filter
regex = "(?i)["text".*]";//for doesnt start with filter
regex =".*(?i)"text"$";//for end with filter
I need help for doesnt contain and doesnt end with filters.Plz help me out..
Aneesh2. {color:ff0000}Double post{color}
Reply here: http://forum.java.sun.com/thread.jspa?threadID=5231406 -
Getting non numeric strings using regular expression
Hi Guys ,
I want to get list of string values in table which contains no numeric values .....
I have a string column name A and table name B .
I have written following code , but it seems it is incorrect .
Plz help me out .....
SELECT
A FROM
B
WHERE
regexp_like(A, '([^[:digit:]])'
Thanks in advance ....96097f0e-f165-463a-a0a2-3d15214c8a3d wrote:
Hi Guys ,
I want to get list of string values in table which contains no numeric values .....
I have a string column name A and table name B .
I have written following code , but it seems it is incorrect .
Plz help me out .....
SELECT
A FROM
B
WHERE
regexp_like(A, '([^[:digit:]])'
Thanks in advance ....
That will give you every one that has at least one non-numeric character, if you want ones which contain no numeric characters then it should be
regexp_like(A,'^[^0-9]*$') -
One for the Tekkies: How to get this output using REGULAR EXPRESSIONS?
How to get the below output using REGULAR EXPRESSIONS??
SQL> ed
Wrote file afiedt.buf
1* CREATE TABLE cus___addresses (full_address VARCHAR2(200 BYTE))
SQL> /
Table created.
SQL> PROMPT Address Format is: House #/Housename, street, City, Zip Code, COUNTRY
House #/Housename, street, City, Zip Code, COUNTRY
SQL> INSERT INTO cus___addresses VALUES('1, 3rd street, Lansing, MI 49001, USA');
1 row created.
SQL> INSERT INTO cus___addresses VALUES('3B, fifth street, Clinton, OK 74103, USA');
1 row created.
SQL> INSERT INTO cus___addresses VALUES('Rose Villa, Stanton Grove, Murray, TN 37183, USA');
1 row created.
SQL> SELECT * FROM cus___addresses;
FULL_ADDRESS
1, 3rd street, Lansing, MI 49001, USA
3B, fifth street, Clinton, OK 74103, USA
Rose Villa, Stanton Grove, Murray, TN 37183, USA
SQL> The REG EXP query shouLd output the ZIP codes: i.e. 49001, 74103, 37183 in 3 rows.Edited by: user12240205 on Jun 18, 2012 3:19 AMHi,
user12240205 wrote:
... Frank, ʃʃp's method, I understand. But your method, although correct, I find it difficult to understand.
Could you explain how you did this?? What does '.*(\d{5})\D*' and '\1' mean???
Your method is better because it uses only ONE reg expression function. ʃʃp's uses 2.In Oracle 10.2 (I believe) and higher, '\d' is equivalent to '[[:digit:]]', and '\D' is equivalent to '[^[:digit:]]'. I find '\d' and '\D' easier to type, but there's nothing wrong with using '[[:digit:]]' and '[^[:digit:]]'.
'.*' means "0 or more of any character".
'\D*' means "0 or more non-digits".
The whole expression, '.*(\d{5})\D*' means:
a. 0 or more characters (any characters)
b. 5 digits
c. 0 or more non-digits.
'\1' is a Backreference . It means the sub-string that matched the pattern after the 1st '(', up to (but not including) its matching ')'. In this case, that means the sub-string that matched '\d{5}', or b. using the explanation immediately above.
So the entire REGEXP_REPLACE call means "When you see a sub-string consisting of a., follwed immediately by b., followed immedately by c., replace that sub-string with b. alone." -
Replace string with regular expression
I am new to the regular expression. I am just trying to remove double quotes from a string.
My sample string is sql statement(SELECT "SCHEMA"."TABLE1"."COLUMN1", "SCHEMA"."TABLE1"."COLUMN2" FROM "SCHEMA"."TABLE1", "SCHEMA"."TABLE2" WHERE "SCHEMA"."TABLE1"."COLUMN1" = "SCHEMA"."TABLE2"."COLUMN1" );
This is what I came up with.
String s = query.replaceAll("\\.\"", ".").replaceAll("\"\\.", ".").replaceAll("\\s\"", " ").replaceAll("\\s\"", " ").replaceAll("\",", ",").replaceAll("\"\\s", " ");
But I want to optimize this line.
Could anybody tell me how to call replaceAll once with using regular expression instead of calling replaceAll multiple times? Some table or column names can have double quotes, so I want to remove the double quotes without replacing the double quotes which is part of the table or column name.
I'd appreciated it.caesarkim1 wrote:
I am new to the regular expression. I am just trying to remove double quotes from a string.
My sample string is sql statement(SELECT "SCHEMA"."TABLE1"."COLUMN1", "SCHEMA"."TABLE1"."COLUMN2" FROM "SCHEMA"."TABLE1", "SCHEMA"."TABLE2" WHERE "SCHEMA"."TABLE1"."COLUMN1" = "SCHEMA"."TABLE2"."COLUMN1" );
This is what I came up with.
String s = query.replaceAll("\\.\"", ".").replaceAll("\"\\.", ".").replaceAll("\\s\"", " ").replaceAll("\\s\"", " ").replaceAll("\",", ",").replaceAll("\"\\s", " ");
...Note that the following two lines are equivalent:
s = s.replaceAll("a","").replaceAll("b","");
s = s.replaceAll("a|b",""); -
How to do the multiple-line String at JList?
hey everyone,
i want to create a JList have to display multiple-line string.
i have use String a="text1"+"\n"+"text2" inside my JList...
the "\n" change to a sequare box...
how cum like that.................??
i need ur kindly helping...Because the default renderer for a JList element is a
JLabel, and that is how JLabel behaves. The question
"how to do a multiple-line JLabel" has been asked
hundreds of times in this forum, search for that.i have search for it already but i no get it..anything!
so, can u give me the url for me? thank you! -
How to insert multiple line items in fv60 using bdc.
Hi all,
How to insert multiple line items in fv60 using bdcshi
chk this
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA : IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_EBELP(30) , V_MENGE(30) , V_WERKS(30), V_EMATN(30) ,
V_PEINH(30).
DATA : FILE TYPE STRING, V_MSG(100) , V_IND(2) TYPE N , FLAG VALUE 'X'.
PARAMETERS: P_FILE(50) TYPE C DEFAULT 'C:\ME21_TEST'.
DATA : BEGIN OF ITAB OCCURS 0,
IND(02),
LIFNR_001(010),
data element: BSART
BSART_002(004),
data element: BEDAT
data element: EKORG
EKORG_004(004),
EKGRP_006(003),
data element: LPEIN
LPEIN_005(001),
data element: EMATNR
EMATN_01_007(018),
data element: EWERK
WERKS_01_008(004),
data element: EPEIN
PEINH_01_009(006),
data element: EWERK
MENGE_01_013(017),
data element: AUFEP
EBELP_014(005),
data element: AUFEP
END OF ITAB.
START-OF-SELECTION.
FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SORT ITAB BY IND.
START-OF-SELECTION.
LOOP AT ITAB.
REFRESH IT_MESSAGES.
<b>V_IND = V_IND + 1.</b>
<b>AT NEW IND.</b>
<b>READ TABLE ITAB INDEX SY-TABIX.</b>
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0100'.
PERFORM BDC_FIELD USING 'EKKO-LIFNR'
ITAB-LIFNR_001.
PERFORM BDC_FIELD USING 'RM06E-BSART'
ITAB-BSART_002.
*perform bdc_field using 'RM06E-BEDAT'
ITAB-BEDAT_003.
PERFORM BDC_FIELD USING 'EKKO-EKORG'
ITAB-EKORG_004.
PERFORM BDC_FIELD USING 'RM06E-LPEIN'
ITAB-LPEIN_005.
PERFORM BDC_FIELD USING 'EKKO-EKGRP'
ITAB-EKGRP_006.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
ENDAT.
<b>PERFORM BDC_DYNPRO USING 'SAPMM06E' '0120'.
CONCATENATE 'EKPO-EMATN(' V_IND ')' INTO V_EMATN.
PERFORM BDC_FIELD USING V_EMATN
ITAB-EMATN_01_007.
CONCATENATE 'EKPO-WERKS(' V_IND ')' INTO V_WERKS.
PERFORM BDC_FIELD USING V_WERKS
ITAB-WERKS_01_008.
CONCATENATE 'EKPO-PEINH(' V_IND ')' INTO V_PEINH.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0120'.
PERFORM BDC_FIELD USING V_PEINH
ITAB-PEINH_01_009.
*CONCATENATE 'EKPO-MENGE(' V_IND ')' INTO V_MENGE.
*perform bdc_dynpro using 'SAPMM06E' '0120'.
*perform bdc_field using V_MENGE
ITAB-MENGE_01_013.
*CONCATENATE 'EKPO-EBELP(' V_IND ')' INTO V_EBELP.
PERFORM BDC_DYNPRO USING 'SAPMM06E' '0120'.
PERFORM BDC_FIELD USING 'RM06E-EBELP'
ITAB-EBELP_014.</b>PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
AT END OF IND.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
ENDAT.
CALL TRANSACTION 'ME21' USING IT_BDCDATA MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_MESSAGES.
LOOP AT IT_MESSAGES WHERE MSGTYP = 'E' OR MSGTYP = 'A'.
IF FLAG = 'X'.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = 'GAMY_FAILURE'
HOLDDATE = FILLER8
KEEP = 'X'
USER = SY-UNAME
RECORD = FILLER1
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR FLAG.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'ME21'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
DYNPROTAB = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_MESSAGES-MSGID
LANG = 'EN'
NO = IT_MESSAGES-MSGNR
V1 = IT_MESSAGES-MSGV1
V2 = IT_MESSAGES-MSGV2
V3 = IT_MESSAGES-MSGV3
V4 = IT_MESSAGES-MSGV4
IMPORTING
MSG = V_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
WRITE : / V_MSG.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDLOOP.
IF FLAG NE 'X'.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 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.
ENDIF.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA. -
How to do the multiple-line String at JList? help!
i need some code to multiple-line String at JList.
i know that it is can be done by html code.
example:
<p>line1</p><p>line2</p>
but if i use that html code...
i face another problem to my JList..
it cannot set the font use the ListCellRenderer..
like:
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
Color newColor = new Color(230, 230, 230);
setIcon(((DisplayItem)value).getIcon());
setText(((DisplayItem)value).getChat());
setFont(((DisplayItem)value).getFont());
setBackground(isSelected ? newColor : Color.white);
setForeground(isSelected ? Color.black : Color.black);
if (isSelected) {
setBorder(
BorderFactory.createLineBorder(
Color.red, 2));
} else {
setBorder(
BorderFactory.createLineBorder(
list.getBackground(), 2));
return this;
all my JList will be html type...
i don't want that happen..can be another method to do that multiple-line String in JList??
i also need to set a icon image between string in the JList. anyone get idea??
i need ur help!
thank you.I think you should create/override several methods like setText(String), setIcons(Icon[]), paintComponent(Graphics), getMinimumSize(), getPreferredSize(), etc.
I would like to code like below...:class MultilineLabel extends JLabel {
private String[] text = null;
private ImageIcon[] icons = null;
public void setText( String newText ) {
// It overrides JLabel.setText( String )
// Tokenize newText with line-separator
// and put each text into the 'text' array.
public void setIcons( Icon[] newIcon ) {
// It is similar to JLabel.setIcon( Icon ) method,
// but it receives an array of Icon-s. Set these icons to 'icons' variable.
public void paintComponent( Graphics g ) {
// It overrides JComponent.paintComponent( Graphics ) method.
super.paintComponent( g );
if ( text != null && icons != null ) {
int icon_x = 0;
int text_x = 0;
int y = 0;
// draw customized content..
for ( int i=0; i<text.length; i++ ) {
// compute x and y locations
// icon_x = ...
// text_x = ...
// y = ...
// and draw it!
g.drawString( text[ i ], text_x, y );
icon[ i ].paintIcon( this, g, icon_x, y );
public Dimension getMinimumSize() {
int width = super.getMinimumSize().width;
int height = ... // I think you must compute it with 'text' and 'icons'' arrays.
return new Dimension( width, height );
public Dimension getPreferredSize() {
int width = super.getPreferredSize().width;
int height = ...
return new Dimension( width, height );
}I think that code-structure above is the minimum to implement your requirements. (Of course if you want to implement it :)
Good luck and let me know it works or not. :)
Maybe you are looking for
-
HELP: failed to setup and run WL performance monitor, console extension on WL 8.1
Hi All i downloaded and installed the WL performance monitor, console extension package at http://commerce.bea.com/products/weblogicserverconsoleextension/wlsext_home.jsp As i tried to deploy "performance monitor" web app to the WL server at "Perform
-
You Can't Create A Mail Folder For POP Accounts?
I can't believe that I am unable to create a folder for a POP email account so that I can file and manage my email on the iPhone 3g! Which rocket scientist at Apple made this decision? What happend to the "manage email on iPhone" Use Case? So, how do
-
Intraoffice instant messaging software for Windows and Mac
Can anyone recommend instant messaging software between Mac and Windows platforms? My employer doesn't want to use the traditional IM clients - AIM, MSN, etc., - for security reasons. He'd like something that would only connect members of the same LA
-
Have movies in my library but cant get them on my ipod...
I have movies in my library but cant get them on my ipod. Does anyone know what to do.
-
IPad Viewer Doesn't load any Folios
Every since the upgrade to v19 of the tools, (I am using v18 of the viewer builder). Now in the development app (Just submitted production app to app store). None of the content loads. What happened?