What is the best way to display text?

Hi,
I am developing a full screen presentation. I like to know which is the best way to display text with different styles and fonts.
When i use JLabel, i have to use HTML. But the presentation is not good as it does not have anti-alias property. Also i want the background to be seen behind the text. Note that all the text in a paragraph is not of same style. I want some words to be in different color and style.
Thanks,
Mathan

It works alos with JTextPane:
Try this :
import java.awt.*;
import javax.swing.*;
public class MyTextPane extends JTextPane  {
     public void paintComponent(Graphics g) {
          Graphics2D g2d = (Graphics2D)g;          
          g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);          
          super.paintComponent(g2d);
     public static void main(String[] args) {
          JFrame f = new JFrame("test");
          f.getContentPane().add(new JScrollPane(new MyTextPane()));
          f.setBounds(200,200,300,400);
          f.setVisible(true);
}Denis

Similar Messages

  • What is the best way to manipulate text?

    What is the best way to manipulate text in Photoshop?  Let's say I need to edit an "A" and I want to stretch out the bottom corners of the letter, while not moving the upper portion (wide bottom, skiny top)... what is the best way to do this?  I know the "skew" function somewhat moves corners, but I want to take the binding boxes (while in the skew function) and move them individually so it doesn't affect another corner. Is this possible (or am I just crazy?!?!)?

    Not sure I get all the nuances of what you want, but have you tried invoking Free Transform, (CTRL+T) then holding down CTRL while clicking/dragging a corner handle?

  • What is the best way to display a Interactive Report having 20 columns

    Hi,
    I am having a Interactive Report having many columns (around 20).
    What is the best way to display that report...by default we have to scroll it horizontally to see all the columns.
    I want to avoid Horizontally Scrolling.
    Thanks,
    Deepak

    Hello Deepak,
    You mean apart from using a smaller font size or a bigger monitor?
    You can think about combining / wrapping columns (so more data in one column).
    Or hide some less important data and show that only on demand.
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • What is the best way to add text to an image

    I used the draw ap div to add text to an image.  will that cause any problems?  If so, what is the best way to add text to an image?  Thanks!

    APDivs will kill your design unless you fully understand the css behind the scenes and plan accordingly. They really are completely unnecessary in the vast majority of situations.
    An easy way to add "web text over an image" would be to use the background-image attribute in css for a standard <div> tag, then just add the text within that same <div>.
    Something like this in the css (if you are using a 300x300 pixel image)...
    #yourdiv {
         background-image:url(yourpic.jpg);
         width:300px;
         height:300px;
    And then this in the html...
    <div id="yourdiv">Your text here</div>
    You would then position the <div> using css margins, floats and padding. Using position:absolute (APDivs) is typically something that will blow your design to pieces if the viewer changes their browser settings.

  • What is the Best Way to Display a ClobDomain Field on a jspx Page?

    I have a ClobDomain field in my table that I need to display in my jspx form. What is the best way to go about this? I can't just drag and drop the field from my View and place it onto the form.
    Thanks.

    Apply a swap image behavior to the image. DO NOT ENABLE THE
    AUTOMATIC
    RESTORE.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "BillC-Bos" <[email protected]> wrote in
    message
    news:gp0utj$rmk$[email protected]..
    >I have what I imagine is a simple challenge but I after
    reviewing the forum
    >and
    > the DW workspace it seems that the technique I might try
    in GoLive are not
    > really the best way to go.
    >
    > I have a small graphic that when clicked should change
    to a different
    > graphic
    > to indivate that the site's visitor already clicked that
    graphic (which
    > links
    > to a detail page). There are many detail pages and the
    solution to
    > providing
    > navigation from one main page drastically limits the
    amount of information
    > provided on the "master" page making it necessary to
    provide some way to
    > indicate to the visitor that they already selected that
    option - so they
    > can
    > either avoid that link or return to it if they wish.
    >
    > So the "master" page will show an image (icon) that will
    change once the
    > visitor has clicked it. I am not sure how best to make
    this happen and can
    > use
    > some help or guidance. Thanks in advance for you help.
    Be well.
    >
    > Bill C
    >

