Getting coloured text in DefaultStyledDocument
I am using JTextPAne with DefaultStyledDocument.Every character typed into the document will have an attribute and depending on that attribute the colour of the character should be changed.
When I run my application and enter characters of same attribute they display fine but when i type a character with different attribute then the colour of whole text
changes to the colour of the last typed characters colour in a line.
for Example :
attribute of 'a,b,c,d,e........'= 3; color =black
attribute if "1,2,3,4,5,.........."=2; color = blue
attribute of '/' , ';'....................=4; color = green
when i type abc they r displayed in black
if i type 1 following the above text then the whole text that is abc1 is displayed in blue
if i type '/' following the above then the whole text abc/ is displayed in green
We want each character display the colour depending on its own attribute .
please suggest some solution for this.
hey
U r probably using setCharacterAttributes() -> this function takes a boolean argument which specifies whether the new attributes r applied to ONLY the strings inserted thereafter, or to the whole document. just check the syntax and set the correct boolean argument for setCharacterAttributes() and u will get the thing to behave as u want! :)
Similar Messages
-
Hi,
I am using photoshop demo, and i am having problems to make two coloured text. I have windows 7. I have tried to right click on the teaxt layer, but I cant do anythingOne way is to use a Gradient Overlay layer style
more info:
http://psd.tutsplus.com/articles/tools/gradient-overlay-layer-styles/
http://www.bigstockphoto.com/blog/working-inside-the-gradient-editor/
http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-77e1a.h tml -
Setting to enable Pixma MP560 to print colour text?
Hi!
Hope I am in the appropriate section for this problem. I am unable to get my Pixma MP560 to print colour text. Ink levels fine. Is there a setting for this when I click print?
Regards,
DG.It has to be something in Page Setup.
Or when the print dialog box comes up there must be a Printer properties dialog button. Open that and make sure it is set to print in color.
In the System Preferences Printer & Scan is there any settings for the printer.
As usual working with a Windows PC seem much easier.
EDIT:
When you go to Print in the print dialog window is there a Presets section? If there is for your printer click on that and at the bottom there should be "Show Presets..
Open that and select a color preset or some that doesn't say B&W.
Message was edited by: Shootist007 -
How do I get more text options in photoshop??
How do I get more text options in Photoshop? I have the basic package, but I would like more script options.
Thank you,
MaureenI don't suppose you have a full CC subscription? It comes with a feature called Typekit which I love. Along with an ever increasing range of top quality fonts, it has the best font manager I have used, and excellent search facility.
The web is full of additional font sites like dafont
http://www.dafont.com/
Otherweise, Google is your friend
If you want Text Effects then Google will help you out there as well -
Different coloured text in one Textbox
Can someone PLEASE help me!!!!!!!!!!!!!!
I need to know how to have different coloured text in the same textbox.
My application has text being inputted into the textbox every 5 seconds from 2 different sources. I want to differenciate the text by showing the user 2 different colours for each source.
Thank you very muchAcording to the first post it also shows data, so it is a GUI component. i never sow a textbox.
JTextPane can show data in different colors. also JTextArea can.
Noah -
I made my own Apple ID because when I was logged into my dad's my family was receiving my texts from other people. I want to add my device to my dad's "find my iphone" app but without signing into his Apple ID on my phone because that was causing them to get my texts. I was told by Apple I could add my device to his by signing into icloud.com but there is no option that I can find to add my device. And I don't want to log back in to his.. Any ideas???
Also when I apply the safety copy it only imports the app the phones have had in common, so none of the apps that only the iPhone 4 had doesn't come in, only the ones I and the iPhone 4 has had in common. So you say the only way I can use the Apple ID to download on the old iPhone 4 is if I delete the apps that are in the phone and then download them again? How will that change the ID to download/update from. Won't it still have mine to update/download from?
-
How do I get a text file from Photoshop to work in the main sequence in pp?
How do I get a text file to work properly in the master sequence. I moved it from Photoshop, which I learned to do from a tutorial, but when I move the animated text sequence to the master, it either isnt running, or it is scaled way too big. How do I get it to run in the main sequence?
"Wont Work Here" ! Does not mean much.
Are you having an audio or a video issue?
Looks like no video clip on the video layer above that section of audio.
I am teaching myself this stuff completely on the fly
I suggest you do the Basic Tutorials ( Adobe TV for example) in both Premiere Pro and PhotoShop.
You need to be competent in the basics and fundamentals of these apps and that will also help you describe and discuss the issues. Check the 'Products on this site....
Adobe TV -
How do I get the text to flow throughout more then one page.
Hello,
I am currently using LiveCycke Designer to create a scholarship for my company. I created fields for the form and I would like to insert a text to describe the scholarship. When I insert the text, it doesn't flow onto the next page. I've tried creating a subform and clicking "flowed" and "allow page breaks within content". I also clicked auto-fit for the height, but it just makes a line. For the text box, I've clicked "Expand to fit on the height". It is also a dynamic XML Form. Is there anything else I should be doing?
I could always send the file to someone to see if they can figure it out.
Thank you,
NatalieThank you so much !
but the link doesn't seem to work. It says that the URL is not in the correct format for an Acrobat.com document link.
Natalie
Date: Wed, 12 May 2010 07:53:12 -0600
From: [email protected]
To: [email protected]
Subject: How do I get the text to flow throughout more then one page.
Here is the corrected form..Even you you set the Subform type to "Flowed" to the subform where the Text box resides, you did not set the Page1 to Flowed (which is the key)..But when I make the Page1 type to "Flowed", all your fields above the Scholrship text boxes' Subform will go one below another.. To fix this, first I have select all the fields and wrap them into a subform and then set the Page1 to Flowed..
https://acrobat.com/#d=XQ1yfV8fCk85M7sRLD*-gg
Thanks
Srini
> -
How can I get the "text" field from the actionEvent.getSource() ?
I have some sample code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.ArrayList;
public class JFrameTester{
public static void main( String[] args ) {
JFrame f = new JFrame("JFrame");
f.setSize( 500, 500 );
ArrayList < JButton > buttonsArr = new ArrayList < JButton > ();
buttonsArr.add( new JButton( "first" ) );
buttonsArr.add( new JButton( "second" ) );
buttonsArr.add( new JButton( "third" ) );
MyListener myListener = new MyListener();
( (JButton) buttonsArr.get( 0 ) ).addActionListener( myListener );
( (JButton) buttonsArr.get( 1 ) ).addActionListener( myListener );
( (JButton) buttonsArr.get( 2 ) ).addActionListener( myListener );
JPanel panel = new JPanel();
panel.add( buttonsArr.get( 0 ) );
panel.add( buttonsArr.get( 1 ) );
panel.add( buttonsArr.get( 2 ) );
f.getContentPane().add( BorderLayout.CENTER, panel );
f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
f.setVisible( true );
public static class MyListener implements ActionListener{
public MyListener() {}
public void actionPerformed( ActionEvent e ) {
System.out.println( "hi!! " + e.getSource() );
// I need to know a title of the button (which was clicked)...
}The output of the code is something like this:
hi! javax.swing.JButton[,140,5,60x25,alignmentX=0.0,alignmentY=0.5,
border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@1ebcda2d,
flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,
disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,
right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,
rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=first,defaultCapable=true]
I need this: "first" (from this part: "text=first" of the output above).
Does anyone know how can I get the "text" field from the e.getSource() ?System.out.println( "hi!! " + ( (JButton) e.getSource() ).getText() );I think the problem is solved..If your need is to know the text of the button, yes.
In a real-world application, no.
In a RW application, a typical need is merely to know the "logical role" of the button (i.e., the button that validates the form, regardless of whether its text is "OK" or "Save", "Go",...). Text tends to vary much more than the structure of the UI over time.
In this case you can get the source's name (+getName()+), which will be the name that you've set to the button at UI construction time. Or you can compare the source for equality with either button ( +if evt.getSource()==okButton) {...}+ ).
All in all, I think the best solution is: don't use the same ActionListener for more than one action (+i.e.+ don't add the same ActionListener to all your buttons, which leads to a big if-then-else series in your actionPerformed() ).
Eventually, if you're listening to a single button's actions, whose text change over time (e.g. "pause"/"resume" in a VCR bar), I still think it's a bad idea to rely on the text of the button - instead, this text corresponds to a logical state (resp. playing/paused), it is more maintainable to base your logic on the state - which is more resilient to the evolutions of the UI (e.g. if you happen to use 2 toggle buttons instead of one single play/pause button). -
Hi, basically i have no sound at all on my Iphone, it doent notify me when i get a text, when someone rings, when i play music or watch videos, the volume slider that is usually present while watching videos or listening to music is no longer there at all, ive turned my phone on and off a couple of times now ive put headphones in and out to see if i had a sticky jack but still no luck Someone help??
And to clarify, these are all iTunes movie and music downloads, so there should not be a compatability issue. And no, the iPod did not come damaged from Apple, it was a hand-me-down from a friend who busted the internal speaker. But it's never done anything like this before. It just had crappy sound. And yes, the timing of the movies and music having issues is the same as the speaker dying. And no, this has NOTHING To do with music videos. I don't have any on any of our devices.
-
I recently bought a new macbook pro and set it up using the migration assistant from my mac mini. I can't get the text message forwarding feature to work with both computers. It keeps saying that I only have 2 devices setup, my iPad and my macbook pro. When I mess with the setting on my mac mini, it goes from saying that that is one of the devices to my macbook pro being the 2nd device. I think that something happened as a result of my using the migration assistant and now it thinks that my macbook pro and my mac mini are one and the same computer. Any ideas?
Thanks, Sig.
The old computer is a 2.6 Ghz Intel Core 2 Duo
The new one is a 2.3 GHz intel core i7
In going over this, thanks to "tallking it out" with you, I did discover the Text Edit problem. Because I've still been unable to get the new computer text size (fonts or whatever) to match the old computer, I did not notice that the curser is now different--the line midway down the curser has to be placed on the line I am working upon, otherwise the edits go elsewhere on the page. Now, with a bit of difficulty, I am able to get Text Edit to work correctly.
If you have any ideas as to why my menu bar and Text Edit type are still so slow, I'd love to have them.
(I went through the process you suggested earlier, re my Trackpad preferences, and found no improvement.) -
I have searched quite a bit to find a resolution to this problem, with no success. Any help would be appreciated.
I decided to rebuild my inboxes by following this advice: http://support.apple.com/kb/PH11704. The rebuild took several hours and at 96% (4 minutes remaining apparently), the indexing froze (that is, after 8 hours, the message was still telling me "4 minutes left"). I forced quit mail, restored the previous Envelope files from the trash, and everything seemed fine.
However, since this failed attempt, I can see and select the message in the center pane and when I click on it to display, I get "Loading" text, but nothing comes up. All messages in my various inboxes have the reloading problem, EXCEPT messages that I downloaded since the aborted rebuild (in other words, there are about 40 messages that I downloaded since I tried the rebuild and I have no problem with these). The other 70,000 messages however wont load, even though I can see them in the centre pane and spotlight has no problem finding them and showing me their contents (when I hover the mouse over the message). When I click on the message in spotlight, mail opens and the loading problem re-occurs.
Since then, based on various suggestions I found for similar issues, I have used Disk Utility to verify and repair permissions and the drive. I used Onix to rebuild the Mail index (that only took about a minute - I am not sure how to interpret this when compared to the hours the rebuild took with Mail). No joy, I still have the same problem. I even restored one of my inboxes via Time Machine and the same issue with loading continues.
I am using ML 10.8.2. I have a combination of IMAP accounts (work) and POP accounts (personal). The issue of loading occurs irrespective of the account.
I am baffled and am now considering migrating to either Thunderbird or Postbox 3 to try and solve my problem. I prefer to stay with Mail. I should note also that I am using MailTags with Mail (http://www.indev.ca/MailTags.html), although I have not used any of the features. I upgraded to ML from SL about 2 weeks ago. It was very smooth and there appear to be no issues (not sure how helpful this is and probably not at all related to this issue).
Any suggestions much appreciated!Maybe these will help:
https://discussions.apple.com/message/17677533#17677533
https://discussions.apple.com/message/18324129#18324129
https://discussions.apple.com/message/18203126#18203126 -
In popup step how do I get the "text on the button" in the report rather than button index?
(1)
How do I configure the POPUP step in "SEQ MAIN.seq" to execute the second
step (IS OUT PUT IS 20?) in "SEQ 1.seq" when "IS OUT PUT IS 20?" button
hit and execute the third step (IS OUT PUT IS 30?) in "SEQ 1.seq" when "IS
OUT PUT IS 30?" button hit.
(2)
In popup step how do I get the "text on the button" in the report rather than button index?
File attached
Attachments:
test_stand.zip 32 KBThe handle to the Step.Button1Label gets you the data, but there are several ways to get it into the actual report.
The easiest is to use the reporttext.
In a post expression, you can use something like
Step.Result.ReportText = Evaluate("Step.Button" + Str(Step.Result.ButtonHit) +"Label")
and then the default report generation will include it in the report. Otherwise, you need to get the text into the Resultlist by various means (check the user manual, or the TestStand II customisation course) and handle the report generation yourself inside of the appropriate sequence in the process model.
Just my 2cents
S.
// it takes almost no time to rate an answer
Attachments:
IncludeButtonTextInReport2_0.seq 18 KB -
My husband and I have both downloaded the new IOS 8.2 and now he is getting my text messages that are only addressed to me. He has a 5 and I have a 6. It is like we are synced together. How can I fix that?
Is he getting your SMS messages (green) or your iMessages (blue). If SMS message, go to Settings>Messages and turn off Text Forwarding. If blue, are you sharing an Apple ID? You should each have your own.
-
How ias integrate with Snacktory for getting main text from an html page
Hi All,
i am new to endeca and ias, i have an requirement, need to get main text from whole html page before ias save text to Endeca_Document_Text property,
as ias save all text in page to endeca_document_text property, it is not ok for reading when show in web page, i use an third party API to filter out the main text from original page,
now i want to save these text to endeca_document_text property,
an another question,
i get zero page when doing the logic of filtering main text from original html text in ParseFilter( HTMLMetatagFilter implements ParseFilter) using Snacktory.
if only do little things, it will work fine, if do more thing, clawer fail to crawl page. any one know how to fix it.
log for clawler.
Successfully set recordstore configuration.
INFO 2013-09-03 00:56:42,743 0 com.endeca.eidi.web.Main [main] Reading seed URLs from: /home/oracle/oracle/endeca/IAS/3.0.0/sample/myfirstcrawl/conf/endeca.lst
INFO 2013-09-03 00:56:42,744 1 com.endeca.eidi.web.Main [main] Seed URLs: [http://www.liferay.com/community/forums/-/message_boards/category/]
INFO 2013-09-03 00:56:43,497 754 com.endeca.eidi.web.db.CrawlDbFactory [main] Initialized crawldb: com.endeca.eidi.web.db.BufferedDerbyCrawlDb
INFO 2013-09-03 00:56:43,498 755 com.endeca.eidi.web.Crawler [main] Using executor settings: numThreads = 100, maxThreadsPerHost=1
INFO 2013-09-03 00:56:44,163 1420 com.endeca.eidi.web.Crawler [main] Fetching seed URLs.
INFO 2013-09-03 00:56:46,519 3776 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-1] come into EndecaHtmlParser getParse
INFO 2013-09-03 00:56:46,519 3776 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-1] come into HTMLMetatagFilter
INFO 2013-09-03 00:56:46,519 3776 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-1] meta tag viewport ==minimum-scale=1.0, width=device-width
INFO 2013-09-03 00:56:52,889 10146 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-1] come into EndecaHtmlParser getParse
INFO 2013-09-03 00:56:52,889 10146 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-1] come into HTMLMetatagFilter
INFO 2013-09-03 00:56:52,890 10147 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-1] meta tag viewport ==minimum-scale=1.0, width=device-width
INFO 2013-09-03 00:56:59,184 16441 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-2] come into EndecaHtmlParser getParse
INFO 2013-09-03 00:56:59,185 16442 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-2] come into HTMLMetatagFilter
INFO 2013-09-03 00:56:59,185 16442 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-2] meta tag viewport ==minimum-scale=1.0, width=device-width
INFO 2013-09-03 00:57:07,057 24314 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-2] come into EndecaHtmlParser getParse
INFO 2013-09-03 00:57:07,057 24314 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-2] come into HTMLMetatagFilter
INFO 2013-09-03 00:57:07,057 24314 com.endeca.eidi.web.parse.HTMLMetatagFilter [pool-1-thread-2] meta tag viewport ==minimum-scale=1.0, width=device-width
INFO 2013-09-03 00:57:07,058 24315 com.endeca.eidi.web.Crawler [main] Seeds complete.
INFO 2013-09-03 00:57:07,090 24347 com.endeca.eidi.web.Crawler [main] Starting crawler shut down
INFO 2013-09-03 00:57:07,095 24352 com.endeca.eidi.web.Crawler [main] Waiting for running threads to complete
INFO 2013-09-03 00:57:07,095 24352 com.endeca.eidi.web.Crawler [main] Progress: Level: Cumulative crawl summary (level)
INFO 2013-09-03 00:57:07,095 24352 com.endeca.eidi.web.Crawler [main] host-summary: www.liferay.com to depth 1
host depth completed total blocks
www.liferay.com 0 0 1 1
www.liferay.com 1 0 0 0
www.liferay.com all 0 1 1
INFO 2013-09-03 00:57:07,096 24353 com.endeca.eidi.web.Crawler [main] host-summary: total crawled: 0 completed. 1 total.
INFO 2013-09-03 00:57:07,096 24353 com.endeca.eidi.web.Crawler [main] Shutting down CrawlDb
INFO 2013-09-03 00:57:07,160 24417 com.endeca.eidi.web.Crawler [main] Progress: Host: Cumulative crawl summary (host)
INFO 2013-09-03 00:57:07,162 24419 com.endeca.eidi.web.Crawler [main] Host: www.liferay.com: 0 fetched. 0.0 mB. 0 records. 0 redirected. 4 retried. 0 gone. 0 filtered.
INFO 2013-09-03 00:57:07,162 24419 com.endeca.eidi.web.Crawler [main] Progress: Perf: All (cumulative) 23.6s. 0.0 Pages/s. 0.0 kB/s. 0 fetched. 0.0 mB. 0 records. 0 redirected. 4 retried. 0 gone. 0 filtered.
INFO 2013-09-03 00:57:07,162 24419 com.endeca.eidi.web.Crawler [main] Crawl complete.
~/oracle/endeca
-======================================
source code for parsefilter
package com.endeca.eidi.web.parse;
import java.util.Map;
import java.util.Properties;
import org.apache.hadoop.conf.Configuration;
import org.apache.log4j.Logger;
import org.apache.nutch.metadata.Metadata;
import org.apache.nutch.parse.HTMLMetaTags;
import org.apache.nutch.parse.Parse;
import org.apache.nutch.parse.ParseData;
import org.apache.nutch.parse.ParseFilter;
import org.apache.nutch.protocol.Content;
import de.jetwick.snacktory.ArticleTextExtractor;
import de.jetwick.snacktory.JResult;
public class HTMLMetatagFilter implements ParseFilter {
public static String METATAG_PROPERTY_NAME_PREFIX = "Endeca.Document.HTML.MetaTag.";
public static String CONTENT_TYPE = "text/html";
private static final Logger logger = Logger.getLogger(HTMLMetatagFilter.class);
public Parse filter(Content content, Parse parse) throws Exception {
logger.info("come into EndecaHtmlParser getParse");
logger.info("come into HTMLMetatagFilter");
//update the content with the main text in html page
//content.setContent(HtmlExtractor.extractMainContent(content));
parse.getData().getParseMeta().add("FILTER-HTMLMETATAG", "ACTIVE");
ParseData parseData = parse.getData();
if (parseData == null) return parse;
extractText(content, parse);
logger.info("update the content with the main text content");
return parse;
private void extractText(Content content, Parse parse){
try {
ParseData parseData = parse.getData();
if (parseData == null) return;
Metadata md = parseData.getParseMeta();
ArticleTextExtractor extractor = new ArticleTextExtractor();
String sourceHtml = new String(content.getContent());
JResult res = extractor.extractContent(sourceHtml);
String text = res.getText();
md.set("Endeca_Document_Text", text);
} catch (Exception e) {
// TODO: handle exception
public static void log(String msg){
System.out.println(msg);
public Configuration getConf() {
return null;
public void setConf(Configuration conf) {but it only extracts URLs from <A> (anchor) tags. I want to be able to extract URLs from <MAP> tags as wellGee, do you think you could modify the code to check for "Map" attributes as well.
Can someone maybe point a page containing info on the HTML toolkit for me?It's called the API. Since you are using the HTMLEditorKit and an ElementIterator and an AttributeSet, I would start there.
There is no such API that says "get me all the links", so you have to do a little work on your own.
Maybe you could use a ParserCallback and every time you get a new tag you check for the "href" attribute.
Maybe you are looking for
-
How can I enter a reminder at the top of the list?
I want to enter reminders at the top not the bottom. I waste a lot of time scrolling down to the bottom everytime to enter a new one. I also want to view my most recent reminders at the top not the bottom. I couldn't find anything in preferences or e
-
Recovering data from a broken iPhone 5?
Today, my iPhone 5 broke, it simply won't turn on. When I plug it in, the computer doesnt even recognize a device plugged in. So im wondering, if I took my phone into the apple store, could they get the data off my phone? Really all I need are contac
-
Hi, I have created a DocumentSetContentType in a document library in SharePoint 2013 and mapped two word documents templates with it.I am entering the data in a list (like name,designation etc) and have mapped the columns of the list in a drop down w
-
After I wake the computer, and try to use an already open Photoshop CS6 window, I get strange patterns in the canvas. Purples. Greens. And when it's empty, it goes all black. A restart fixes this, until sleep. Happens every time. Anyone know a fix? T
-
Como activar la licencia de adobe
hola es q compre una licencia de adobe pero no se como activar el adobe porq lo descargue por el cloud y me esta pidiendo el keys y no se de donde sacarlo