  • What's the best way of displaying output in other VI ?

    For example, in a sub-vi I continuously acquire a motor position, and I want the position value to be displayed simultaneously in a numerical indicator or waveform in the main vi.
    I know there are lots of ways to implement this easily, but I just want to know what's the best way which use lest computer resources, say memory....
    Can control reference be used effectively for this?
    Thank you for your suggestion.
    Dejun

    here is an example (in LV7.0) of what Dennis is refering to.
    P.M.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion
    Attachments:
    ctrl reference folder.zip ‏7 KB

  • What is the best way to display errors to users when using JSPs?

              Hello,
              Could someone suggest me the best way to display errors to users when using JSPs?
              Many thanks in advance.
              Rino
              

              Thanks for the code snippet!
              Rino
              "Deepak Vohra" <[email protected]> wrote:
              >
              >
              >The 'errorPage' attribute of the 'page' directive forwards uncaught run-time
              >exceptions
              >to an error processing page. For example:
              >
              ><%@ page errorPage="error.jsp" %>
              >
              >redirects the browser to the JSP page error.jsp if an uncaught exception
              >is encountered.
              >
              >
              >Within error.jsp, indicate that it is an error-processing page, via the
              >directive:
              >
              >
              >
              ><%@ page isErrorPage="true" %>
              >
              >The Throwable object describing the exception may be accessed within
              >the error
              >page via the 'exception' implicit object.
              >
              >
              ><% if (exception != null) { %>
              ><p> An exception was thrown: <b> <%= exception %>
              >
              ><p> With the following stack trace:
              ><pre>
              >
              ><%
              > ByteArrayOutputStream ostr = new ByteArrayOutputStream();
              > exception.printStackTrace(new PrintStream(ostr));
              > out.print(ostr);
              >%>
              ></pre>
              >
              >
              >
              >"Rino Srivastava" <[email protected]> wrote:
              >>
              >>Hello,
              >>
              >>Could someone suggest me the best way to display errors to users when
              >>using JSPs?
              >>
              >>Many thanks in advance.
              >>
              >>Rino
              >
              

  • What is the best way to display image ??

    hi my questions is unusual, there are so many ways to display images.
    I m developing image processing s/w can any one suggest me which would be the best way to display image on which i can perform image operations.
    like in JPanel, icon, trhough paint() or anything else...
    thank you..In advance

    hi man... i think so imaging is better with JAI(Java Advanced Imaging) .... is perfect for display in jcomponent like JPanel or JLabel, you have to replace the paintComponent().
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.geom.AffineTransform;
    import javax.media.jai.PlanarImage;
    import javax.swing.JComponent;
    class ImagePanel extends JComponent {
         protected PlanarImage image1;
         protected AffineTransform atx= new AffineTransform();
         protected int width, heigth;
         public ImagePanel() {
         public ImagePanel(PlanarImage i) {
              image1= i;
              width= i.getWidth();
              heigth= i.getHeight();
         public void paintComponent(Graphics gc) {
              Graphics2D g= (Graphics2D)gc;
              Rectangle rect= this.getBounds();
              if ((width != rect.width) || (heigth != rect.height)) {
                   double magx= rect.width / (double)width;
                   double magy= rect.height / (double)heigth;
                   atx.setToScale(magx, magy);
              if (image1 != null)
                   g.drawRenderedImage(image1, atx);
    if you need more info, ask about JAI api and docs

  • What is the best way to throw text in a 5 minute film in final cut pro

    Does anyone know what the fastest way is to put 3d text (like the templates in motion) on a video in final cut pro?

    Use live type, you can do some real nice effects with text. Live type has backgrounds you can use, plus you can add your own which is what I do. Then you can use a live type font or standard type with fades, motion paths, glows and all sorts of neat stuff.

  • What's the best way to display my lightroom pictures onto my TV via Apple TV? i..e make a slide show

    This was done flawlessly with aperture but Apple doesn't like non-apple products so I was not sure if there was an easy way to do this?
    I want to choose pics from my various collections and see them on my tv using apple tv.  I would rather not COPY the pics to a new location since there are many many gigs of pics and they are all stored on my networked drive.  Anyone using a Mac and apple tv manage to figure out how to do this with Lightroom 5?

    Ok - see if I can do it 'the hard way' ....
    Hi Jeff,
    By "Output Only Folder”, I am suggesting a folder that you export to, via LR, and then never re-import it … it’s just a place to dump the images and since you can re-create them any time, you could delete it at will.
    Here’s the Export Dialogue I have setup from LR to iPhoto …. The optimal output dimensions are 1920 x 1080.  If you crop each image to that ratio, which is the same as 16 :: 9, then the images will fill the screen.  Otherwise just let one of the dimensions max out and the other will fall suit to 1920 or 1080 or lower as the case may be and it will map onto the Plasma at 1 :: 1 – so the Apple TV won’t have to scrunch it again.
    My  output dialog follows.  Note that it sets it up to go under Users/Jim/Caches/iPhoto Cache and then I setup a sub-folder name right underneath which I change (it’s Merc in this example).  So, this becomes the folder in iPhoto – and I can move that into an album or not as I wish.  See the iTunes screen shot a little further down.  The dimensions are setup to 1920 x 1080 at 100%.  The last section, under Post Processing, causes the folder to get read by iPhoto as soon as the Export finishes running and, voila, they are in iPhoto.  I can then clean iPhoto out when I wish.  Yes, it’s a duplicate – but these JPEG’s are smaller than the raws….maybe 300-400kb.
    (side note – the LR Mogrify section is a section you will NOT likely have – it’s merely a plugin I have that allows me to put some borders around output images, watermarks and so forth as the last step in the process – strictly optional but occasionally useful.  It’s not expensive – just google for it)
    Then here’s how it looks when it arrives a second or two later in iPhoto.  So, you can manage these into Albums, etc.  Then look to the bottom for the iTunes interaction.
    From the iTunes menu, select File | Home Sharing | Choose Photos to Share with Apple TV
    Then …..
    Note in the left panel, I have checked Last Import – where this photo was – but you could move/arrange the photos into new Albums and then they would show up and you could select them.  After you select then and Apply, turn on your Apple TV – and it may take a few minutes to sync up.  But then it’s done and you can choose Transitions and so forth on the ATV to nicely display them.
    Jim Camelford

  • What is the best way to display list of software titles for sale?

    I am a small retailer that would like to display a list of approximately 15-30 software titles in the most professional way (with prices).
    Can anyone recommend a layout that would serve this purpose, the ones in the template just don't seem to cut it.
    If anyone wants to email me an example, I'd really appreciate it.

    Probably your best bet would be to browse the websites or catalogs of other software stores to see what strikes you as professional, and use that as an inspiration to design your own.
    Also, there are many websites with additional iWork templates--here's one:
    http://www.iworkcommunity.com/
    and google turns up more.
    I can think of a few different ways to present a list of 15-30 software titles with prices (one column, two column, sub-categorized by maker, sub-categorized by function, sub-categorized by sale vs. regular price), but only you have the knowledge to know what system is most likely to appeal to your customers and match the overall graphic presentation of your store.

  • What's the best way to display color-coded telemetry?

    I have an array of up to 64 name-value pairs -- one for each sensor channel (thermocouple, pressure transducer, etc.).  I would simply use an array of clusters with the name and value, but I also want to be able to flag when a particular value goes out of limit.  I want to change the background color of the value to yellow or red depending on the value.  As I understand it, I cannot change the properties of individual items in an array.  :-(  So I'm forced to explicitly lay out 64 string and numeric indicators (even if I'm not using them all)!  Yuck.
    Surely I'm not the first LabView user who wants to color-code a telemetry array display!  Is there a better way to do this?  I've looked at the multicolumn list box but that seems to be aimed at allowing the user to select something from a list -- not strictly display things.  Besides, I don't see a way to change the colors of an individual cell for the listbox either.
    Please help!
    Keith.

    OK, I added defer panel updates and it did speed up the table and listbox significantly (down to around 3 ms) but still not as fast as the cluster array.  (BTW, replacing the active cell read with a constant had no effect.)  But here's what's weird: with the defer, the cluster array is incredibly slow -- around 7 ms!  Not sure what to make of this other than avoid property nodes at all costs -- even if it means using an ugly transparent indicator hack so I can change the BG color ...
    Attachments:
    Telemetry.vi ‏56 KB

  • What's the best way to display my iTunes Library?

    Hi All,
    I slways loved the idea that LP's. and to a lesser degree cd's, were something I loved to see displayed in my main room.  Flicking through my collection, seeing something I hadn't played in ages, but also having the cover art available to look at.  Not so easy having gone digital and being pressured to dispose of my CD's, I'd love to hear how people look through their collections, and have ways to visialise them on screens.

    Album view...

  • What is the best way to display different array values to appropriate indicators?

    I am using DAQmx Read vi and its output is an array. I need a way to pass each value to an appropriate front panel indicator, so I can monitor each sensor. I tried using "Index Array" and passing the array element to the indicators but it looks sloppy. Is there a more professional way? Thanks!
    Attachments:
    Mole.vi ‏215 KB

    Try using the Array to Cluster function in the Cluster subpallet. If you put all of your indicators in the same cluster on your front panel, you can then pass the array data to this function and then pass it directly to the cluster without having to index the array.
    criag

  • What's the best way to detect that text fits into ContainerControllers without scrolling?

    Hi.
    Question
    What's the best way to detect that text typed by user (or added programmatically) exceeds available container space and find out where starts truncated part? Is there available some other (than described bellow) easy way to detect it or disallow set of controllers to receive more characters that can be displayed in given composition area?
    My partialy failed attempt (simplified)
    For example lets say that I've got an editable textflow with attached two instances of ContainerController.
    var flow:TextFlow = createSomeFlowFromGivenString(sampleText),
        firstController = new ContainerController(firstSprite, 100, 30),
        lastController = new ContainerController(secondSprite, 600, 30);
    flow.interactionManager = new EditManager(new UndoManager());
    flow.flowComposer.addController(firstController);
    flow.flowComposer.addController(lastController);
    flow.flowComposer.updateAllControllers();
    With enabled vertical scroll policy I can compare height of the composition in last controller with height of the content:
    var bounds:Rectangle = lastController.getContentBounds(),
        overflow:Boolean =  lastController.compositionHeight < bounds.height;
    trace('Content does not fit into given area?', overflow)
    But when I switch vertical scroll policy off (lastController.verticalScrollPolicy = ScrollPolicy.OFF) - unfortunately this no longer works...(In my case scrolling should be dissabled, since text areas might have only one line with restricted width)
    Use case
    I want to create fillable form. Field might have a single or multiple lines. One field might start in the middle of the page, continue in the next line where it spreads through whole page and end in the - quarter of page width long  - third line. Text typed by the user can't exceed given area since it might cover some static text that sits right after/below field.
    Something like ascii image bellow:
    |                <PAGE>                    |
    |                                          |
    |                                          |
    |                                          |
    |               [Field starts here........ | 
    | ........................................ |
    | ........................................ |
    | Ends here..]                             |
    |                                          |
    |                                          |
    | [Another field] xxxx  xxxx xxxxxxxx x xx |
    | xxxxxxxxxxxxxxxxxxx                      |
    |                                          |
    |                              [One more.. |
    | .....]                                   |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    Info:
    [......]  <-- form fields starts with '[' character, and ends with ']'
    xxx       <-- sample, static text
    | and _   <-- page borders

    I've tried something like that previously, but it didn't work because then I've got vertical scroll policy to set to 'auto'. After changing verticalScrollPolicy to ScrollPolicy.OFF  in the last container it worked like a charm.
    Thanks zhen bian

Maybe you are looking for