About Applet displaying in different browsers

Hi,
When I am running my applet application in mozilla and IE browsers, its running properly. But In some versions of IE its not working properly that is I have a JTable where I am using the filter option from JDK1.6, in this table i will get some request data through server, but when I am running the applet in IE6.0, its not working with properly. Any body come across with this type of issue in past give some suggestion or solution.
Regards,

Are you sure IE6 is using Sun's plugin 6?
If I'm right, IE is using M$'s JRE plugin by default, leading to crappy and unpredicable behavior.

Similar Messages

  • Problems with site displaying in different browsers

    Hi,
    I have made this site in dreamweaver CS3 using one of the default templates when you make a new documents. On Safari and Firefox (and I think on recent IE browsers as well) it looks fine, however on IE6 and IE7 it messes up completely, and the content in the middle frame is pushed right down to the bottom of the page. You can view the site here: http://www.flat29.com/ (and check the source code there too)
    I have tried a number of different things to fix the problem, but I have no idea what is causing the issue, so its difficult to troubleshoot! Any help with this would be massively appriciated!
    Thanks
    Dan

    Unfortunately you have paid the penalty for using one of the templates which ships with Dreamweaver. They are amongst the most awfully constructed pieces of shite I have ever come across. They are not written for the novice to understand but by some twatt that has their head up their arse.
    Now I'm going to give you a few simple steps (which Adobe should have f_cking done before they released these pieces of crap) which will provide a stable approach.
    Step 1) Move your 'mainContent' <div> to directly after the end of your sidebar1 </div>. You can do this by selecting the 'mainContent' <div> tag at the bottom of Dreamweaver design view then switching to code view where you will see all of its code selected. Cut the code.
    Step 2) Go back into Dreamweaver design view and next select the 'sidebar1' <div> tag along the bottom of the window. Now switch back to code view and scroll down the page until you come to the end of the highlighted section of code i.e. (the end of the sidebar1 <div>)
    Step 3) Place your mouse cursor right after the closing </div> tag of the 'sidebar1' <div> and paste back in the 'mainContent' <div>.
    Step 4) Amend the css in your css style sheet for the 'mainContent' css selector to as below:
    .thrColFixHdr #mainContent {
    float: left;
    margin-left: 14px;
    display: inline;
      background-color: #000000;
    width: 404px;
    Thats it!
    Don't worry about IE6 no-one much uses that anymore.

  • Applet loading in different Browsers

    Hi...We are currently developing an applet thas is loaded into an embedded server from LANTRONIX (WiPort). We have been experienced randomly problems like classNotFound ClassNotDefFound.
    This applet must run on IE Firefox Netscape Navigator and Opera. Strangely applet works well only in Opera browser.
    Errors seems to be related to client side LAN speed. (If embedded web server is accessed from a 10Mbits LAN only Opera can run the applet. If webServer is accessed from a 100Mbits connection, all browsers can load tthe applet.)
    We read about different classloader for every browser, can it be related to the problem?
    Classes are compressed into .cab files.
    Is there any way to check class laoding into the html code.
    Thanks in advance.

    Are you sure IE6 is using Sun's plugin 6?
    If I'm right, IE is using M$'s JRE plugin by default, leading to crappy and unpredicable behavior.

  • Download Issues With Different Browsers

    I'm using a simple, simple download example app to fetch a
    file from a tomcat server. It seems to work fine on Mozilla
    fireFox, but when I use it with safari or opera I get the following
    error;
    quote:
    Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File
    I/O Error.
    at
    flexDownloadExample/init()[/Applications/apache-tomcat-5.5.1/webapps/flexDownloadExample/ src/flexDownloadExample.mxml:40]
    at
    flexDownloadExample/___flexDownloadExample_Application1_creationComplete()[/Applications/ apache-tomcat-5.5.1/webapps/flexDownloadExample/src/flexDownloadExample.mxml:2]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
    mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\co re\UIComponent.as:9051]
    at mx.core::UIComponent/set
    initialized()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:1167]
    at
    mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:698]
    at Function/
    http://adobe.com/AS3/2006/builtin::apply()
    at
    mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\core\UIComponent.as:8460]
    at
    mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src \mx\core\UIComponent.as:8403]
    I have absolutely no idea why this is. I havent been able to
    test this in internet explorer, but i'm guessing it will show the
    same error. My question then is, why is it that the code below
    works for one browser and not for another?

    Font Rendering
    Every browser and operating system and browser and operating sytem version (just about) renders text differently. Chrome on Windows is currently the worst at rendering text, since it's using an old Windows API which uses an outdated anti-aliasing algorithm for the text. So text in Chrome on Windows generally looks worse that text drawn in other browser or on other operating systems. Typekit has a 7 part blog post here <http://blog.typekit.com/2010/10/05/type-rendering-on-the-web/> about all the ins and outs of font display in different browsers and operating systems.
    Scroll Effects
    Scroll effects are measured from the top of the browser window. Thus when the height of the browser window differs, even on the same computer, where the top of the browser window is relative to your objects when the page is scrolled all the way to the bottom will differ. Without the URL for your site/page, this is only a guess, but I suspect this is what you're encountering.
    Several customers have asked for an option to set the key position as a distance from the bottom of the browser window rather than always being from the top in order to create items that have a specific final location when a page is scrolled all the way to the bottom, but Muse doesn't currently have that feature.

  • Navbar problems in different browsers

    Please help! I designed a navbar using a preformatted Dreamweaver template, but found that it displays differently in different browsers. The file can be found at
    http://www.npc.org/NPC909/links.html
    It displays fine in Opera and Safari (both Mac), but in Netscape and Firefox (both Mac) the navbar is bumped onto a second line. In IE (Mac) the navbar is on one line, but the dropdown submenus do not display.
    On the PC side, in IE 8 the navbar is vertically stacked while the two submenus display on the far left of the navbar, instead of directly below their parent links. In IE 7 the submenus don't line up with their parent links, and there is a thin black line on the right of the navbar. Again, Safari displays just fine.
    Our target audience is most likely to be a PC user with IE as their browser, but any suggestions you can provide to make the navbar and submenus display consistently across all browsers would be greatly appreciated.
    Thanks,
    Arthur

    Hi, Arthur,
    I don't notice that you put an id on the li for "orderpub" like this:
    <ul class="MenuBarHorizontal" id="MenuBar1">
           <li><a class="MenuBarHorizontal" href="index.html" style="text-decoration: none;">Home</a></li>
           <li><a href="background.html" style="text-decoration: none;">About NPC</a></li>
           <li><a href="#" class="MenuBarHorizontal MenuBarItemSubmenu">Members</a>
             <ul>
               <li><a href="membynam.html" style="text-decoration: none;">By Name</a></li>
               <li><a href="membycom.html" style="text-decoration: none;">By Organization</a></li>
               <li><a href="membycat.html" style="text-decoration: none;">By Category</a></li>
             </ul>
           </li>
           <li><a class="MenuBarItemSubmenu" href="reportsbydoc.html" style="text-decoration: none;">Reports</a>
             <ul>
               <li><a href="reportsbyyear.html" style="text-decoration: none;">Reports By Year</a></li>
               <li><a href="emergency.html" style="text-decoration: none;">Emergency<br/>
               Planning & Preparation</a></li>
               <li><a href="energyoutlook.html" style="text-decoration: none;">Energy Outlook</a></li>
               <li><a href="environissues.html" style="text-decoration: none;">Environmental Issues</a></li>
               <li><a href="natgas.html" style="text-decoration: none;">Natural Gas</a></li>
               <li><a href="refining.html" style="text-decoration: none;">Refining</a></li>
               <li><a href="research.html" style="text-decoration: none;">Research</a></li>
    <li><a href="resourcedev.html" style="text-decoration: none;">Resource Development</a></li>
    <li><a href="storage.html" style="text-decoration: none;">Storage</a></li>
               <li><a href="stratpetrolres.html" style="text-decoration: none;">Strategic<br/>
                 Petroleum<br/>
               Reserve</a></li>
    <li><a href="transport.html" style="text-decoration: none;">Transportation</a></li>
             </ul>
           </li>
           <li id="orderpub"><a style="text-decoration: none;" href="orderpub.html">Order Publications</a></li>
           <li><a href="links.html" style="text-decoration: none;">Links</a></li>
           <li class="MenuBarHorizontal"><a href="contactus.html" style="text-decoration: none;">Contact Us</a></li>
         </ul>
    In your CSS file, all you need to do is:
    /* Menu item containers, position children relative to this container and are a fixed width */
    ul.MenuBarHorizontal li
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        position: relative;
        text-align: center;
        cursor: default;
        float: left;
        text-indent: 0px;
        width: 9.25em; /* make this slightly narrower */
    li#orderpub {
        width: 9.54em; /* make this as wide as it needs to be, adjusting the previous rule as needed also */
    You don't actually need all that other coding for
    #home {
        font-size: 100%;
        background: #039;
        text-align: center;
        text-indent: 0px;
        margin: 0px;
        padding: 0px;
        float: left;
        list-style: none;
        position: relative;
        cursor: default;
        width: 10%;
    #aboutnpc {
        font-size: 100%;
        background: #039;
        text-align: center;
        text-indent: 0px;
        margin: 0px;
        padding: 0px;
        float: left;
        list-style: none;
        position: relative;
        cursor: default;
        width: 15%;
    #members {
        font-size: 100%;
        background: #039;
        text-align: center;
        text-indent: 0px;
        margin: 0px;
        padding: 0px;
        float: left;
        list-style: none;
        position: relative;
        cursor: default;
        width: 15%;
    #reports {
        font-size: 100%;
        background: #039;
        text-align: center;
        text-indent: 0px;
        margin: 0px;
        padding: 0px;
        float: left;
        list-style: none;
        position: relative;
        width: 15%;
    #orderpub {
        font-size: 100%;
        background: #039;
        text-align: center;
        text-indent: 0px;
        margin: 0px;
        padding: 0px;
        float: left;
        list-style: none;
        position: relative;
        cursor: default;
        width: 20%;
    #links {
        font-size: 100%;
        background: #039;
        text-align: center;
        text-indent: 0px;
        margin: 0px;
        padding: 0px;
        float: left;
        list-style: none;
        position: relative;
        cursor: default;
        width: 10%;
    #contactus {
        font-size: 100%;
        background: #039;
        text-align: center;
        text-indent: 0px;
        margin: 0px;
        padding: 0px;
        float: left;
        list-style: none;
        position: relative;
        cursor: default;
        width: 15%;
    which I would restyle as the following, in case you did want them:
    li#home, li#aboutnpc, li#members,li#reports, li#orderpub, li#links, li#contactus {
           font-size: 100%;
         background: #039;
         text-align: center;
         text-indent: 0px;
         margin: 0px;
         padding: 0px;
         float: left;
         list-style: none;
         position: relative;
         cursor: default;
    li#home {width: 10%;}
    li#aboutnpc {width: 15%;}
    li#members {width: 15%;}
    li#reports {width: 15%;}
    li#orderpub {width: 20%;}
    li#links {width: 10%;}
    li#contactus {width: 15%;}
    Applying those ids to the html, we get:
    <ul class="MenuBarHorizontal" id="MenuBar1">
           <li id="home"><a class="MenuBarHorizontal" href="index.html" style="text-decoration: none;">Home</a></li>
           <li id="aboutnpc"><a href="background.html" style="text-decoration: none;">About NPC</a></li>
           <li id="members"><a href="#" class="MenuBarHorizontal MenuBarItemSubmenu">Members</a>
             <ul>
               <li><a href="membynam.html" style="text-decoration: none;">By Name</a></li>
               <li><a href="membycom.html" style="text-decoration: none;">By Organization</a></li>
               <li><a href="membycat.html" style="text-decoration: none;">By Category</a></li>
             </ul>
           </li>
           <li id=reports"><a class="MenuBarItemSubmenu" href="reportsbydoc.html" style="text-decoration: none;">Reports</a>
             <ul>
               <li><a href="reportsbyyear.html" style="text-decoration: none;">Reports By Year</a></li>
               <li><a href="emergency.html" style="text-decoration: none;">Emergency<br/>
               Planning & Preparation</a></li>
               <li><a href="energyoutlook.html" style="text-decoration: none;">Energy Outlook</a></li>
               <li><a href="environissues.html" style="text-decoration: none;">Environmental Issues</a></li>
               <li><a href="natgas.html" style="text-decoration: none;">Natural Gas</a></li>
               <li><a href="refining.html" style="text-decoration: none;">Refining</a></li>
               <li><a href="research.html" style="text-decoration: none;">Research</a></li>
    <li><a href="resourcedev.html" style="text-decoration: none;">Resource Development</a></li>
    <li><a href="storage.html" style="text-decoration: none;">Storage</a></li>
               <li><a href="stratpetrolres.html" style="text-decoration: none;">Strategic<br/>
                 Petroleum<br/>
               Reserve</a></li>
    <li><a href="transport.html" style="text-decoration: none;">Transportation</a></li>
             </ul>
           </li>
           <li id="orderpub"><a href="orderpub.html" style="text-decoration: none;" class="">Order Publications</a></li>
           <li id="links"><a href="links.html" style="text-decoration: none;">Links</a></li>
           <li id="contactus" class="MenuBarHorizontal"><a href="contactus.html" style="text-decoration: none;">Contact Us</a></li>
         </ul>
    Note that each main head li has an id now.
    Beth

  • How come my links layout go all over the place in different browsers?

    Hello,
    Please go to <http://www.peterdanko.com/errr.png> and see the screen shot of the page I am having difficulty with in the  design view.  Note the links: INSTALLATIONS, BELT COLORS, FINISHING, PRICING are neatly centered with the text body above and in a single line.
    Now view <http://www.peterdanko.com/atmos.html>  Note they are now stacked and randomly placed.  In different browsers they are all over the place.
    How can I keep them neat and tidy in all browsers?
    Thanks
    PETER

    Below is the complete html code/css re-written for the 'product-wrapper' section. (scroll down). Not sure if this is of help or not. I think you need to take some time to learn some more html/css as the way youre going about it at the moment must be a complete nightmare for you. Copy the code below, (scroll down) paste into a new Dreamweaver document and save to your site folder. View in browser.
    You need to simplify your way of working instead of creating a <div> for each of your page elements, which must be a headache to keep track of???
    Example: Instead of putting your header 'Atmos Seating Group' in it's own individual <div> use a more meaningfull html tag like a header tag, <h2>Atmos Seating Group</h2>
    Then use some css to target the <h2>. We know the <h2> tag is in the 'right_tx_bx_400pxWd' <div> so write it as below:
    right_tx_bx_400pxWd h2 {
    text-align: center;
    margin: 15px 0;
    font-size: 20px;
    font-weight: normal;
    color: #999;
    Similarly instead of inserting the main wording in its own <div> use a paragraph tag, <p></p> it's more meaningful. Then target the paragraph tag:
    #right_tx_bx_400pxWd p {
    font-size: 13px;
    line-height: 16px;
    color: #999;
    Get the point. We only have to keep track of one <div> not several and we can target tags in that <div> more cleanly and effectively.
    Try and keep all off your css together i.e. so all the 'right_tx_bx_400pxWd' css is kept together so its easy to find in the stylesheet intead of scrolling up and down.
    Don't use heights on <divs> unless you know how high it will be and you won't know that unless it just contains images or you set a specific height for a scroll bar.
    BELOW IS THE CODE:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    #product_wrapper {
    width: 932px;
    margin: 0 auto;
    overflow: hidden;
    #left_image_column {
    float: left;
    width: 512px;
    #right_tx_bx_400pxWd {
    float: left;
    width: 400px;
    font-family: Arial, Helvetica, sans-serif;
    margin-left: 20px;
    display: inline;
    #right_tx_bx_400pxWd h2 {
    text-align: center;
    margin: 15px 0;
    font-size: 20px;
    font-weight: normal;
    color: #999;
    #right_tx_bx_400pxWd p {
    font-size: 13px;
    line-height: 16px;
    color: #999;
    #right_tx_bx_400pxWd h3 {
    text-align: center;
    margin: 15px 0 10px 0;
    padding: 0;
    font-size: 14px;
    font-weight: normal;
    color: #999;
    #right_tx_bx_400pxWd ul {
    margin: 0;
    padding: 0;
    text-align: center;
    #right_tx_bx_400pxWd li {
    text-align: center;
    font-size: 13px;
    margin: 0 0 3px 0;
    font-style: italic;
    color: #CCC;
    /* footer links */
    #four_text_link_box {
    clear: both;
    width: 400px;
    padding: 20px 0 0 0;
    #four_text_link_box ul {
    margin: 0;
    padding: 0;
    #four_text_link_box li {
    margin: 0;
    padding: 0;
    float: left;
    list-style: none;
    text-align: center;
    #right_tx_bx_400pxWd #four_text_link_box a {
    float: left;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #999;
    text-decoration: underline;
    display: block;
    width: 100px;
    text-align: center;
    font-style: normal;
    /* end footer links */
    </style>
    </head>
    <body>
    <div id="product_wrapper">
    <div id="left_image_column"><img src="atmos_images/atmos_lounge_blk_belt.jpg" alt="Atmos lounge" name="at_lounge" width="512" height="400" id="at_lounge" /></div>
    <div id="right_tx_bx_400pxWd">
    <h2>Atmos Seating Group</h2>
    <p>The Atmos chairs are the essence of OMG design.  They are comfortable. They evolve the Shaker esthetic of spare/elegant utility into the eco-modernist sensibility:  The straps are post industrially sourced automotive seat belt material, the “ears” at the top of the backs acknowledge our natural world, and though strong, its lightweight structure uses minimal material.  The contrasting splines on the rocker and lounge chairs celebrate craftsmanship. Wood is American Ash sourced from FSC certified forests; adhesives and finishes are water based.  Suitable for residential and designed for contract applications.</p>
    <h3>OMG characteristics:</h3>
    <ul>
    <li>use of post-industrial belting as substitute for the more problematic  use of foam as cushion material fabric</li>
    <li>low carbon footprint.</li>
    <li>ply-bent construction</li>
    <li>evokes the enchantment of an eco centric style</li>
    </ul>
    <div id="four_text_link_box">
    <ul>
    <li><a href="at_installs.html">Installations</a></li>
    <li><a href="#" onclick="MM_openBrWindow('images/belt_samples.gif','belts','scrollbar s=yes,resizable=yes,width=300,height=100')">Belt Colors</a></li>
    <li><a href="#" onclick="MM_openBrWindow('images/wood_finishes.gif','finishes','scrol lbars=yes,resizable=yes,width=600,height=175')">Finishes</a></li>
    <li><a href="#" onclick="MM_openBrWindow('_danko_2010pricelist/at_prices.gif','','scr ollbars=yes,resizable=yes,width=400,height=500')">Pricing</a></li>
    </ul>
    </div><!-- end four_text_link_box -->
    </div><!-- end right_tx_bx_400pxWd -->
      <div id="bottom_rule">
          <p> </p>
          <p> </p>
        </div>
        <div id="product_box"></div>
    </div><!-- end product_wrapper -->
    </body>
    </html>.

  • CSS problem with content in different browsers?

    I've been revamping the CSS for a website and got most internal pages to display normally on different browsers. However, the site entry page is driving me nuts. I think I've been staring at the code so long that I've overlooked an obvious error. In Firefox, the paragraph of intro text lines up nicely to the right of the navigation panel. In Google Chrome (and IE of course), it pops down underneath the nav panel as shown in screen capture below. Even if I zoom out. Included a link so you can see it in real time. (Since the revamp is recent, the style sheet isn't pretty.)
    http://www.keithpurtell.com/kthings/index.htm

    Sorry for the slow reply. Thanksgiving and family in town and all that. No I didn't fix or change anything. And I'll make sure the percentage match in the morning. It's after midnight here.

  • Issue with images in different browsers

    Having an issue with different browsers -- hoped someone
    could help.
    If I open my site with IE, everything looks as it does in
    Dreamweaver -- there is no overlap of text and images/etc.
    If I open my site with Mozilla or Safari, it seems to
    arbitrarily move up some of the images over the top of text. Not
    all of the images, mind you -- just a few random ones throughout
    the page.
    Opening the following link in both type of browsers may give
    you a clue as to what is going on. What can I do to get it to look
    like it does in IE?
    http://www.centecsystems.com/centecexample/disanapplications.htm

    LOL ahem, 'scuze me. :-)
    -N
    "Walt F. Schaefer" <[email protected]> wrote in
    message
    news:[email protected]...
    > >>For that we rely on IE hacks
    >
    > In polite company we call those "conditional comments".
    > --
    >
    > Walt
    >
    >
    > "Nancy O" <[email protected]> wrote in
    message
    > news:[email protected]...
    > > First off, you are assuming incorrectly that IE is
    the good browser and
    > > Mozilla is the bad browser. Actually, it's the
    other way around. If
    you
    > > build your sites to perform well in Mozilla,
    chances are your sites will
    > > look good in all major browsers except IE. For that
    we rely on IE hacks
    > > or
    > > workarounds.
    > >
    > > Learning html and CSS takes time and effort but
    it's very doable. You
    > > would
    > > be doing yourself a big favor by learning to work
    with code now. Design
    > > view is fine for some things, like typing content
    and adding a few
    images.
    > > But eventually you have to pop the hood to check
    the oil. If hiring a
    pro
    > > isn't an option, I suggest you purchase a solid
    template to work with.
    > > Money well-spent IMHO.
    > >
    http://www.projectseven.com/products/templates/
    > >
    > >
    > >
    > > --Nancy O.
    > > Alt-Web Design & Publishing
    > > www.alt-web.com
    > >
    > >
    > >
    > >
    > > "PunIntended" <[email protected]>
    wrote in message
    > > news:[email protected]...
    > >> Unfortunately, hiring someone is not an option
    for my friend -- the
    > > recession
    > >> has hit them hard -- etc.etc. I'm doing it as a
    favor.
    > >>
    > >> One additional question -- Why are only some of
    the image files moved
    > > when
    > >> viewing in mozilla? I dont understand how
    Dreamweaver arbitrarily
    > >> chooses
    > >> which are moved and which are not.
    > >>
    > >> Also, is laying out your site in 'design' mode
    simply a bad idea? It
    > > seems
    > >> like it looks / works fine with IE, and the
    majority of the layers are
    > > correct
    > >> in mozilla -- it just doesn't deal well with a
    few of the images.
    > >>
    > >> Thank you again for all your comments - - like
    I said, am sort of a
    > > beginner
    > >> -- just looking for the best method to fix the
    problem. If the best
    > > method is
    > >> explaing to the graphic designers their
    'vision' can't be accomplished,
    > >> so
    > > be
    > >> it. I just want to know how to go about
    attacking the browser
    > > compatibility.
    > >>
    > >
    > >
    >
    >

  • Two External Displays and Internal Display Over Different Connections

    Hi there.
    I'm going to be purchasing a rMBP in the very, very near future. However, I am unclear about how external displays work with this. My current display setup at work is two basic 1080p monitors that can be run over DVI, VGA or HDMI. I'd like to keep using these when I start using the rMBP but also gain the advantage of a third screen by using the internal display at the same time (so much space for activities!).
    One of the thunderbolt ports will need to be used for an Ethernet connection (there is no wireless here), so this leaves the setup needing to be one monitor run via Thunderbolt -> DVI and the other monitor run via HDMI.
    The internet in general isn't being entirely helpful with this. I'm looking for a clear answer of whether the rMBP will run the internal display and the two external displays using this setup under OS X. Some seem to believe that it won't work using different connection types, for example.
    Thanks for any help.

    Hello dljfield,
    Thanks for using Apple Support Communities.
    If you'd like to use multiple external displays with a MacBook Pro with Retina display, then please take a look at the information outlined below. A 15" MacBook Pro mid-2014 can support up to two external displays using different outputs.
    MacBook Pro (Retina, 15-inch, Mid 2014) - Technical Specifications
    OS X Yosemite: Connect multiple displays to your Mac
    Take care,
    Alex H.

  • Mac OS X 10.7.4 ARD Issues When Observing/Controlling Computers with Display Mirroring/Different Resolutions

    As if Macs in an enterprise environment could be more difficult to manage, now since our upgrade to OS X 10.7.(4) I have lost the ability to remotely control numerous Macs in our organization. The issue occurs when attempting to control a Mac running OS X 10.7.(4) that has their Display mirrored and the resolution does not match on both displays. What happens is that I can see the remote screen however it does not fill the entire Observe/Control window. Instead, the remote screen takes up about 50% of the window, the rest is black but sometimes will display a mirror image of the remote screen in the black area. What?! Yeah, I've attached a screenshot because this is ridiculous. The real problem is that I cannot control the computer when it has reached this state, the mouse no longer functions properly, it is not clicking where I place the mouse, etc. I have made sure that I have all updates including ARD Client/Server updates. I even tried VNC but as I have come to find out that is a whole other issue (doesn't work, sends me to the login screen, etc).
    So here's what I need:
    - A patch that is going to fix this issue
    - A script to run that is going to change the remote screen resolution (I still have the ability to run remote scripts, etc. simply not Observe/Control)
    Ideas?
    <Image Edited by Host>

    I found a way to work around this issue.  Not a fix but a work around.
    This is little application some one wrote to toggle mirroring on and off.
    Mirror Displays
    If you put this application in the client computer's /Aplications folder
    you can use ARD or SSH to run the app and switch modes.
    The problem only occurs for me when a client is set to mirror dissimilar displays with different aspect ratios.
    I am only seeing this in Lion 10.7.4 and 10.7.5
    Hope it helps someone....

  • Saving Applet display as an image... Java newb

    Hello,
    I'm using wirefusion3D to display and configure 3D objects on a website I've been developing. The only thing it lacks is the ability to save out an image of the current display, which I need to do in order to place those images on a pdf invoice.
    It does, however, have the ability to include custom java code within the applet, so I would like to create a function that will take a snapshot of the current rendered applet display and save that snapshot as a bitmap image on the server. I'm new to Java (I'm a PHP/Javascript guy), and have had no luck finding anything about how this would be done. I'm not really sure what to search for, as I don't really know what java functions/classes deal with this sort of thing.
    I was hoping someone could point me in the right direction.
    Thanks in advance

    1. If all the drawing is taking place in one J/Component, you can construct a BufferedImage, obtain a reference to its associated Graphics and call paint/Component passing the Graphics reference as parameter. Then save the image to a file.
    2. java.awt.Robot#createScreenCapture returns a BufferedImage which is a snapshot of the screen.
    db

  • Running Web Dynpro Applications in Different Browsers

    Hi,
    I runned an Web Dynpro Application in different browsers(Opera, Firefox and Internet Explorer). The problem is that in Firefox is running fine, but in Internet Explorer some controls are missing and in Opera I got an Error Page that say the following:
    An error has occurred:
    "Failed to process the request."
    Please contact your system administrator.
    This page was created by SAP NetWeaver. All rights reserved.
    Web Dynpro client:
    Nokia Series 80 Client
    Web Dynpro client capabilities:
    User agent: Opera/9.25 (Windows NT 6.0; U; en), client type: op6, client type profile: op6, ActiveX: disabled, Cookies: enabled, Frames: enabled, Java applets: disabled, JavaScript: enabled, Tables: enabled, VB Script: enabled
    Accessibility mode: false
    Web Dynpro runtime:
    Vendor: SAP, build ID: 7.0013.20070717142021.0000 (release=645_VAL_REL, buildtime=2007-08-11:15:13:14[UTC], changelist=455669, host=pwdfm101), build date: Wed Nov 14 08:48:35 GMT-03:00 2007
    Web Dynpro code generators of DC agile.com/pmg_bonefish~webdynpro:
    SapDictionaryGenerationCore: 7.0013.20061002105236.0000 (release=645_VAL_REL, buildtime=2007-08-11:14:57:42[UTC], changelist=419377, host=PWDFM101.wdf.sap.corp)
    SapMetamodelWebDynpro: 7.0013.20070703112649.0000 (release=645_VAL_REL, buildtime=2007-08-11:15:00:50[UTC], changelist=454024, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCore: 7.0013.20061002105432.0000 (release=645_VAL_REL, buildtime=2007-08-11:14:45:23[UTC], changelist=419384, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationTemplates: 7.0013.20070717142021.0000 (release=645_VAL_REL, buildtime=2007-08-11:15:15:27[UTC], changelist=455669, host=pwdfm101)
    SapWebDynproGenerationCTemplates: 7.0013.20070717142021.0000 (release=645_VAL_REL, buildtime=2007-08-11:15:15:27[UTC], changelist=455669, host=pwdfm101)
    SapGenerationFrameworkCore: 7.0013.20060719095755.0000 (release=645_VAL_REL, buildtime=2007-08-11:14:44:42[UTC], changelist=411255, host=PWDFM101.wdf.sap.corp)
    SapIdeWebDynproCheckLayer: 7.0013.20061002110128.0000 (release=645_VAL_REL, buildtime=2007-08-11:15:04:26[UTC], changelist=419396, host=PWDFM101.wdf.sap.corp)
    SapMetamodelDictionary: 7.0013.20060719095619.0000 (release=645_VAL_REL, buildtime=2007-08-11:14:54:53[UTC], changelist=411251, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCommon: 7.0013.20061002105432.0000 (release=645_VAL_REL, buildtime=2007-08-11:14:45:30[UTC], changelist=419384, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationCore: 7.0013.20061002110128.0000 (release=645_VAL_REL, buildtime=2007-08-11:15:04:37[UTC], changelist=419396, host=PWDFM101.wdf.sap.corp)
    SapDictionaryGenerationTemplates: 7.0013.20061002105236.0000 (release=645_VAL_REL, buildtime=2007-08-11:14:57:50[UTC], changelist=419377, host=PWDFM101.wdf.sap.corp)
    Web Dynpro code generators of DC sap.com/tcwddispwda: No information available!
    Web Dynpro code generators of DC sap.com/cafUIptn~common:
    SapDictionaryGenerationCore: 7.0013.20061002105236.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:26:06[UTC], changelist=419377, host=PWDFM101.wdf.sap.corp)
    SapMetamodelWebDynpro: 7.0013.20070703112649.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:28:49[UTC], changelist=454024, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCore: 7.0013.20061002105432.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:14:35[UTC], changelist=419384, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationTemplates: 7.0013.20070717142021.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:42:07[UTC], changelist=455669, host=pwdfm101)
    SapWebDynproGenerationCTemplates: 7.0013.20070717142021.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:42:07[UTC], changelist=455669, host=pwdfm101)
    SapGenerationFrameworkCore: 7.0013.20060719095755.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:13:54[UTC], changelist=411255, host=PWDFM101.wdf.sap.corp)
    SapIdeWebDynproCheckLayer: 7.0013.20061002110128.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:32:11[UTC], changelist=419396, host=PWDFM101.wdf.sap.corp)
    SapMetamodelDictionary: 7.0013.20060719095619.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:23:29[UTC], changelist=411251, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCommon: 7.0013.20061002105432.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:14:42[UTC], changelist=419384, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationCore: 7.0013.20061002110128.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:32:21[UTC], changelist=419396, host=PWDFM101.wdf.sap.corp)
    SapDictionaryGenerationTemplates: 7.0013.20061002105236.0000 (release=645_VAL_REL, buildtime=2007-08-07:13:26:13[UTC], changelist=419377, host=PWDFM101.wdf.sap.corp)
    Web Dynpro code generators of DC sap.com/tcwdcorecomp: No information available!
    J2EE Engine:
    7.00   patchlevel 109044.44
    Java VM:
    Java HotSpot(TM) Server VM, version: 1.4.2_09-b05, vendor: Sun Microsystems Inc.
    Operating system:
    Windows 2003, version: 5.2, architecture: x86
    I don´t know is the problem I have in both browsers Internet Explorer and Opera are from the browser or from the layout I´m using in Web Dynpro.
    regards

    Hi Aida,
    For getting an information of the Web Browsers supported by SAP NetWeaver, check out the following link:
    [http://service.sap.com/pam|http://service.sap.com/pam]
    To access the Product Availability Matrix (PAM), you will need a sUser Login Name.
    For Reference,
    http://help.sap.com/saphelp_nw04s/helpdata/en/79/23c7410400c717e10000000a155106/frameset.htm
    Regards,
    Alka.

  • Messagebox that displays a different randum number every 2 secs

    well im having trouble with putting a messagebox that displays a different randum number every 2 secs and closes with a close button. it goes in the print menu option of this simple text editor,you shoud also be able to work in the background while this message box is been displayed.
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.text.rtf.*;
    import javax.swing.event.*;
    import javax.swing.filechooser.*;
    import javax.swing.undo.*;
    import java.util.Timer;
    import java.util.TimerTask;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import java.beans.*;
      -------------------| Simple Text Editor example application using Java 1.3 with Swing |--------------
    public class SimpleTextEditor extends JFrame
            private JTextPane textpane;
            private JMenuBar mb;
            private JFileChooser chooser,picChooser;
            private Hashtable actions;
            private JPopupMenu popup;
            private JMenuItem exit, newDoc, save, open, saveAs,print;
            private About ab;
            private StyledEditorKit edkit;
            private RTFEditorKit rtfkit;
            private DefaultStyledDocument doc;
            private MyDocumentListener doclistener;
           private MyUndoableEditListener undolistener;
             //Useful variables
            private String filename="untitled1.txt",filetype=".txt";
            private File thisfile;
            protected String FileFormats[],FileDescriptions[],PicFileFormats[],PicFileDescriptions[];
            protected boolean DocumentIsUnedited=true, DocumentIsSaved=false;
            public static int SQUARE=0,TRIANGLE=1,CIRCLE=2;
            public String newline="\n";
            protected UndoManager undo ;
            protected UndoAction undoAction;
            protected RedoAction redoAction;
            // These are the actions used in the menus and on the toolbar
            protected Action bold, italic, underline, alignleft, alignright, aligncentre;
            protected Action spellchecker, alignjustify, more, cut, copy, paste, tools[];
            public SimpleTextEditor()
                    super("SimpleTextEditor - untitled1.rtf");
                    this.setLocation(200,200);
                    this.setIconImage(getMyIcon("Icon.gif").getImage());
                    getContentPane().setLayout(new BorderLayout());
                    undo = new UndoManager();
                    //Set up the file formats and file choosers etc
                    FileFormats = new String[]{".rtf",".txt",".java",".bat"};
                    FileDescriptions = new String[]{"Rich Text Format Files","Text Files","Java Source Files","DOS Batch Files"};
                    PicFileFormats = new String[]{".gif",".bmp",".jpg"};
                    PicFileDescriptions = new String[]{"Gif Images","Bitmap Images","JPEG Images"};
                    chooser = new JFileChooser();
                    picChooser = new JFileChooser();
                    picChooser.setAccessory(new ImagePreview(picChooser));
                    javax.swing.filechooser.FileFilter defaultFilter = new SimpleFilter(FileFormats[0],FileDescriptions[0]);
                    javax.swing.filechooser.FileFilter defaultPicFilter = new SimpleFilter(PicFileFormats[0],PicFileDescriptions[0]);
                    for(int i=1;i<FileFormats.length;i++){
                            chooser.addChoosableFileFilter(new SimpleFilter(FileFormats,FileDescriptions[i]));
    for(int i=1;i<PicFileFormats.length;i++){
    picChooser.addChoosableFileFilter(new SimpleFilter(PicFileFormats[i],PicFileDescriptions[i]));
    chooser.setFileFilter(defaultFilter);
    picChooser.setFileFilter(defaultPicFilter);
    File working = new File("C:/Documents");
    if(!working.exists()){
    working= new File("C:/MyDocuments");
    if(!working.exists()) working = new File("C:/");
    if(working.exists()) {
    chooser.setCurrentDirectory(working);
    picChooser.setCurrentDirectory(working);
    // Set up Document object and Editor kits
    doc = new DefaultStyledDocument();
    edkit = new StyledEditorKit();
    rtfkit = new RTFEditorKit();
    // Set up Listener objects
    doclistener= new MyDocumentListener();
    undolistener= new MyUndoableEditListener();
    doc.addDocumentListener(doclistener);
    doc.addUndoableEditListener(undolistener);
    //Set up main GUI content
    textpane=new JTextPane(doc);
    textpane.setPreferredSize(new Dimension(400,400));
    textpane.setMinimumSize(new Dimension(400,400));
    JScrollPane scroller=new JScrollPane(textpane);
    scroller.setPreferredSize(new Dimension(400,400));
    mb=new JMenuBar(); // Create a menu bar
    JMenu File=new JMenu("File");
    JMenu Help=new JMenu("Help");
    //Sort out Actions etc
    createActionTable(textpane);
    createToolbarActions();
    JMenu Style=createStyleMenu();
    undoAction = new UndoAction();
    redoAction = new RedoAction();
    //Create Style, Edit and Format menus + Toolbar
    JMenu Edit=createEditMenu();
    JMenu Format=createFormatMenu();
    JMenu Insert = createInsertMenu();
    JToolBar toolbar = createToolbar();
    getContentPane().add("North",toolbar);
    // set up main menu items with ActionListeners
    newDoc=new JMenuItem("New");
    newDoc.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    newDoc();
    exit=new JMenuItem("Exit");
    exit.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    exit();
    print=new JMenuItem("Print");
    print.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    print();
    save=new JMenuItem("Save");
    save.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    save();
    saveAs=new JMenuItem("Save As...");
    saveAs.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    saveas();
    open=new JMenuItem("Open...");
    open.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    open();
    JMenuItem about=new JMenuItem("About");
    about.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    ab=new About(SimpleTextEditor.this);
    ab.show();
    ab.setLocation(400,300);
    // Create the popup menu
    popup = createEditMenu().getPopupMenu();
    popup.addSeparator();
    popup.add(createStyleMenu());
    popup.add(createFormatMenu());
    textpane.add(popup);
    // set up Help and File menus
    Help.add(about);
    File.add(newDoc);
    File.add(open);
    File.add(print);
    File.add(save);
    File.add(saveAs);
    File.addSeparator();
    File.add(exit);
    // add the menus to the menubar
    mb.add(File);
    mb.add(Edit);
    mb.add(Format);
    mb.add(Style);
    mb.add(Insert);
    mb.add(Help);
    this.setJMenuBar(mb);
    getContentPane().add("Center",scroller);
    // Add mouse Listener to the textpane for popup events
    textpane.addMouseListener(new MouseAdapter(){
    public void mousePressed(MouseEvent e)
    if(e.isPopupTrigger())
    popup.show(textpane, e.getX(), e.getY());
    e.consume();
    public void mouseReleased(MouseEvent e)
    if(e.isPopupTrigger())
    popup.show(textpane, e.getX(), e.getY());
    e.consume();
    //-----------------| Main active methods |------------------
    public void exit()// Main Exit method
    if(DocumentIsUnedited){//Check that document is saved/unedited etc
    dispose();
    setVisible(false);
    System.exit(0);
    else{
    switch(showNotSavedDialog("Exit")){
    case JOptionPane.YES_OPTION: save(); exit(); break;
    case JOptionPane.NO_OPTION: DocumentIsUnedited=true;exit();break;
    case JOptionPane.CANCEL_OPTION: break;
    public void newDoc()//Method to create new documents
    if(DocumentIsUnedited){
    initDoc();
    filename="untitled.txt";
    filetype=".txt";
    resetTitle();
    else
    switch(showNotSavedDialog("New Document")){
    case JOptionPane.YES_OPTION: save(); newDoc(); break;
    case JOptionPane.NO_OPTION: DocumentIsUnedited=true;newDoc();break;
    case JOptionPane.CANCEL_OPTION: break;
    private void initDoc()// Helper method to initialize a new document
    doc = null;
    doc = (DefaultStyledDocument)edkit.createDefaultDocument();
    doc.addDocumentListener(doclistener);
    textpane.setStyledDocument(doc);
    public void print()
    new TimerTestFrame();
    class TimerTestFrame extends JFrame
    Timer timer;
    TimerTestFrame()
    super();
    timer = new Timer(true);
    TimerTask task = new MessageTimer(TimerTestFrame.this);
    timer.schedule(task,2000,2000);
    class MessageTimer extends TimerTask
    Component parent;
    public MessageTimer(Component parent)
    this.parent = parent;
    public void run()
    int randnum = (1 +(int)(Math.random()*10));
    JOptionPane.showMessageDialog(parent,""+randnum,"Timer Message",JOptionPane.INFORMATION_MESSAGE);
    public void saveas()
    int n = chooser.showSaveDialog(this);
    if(n==0){
    filename=chooser.getSelectedFile().getName();
    boolean ext = false;
    setFiletype();
    thisfile = new File(chooser.getCurrentDirectory(),filename);
    DocumentIsSaved=true;
    save();
    resetTitle();
    repaint();
    public void save()// Save method. Used by "Save As..." as well
    if( DocumentIsSaved)
    try
    FileOutputStream out = new FileOutputStream(thisfile);
    if((filetype.equals(".rtf"))||(filetype.equals(".doc"))){
    rtfkit.write(out,doc,0,doc.getLength());
    else edkit.write(out,doc,0,doc.getLength());
    catch(Exception e)
    System.out.println(""+e.getMessage()+"");
    DocumentIsUnedited=true;
    else saveas();
    public void open()// Find a file and read it into the document
    if(DocumentIsUnedited){
    int n = chooser.showOpenDialog(this); // get the outcome of the dialog
    if(n==0){
    File file = chooser.getSelectedFile();
    filename=chooser.getName(file);
    setFiletype();
    resetTitle();
    initDoc();
    try
    FileInputStream in= new FileInputStream(file);
    if(filetype.equals(".rtf")){
    rtfkit.read(in,doc,0);
    edkit.read(in,doc,0);
    catch(Exception e)
    System.out.println(""+e.getMessage()+"");
    thisfile= new File(chooser.getCurrentDirectory(),chooser.getSelectedFile().getName());
    DocumentIsUnedited=true;
    DocumentIsSaved=true;
    resetTitle();
    repaint();
    else
    switch(showNotSavedDialog("Open")){
    case JOptionPane.YES_OPTION: save(); open(); break;
    case JOptionPane.NO_OPTION: DocumentIsUnedited=true; open(); break;
    case JOptionPane.CANCEL_OPTION: break;
    private void setFiletype()// Helper method to get the filetype of saved/opened documents
    filetype=null;
    for(int i=0;i<FileFormats.length;i++){
    if(filename.toLowerCase().endsWith(FileFormats[i])) filetype = FileFormats[i];
    else{
    for(i=0;i<filename.length();i++){
    if(filename.toLowerCase().charAt(i)=='.')
    filetype=filename.substring(i);
    if(filetype==null) filetype=".txt";
    private void resetTitle()
    this.setTitle("SimpleTextEditor - "+filename);
    private ImageIcon getMyIcon(String filename){
    ImageIcon pic = new ImageIcon("Images/"+filename);
    return pic;
    private int showNotSavedDialog(String title)// Helper method to create "Save? Yes/No/Cancel" dialogs
    int n = JOptionPane.showConfirmDialog(this,"The last document has not been saved. \nDo you want to save it first?",
    title,
    JOptionPane.YES_NO_CANCEL_OPTION,
    JOptionPane.QUESTION_MESSAGE);
    return n;
    //-----------------| Listeners and Helper classes |----------------
    protected class MyDocumentListener implements DocumentListener
    public void insertUpdate(DocumentEvent e) {
    SimpleTextEditor.this.DocumentIsUnedited=false;
    public void removeUpdate(DocumentEvent e) {
    SimpleTextEditor.this.DocumentIsUnedited=false;
    public void changedUpdate(DocumentEvent e) {
    SimpleTextEditor.this.DocumentIsUnedited=false;
    protected class MyUndoableEditListener implements UndoableEditListener {
    public void undoableEditHappened(UndoableEditEvent e) {
    //Remember the edit and update the menus.
    undo.addEdit(e.getEdit());
    undoAction.updateUndoState();
    redoAction.updateRedoState();
    //Helper class for FileFilter, allows a description to be assigned to a filetype
    protected class SimpleFilter extends javax.swing.filechooser.FileFilter
    String type,des;
    public SimpleFilter(String type, String des)
    this.des=des;
    this.type=type;
    public boolean accept(File f){
    if(f.isDirectory())return true;
    else{
    if(f.getName().toLowerCase().endsWith(type)) return true;
    else return false;
    public String getDescription(){
    return des;
    //------------| Methods to help create menus and toolbar |--------------
    protected JMenu createStyleMenu()
    JMenu menu = new JMenu("Style");
    menu.add(bold);
    menu.add(italic);
    menu.add(underline);
    menu.addSeparator();
    menu.add(new StyledEditorKit.FontSizeAction("12", 12));
    menu.add(new StyledEditorKit.FontSizeAction("14", 14));
    menu.add(new StyledEditorKit.FontSizeAction("18", 18));
    menu.addSeparator();
    menu.add(new StyledEditorKit.FontFamilyAction("Serif","Serif"));
    menu.add(new StyledEditorKit.FontFamilyAction("SansSerif","SansSerif"));
    menu.addSeparator();
    Action red = new StyledEditorKit.ForegroundAction("Red", new Color(255,0,0));
    red.putValue(Action.SMALL_ICON,getMyIcon("red.gif"));
    menu.add(red);
    Action green = new StyledEditorKit.ForegroundAction("Green", new Color(0,150,0));
    green.putValue(Action.SMALL_ICON,getMyIcon("green.gif"));
    menu.add(green);
    Action blue = new StyledEditorKit.ForegroundAction("Blue", new Color(0,50,150));
    blue.putValue(Action.SMALL_ICON,getMyIcon("blue.gif"));
    menu.add(blue);
    Action black = new StyledEditorKit.ForegroundAction("Black", new Color(0,0,0));
    black.putValue(Action.SMALL_ICON,getMyIcon("black.gif"));
    menu.add(black);
    menu.add(more);
    return menu;
    protected JMenu createEditMenu() {
    JMenu menu = new JMenu("Edit");
    menu.add(undoAction);
    menu.add(redoAction);
    menu.addSeparator();
    menu.add(cut);
    menu.add(copy);
    menu.add(paste);
    menu.addSeparator();
    Action selectall=getActionByName(DefaultEditorKit.selectAllAction);
    selectall.putValue(Action.NAME, "Select All");
    menu.add(selectall);
    return menu;
    protected JMenu createFormatMenu(){
    JMenu menu = new JMenu("Format");
    menu.add(spellchecker);
    menu.add(alignleft);
    menu.add(alignright);
    menu.add(aligncentre);
    menu.add(alignjustify);
    return menu;
    protected JMenu createInsertMenu(){
    JMenu menu = new JMenu("Insert");
    Action insertimage = new InsertImageAction(this);
    menu.add(insertimage);
    Action insertdate = new InsertDateAction();
    menu.add(insertdate);
    Action insertline = new InsertLineAction();
    menu.add(insertline);
    JMenu bullets =new JMenu("Bullet Points");
    bullets.add(new InsertBulletAction(CIRCLE,"Circle"));
    bullets.add(new InsertBulletAction(TRIANGLE,"Triangle"));
    bullets.add(new InsertBulletAction(SQUARE,"Square"));
    menu.add(bullets);
    return menu;
    public JToolBar createToolbar(){
    JToolBar bar= new JToolBar();
    JButton newbutton=new JButton(getMyIcon("new.gif"));
    newbutton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    newDoc();
    bar.add(newbutton);
    JButton savebutton=new JButton(getMyIcon("save.gif"));
    savebutton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    save();
    bar.add(savebutton);
    JButton openbutton=new JButton(getMyIcon("open.gif"));
    openbutton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    open();
    bar.add(openbutton);
    bar.addSeparator();
    for(int i=0;i<tools.length;i++){
    JButton button=new JButton();
    button.setAction(tools[i]);
    button.setIcon(getMyIcon(tools[i].getValue(Action.NAME)+".gif"));
    button.setText("");
    bar.add(button);
    if((i==2)||(i==6))bar.addSeparator();
    return bar;
    public void createToolbarActions(){
    bold = new StyledEditorKit.BoldAction();
    bold.putValue(Action.NAME, "Bold");
    italic = new StyledEditorKit.ItalicAction();
    italic.putValue(Action.NAME, "Italic");
    underline = new StyledEditorKit.UnderlineAction();
    underline.putValue(Action.NAME, "Underline");
    more = new MoreColorsAction();
    cut = getActionByName(DefaultEditorKit.cutAction);
    cut.putValue(Action.NAME, "Cut");
    copy = getActionByName(DefaultEditorKit.copyAction);
    copy.putValue(Action.NAME, "Copy");
    paste = getActionByName(DefaultEditorKit.pasteAction);
    paste.putValue(Action.NAME, "Paste");
    alignleft = new StyledEditorKit.AlignmentAction("Left Justify",StyleConstants.ALIGN_LEFT);
    alignright = new StyledEditorKit.AlignmentAction("Right Justify",StyleConstants.ALIGN_RIGHT);
    aligncentre = new StyledEditorKit.AlignmentAction("Align Centre",StyleConstants.ALIGN_CENTER);
    alignjustify = new StyledEditorKit.AlignmentAction("Fully Justify",StyleConstants.ALIGN_JUSTIFIED);
    spellchecker = new StyledEditorKit.AlignmentAction("Spell Checker",StyleConstants.ALIGN_JUSTIFIED);
    tools = new Action[]{  cut, copy, paste, bold, italic, underline, more, alignleft, alignright, aligncentre, alignjustify, spellchecker };
    // helper methods to enable menu creators to get their actions by name
    private void createActionTable(JTextComponent textComponent) {
    actions = new Hashtable();
    Action[] actionsArray = textComponent.getActions();
    for (int i = 0; i < actionsArray.length; i++) {
    Action a = actionsArray[i];
    actions.put(a.getValue(Action.NAME), a);
    private Action getActionByName(String name) {
    return (Action)(actions.get(name));
    //----------------| Custom Actions |--------------------
    class InsertImageAction extends AbstractAction {
    protected SimpleTextEditor parent;
    public InsertImageAction(SimpleTextEditor parent){
    super("Image...");
    this.parent=parent;
    public void actionPerformed(ActionEvent e) {
    int n = parent.picChooser.showOpenDialog(parent);
    if(n==0){
    String filename=picChooser.getSelectedFile().getName();
    File file = new File(picChooser.getCurrentDirectory(),filename);
    Icon pic = new ImageIcon(file.getAbsolutePath());
    textpane.insertIcon(pic);
    SimpleTextEditor.this.repaint();
    class InsertDateAction extends AbstractAction {
    public InsertDateAction(){
    super("Date");
    public void actionPerformed(ActionEvent ble) {
    Calendar c= Calendar.getInstance();
    String[] months= new String[]{"01","02","03","04","05","06","07","08","09","10","11","12"};
    textpane.replaceSelection(c.get(c.DAY_OF_MONTH)+"/"+months[c.get(c.MONTH)]+"/"+c.get(c.YEAR));
    class InsertLineAction extends AbstractAction {
    public InsertLineAction(){
    super("Horizontal line");
    public void actionPerformed(ActionEvent e) {
    Icon pic = new ImageIcon("Images/line.gif");
    textpane.insertIcon(pic);
    class InsertBulletAction extends AbstractAction {
    protected int type;
    protected String filenames[] = new String[]{"square.gif","triangle.gif","circle.gif"};
    public InsertBulletAction(int type,String name){
    super(name);
    this.type=type;
    this.putValue(SMALL_ICON,new ImageIcon("Images/"+filenames[type]));
    public void actionPerformed(ActionEvent e) {
    Icon pic = new ImageIcon("Images/"+filenames[type]);
    textpane.insertIcon(pic);
    textpane.replaceSelection(" ");
    class MoreColorsAction extends AbstractAction {
    public MoreColorsAction(){
    super("More Colors");
    public void actionPerformed(ActionEvent e){
    AttributeSet as = textpane.getCharacterAttributes();
    SimpleAttributeSet sas = new SimpleAttributeSet(as);
    Color newColor = JColorChooser.showDialog(
    SimpleTextEditor.this,
    "C

    Here you go guys:
    Peace!
    import javax.swing.*;
    import javax.swing.Timer;
    import javax.swing.border.BevelBorder;
    import javax.swing.text.*;
    import javax.swing.text.rtf.*;
    import javax.swing.event.*;
    import javax.swing.filechooser.*;
    import javax.swing.undo.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import java.beans.*;
      -------------------| Simple Text Editor example application using Java 1.3 with Swing |--------------
    public class SimpleTextEditor extends JFrame
        private JTextPane textpane;
        private JMenuBar mb;
        private JFileChooser chooser,picChooser;
        private Hashtable actions;
        private JPopupMenu popup;
        private JMenuItem exit, newDoc, save, open, saveAs,print;
        private About ab;
        private StyledEditorKit edkit;
        private RTFEditorKit rtfkit;
        private DefaultStyledDocument doc;
        private MyDocumentListener doclistener;
        private MyUndoableEditListener undolistener;
        //Useful variables
        private String filename = "untitled1.txt",filetype = ".txt";
        private File thisfile;
        protected String FileFormats[],FileDescriptions[],PicFileFormats[],PicFileDescriptions[];
        protected boolean DocumentIsUnedited = true, DocumentIsSaved = false;
        public static int SQUARE = 0,TRIANGLE = 1,CIRCLE = 2;
        public String newline = "\n";
        protected UndoManager undo;
        protected UndoAction undoAction;
        protected RedoAction redoAction;
        // These are the actions used in the menus and on the toolbar
        protected Action bold, italic, underline, alignleft, alignright, aligncentre;
        protected Action spellchecker, alignjustify, more, cut, copy, paste, tools[];
        public SimpleTextEditor()
            super("SimpleTextEditor - untitled1.rtf");
            this.setLocation(200, 200);
            this.setIconImage(getMyIcon("Icon.gif").getImage());
            getContentPane().setLayout(new BorderLayout());
            undo = new UndoManager();
            //Set up the file formats and file choosers etc
            FileFormats = new String[]{".rtf", ".txt", ".java", ".bat"};
            FileDescriptions = new String[]{"Rich Text Format Files", "Text Files", "Java Source Files", "DOS Batch Files"};
            PicFileFormats = new String[]{".gif", ".bmp", ".jpg"};
            PicFileDescriptions = new String[]{"Gif Images", "Bitmap Images", "JPEG Images"};
            chooser = new JFileChooser();
            picChooser = new JFileChooser();
            picChooser.setAccessory(new ImagePreview(picChooser));
            javax.swing.filechooser.FileFilter defaultFilter = new SimpleFilter(FileFormats[0], FileDescriptions[0]);
            javax.swing.filechooser.FileFilter defaultPicFilter = new SimpleFilter(PicFileFormats[0], PicFileDescriptions[0]);
            for (int i = 1; i < FileFormats.length; i++)
                chooser.addChoosableFileFilter(new SimpleFilter(FileFormats, FileDescriptions[i]));
    for (int i = 1; i < PicFileFormats.length; i++)
    picChooser.addChoosableFileFilter(new SimpleFilter(PicFileFormats[i], PicFileDescriptions[i]));
    chooser.setFileFilter(defaultFilter);
    picChooser.setFileFilter(defaultPicFilter);
    File working = new File("C:/Documents");
    if (!working.exists())
    working = new File("C:/MyDocuments");
    if (!working.exists()) working = new File("C:/");
    if (working.exists())
    chooser.setCurrentDirectory(working);
    picChooser.setCurrentDirectory(working);
    // Set up Document object and Editor kits
    doc = new DefaultStyledDocument();
    edkit = new StyledEditorKit();
    rtfkit = new RTFEditorKit();
    // Set up Listener objects
    doclistener = new MyDocumentListener();
    undolistener = new MyUndoableEditListener();
    doc.addDocumentListener(doclistener);
    doc.addUndoableEditListener(undolistener);
    //Set up main GUI content
    textpane = new JTextPane(doc);
    textpane.setPreferredSize(new Dimension(400, 400));
    textpane.setMinimumSize(new Dimension(400, 400));
    JScrollPane scroller = new JScrollPane(textpane);
    scroller.setPreferredSize(new Dimension(400, 400));
    mb = new JMenuBar(); // Create a menu bar
    JMenu File = new JMenu("File");
    JMenu Help = new JMenu("Help");
    //Sort out Actions etc
    createActionTable(textpane);
    createToolbarActions();
    JMenu Style = createStyleMenu();
    undoAction = new UndoAction();
    redoAction = new RedoAction();
    //Create Style, Edit and Format menus + Toolbar
    JMenu Edit = createEditMenu();
    JMenu Format = createFormatMenu();
    JMenu Insert = createInsertMenu();
    JToolBar toolbar = createToolbar();
    getContentPane().add("North", toolbar);
    // set up main menu items with ActionListeners
    newDoc = new JMenuItem("New");
    newDoc.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    newDoc();
    exit = new JMenuItem("Exit");
    exit.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    exit();
    print = new JMenuItem("Print");
    print.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    print();
    save = new JMenuItem("Save");
    save.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    save();
    saveAs = new JMenuItem("Save As...");
    saveAs.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    saveas();
    open = new JMenuItem("Open...");
    open.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    open();
    JMenuItem about = new JMenuItem("About");
    about.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    ab = new About(SimpleTextEditor.this);
    ab.show();
    ab.setLocation(400, 300);
    // Create the popup menu
    popup = createEditMenu().getPopupMenu();
    popup.addSeparator();
    popup.add(createStyleMenu());
    popup.add(createFormatMenu());
    textpane.add(popup);
    // set up Help and File menus
    Help.add(about);
    File.add(newDoc);
    File.add(open);
    File.add(print);
    File.add(save);
    File.add(saveAs);
    File.addSeparator();
    File.add(exit);
    // add the menus to the menubar
    mb.add(File);
    mb.add(Edit);
    mb.add(Format);
    mb.add(Style);
    mb.add(Insert);
    mb.add(Help);
    this.setJMenuBar(mb);
    getContentPane().add("Center", scroller);
    // Add mouse Listener to the textpane for popup events
    textpane.addMouseListener(new MouseAdapter()
    public void mousePressed(MouseEvent e)
    if (e.isPopupTrigger())
    popup.show(textpane, e.getX(), e.getY());
    e.consume();
    public void mouseReleased(MouseEvent e)
    if (e.isPopupTrigger())
    popup.show(textpane, e.getX(), e.getY());
    e.consume();
    //-----------------| Main active methods |------------------
    public void exit()// Main Exit method
    if (DocumentIsUnedited)
    {//Check that document is saved/unedited etc
    dispose();
    setVisible(false);
    System.exit(0);
    else
    switch (showNotSavedDialog("Exit"))
    case JOptionPane.YES_OPTION:
    save();
    exit();
    break;
    case JOptionPane.NO_OPTION:
    DocumentIsUnedited = true;
    exit();
    break;
    case JOptionPane.CANCEL_OPTION:
    break;
    public void newDoc()//Method to create new documents
    if (DocumentIsUnedited)
    initDoc();
    filename = "untitled.txt";
    filetype = ".txt";
    resetTitle();
    else
    switch (showNotSavedDialog("New Document"))
    case JOptionPane.YES_OPTION:
    save();
    newDoc();
    break;
    case JOptionPane.NO_OPTION:
    DocumentIsUnedited = true;
    newDoc();
    break;
    case JOptionPane.CANCEL_OPTION:
    break;
    private void initDoc()// Helper method to initialize a new document
    doc = null;
    doc = (DefaultStyledDocument) edkit.createDefaultDocument();
    doc.addDocumentListener(doclistener);
    textpane.setStyledDocument(doc);
    public void print()
    new TimerTestDialog(this);
    class TimerTestDialog extends JDialog
    TimerTestDialog(Frame parent)
    super(parent);
    setLocationRelativeTo(parent);
    setupDialog();
    setModal(false); // this will allow you to do still stuff with the main frame
    * sorry, using a Timer instead of your original TimerTask - it's simpler
    Timer t = new Timer(2000, ticker);
    t.start();
    private void setupDialog()
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    c.add(getDisplayPanel(), BorderLayout.CENTER);
    c.add(getButtonPanel(), BorderLayout.SOUTH);
    setSize(300, 150);
    setVisible(true);
    private Component getDisplayPanel()
    label = new JLabel("---", JLabel.CENTER);
    label.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    JPanel backing = new JPanel(new BorderLayout());
    backing.add(label, BorderLayout.NORTH); // this will ensure the label doesn't go all tall
    panel.add(backing, BorderLayout.CENTER);
    return panel;
    private Component getButtonPanel()
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    JPanel backing = new JPanel(new BorderLayout());
    JButton closeButton = new JButton("close");
    closeButton.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    dispose();
    backing.add(closeButton, BorderLayout.NORTH);
    panel.add(backing, BorderLayout.EAST);
    return panel;
    private ActionListener ticker = new ActionListener()
    public void actionPerformed(ActionEvent e)
    label.setText(String.valueOf(getRandomNumber()));
    private int getRandomNumber()
    return r.nextInt(10) + 1; // shift from 0-9 to 1-10
    private JLabel label;
    * NOTE - this is the best way to use random stuff in java. if you use instance members
    * you can sometimes get the same result each time. not really sure how that works but
    * i've seen it happen
    private static Random r = new Random();
    public void saveas()
    int n = chooser.showSaveDialog(this);
    if (n == 0)
    filename = chooser.getSelectedFile().getName();
    boolean ext = false;
    setFiletype();
    thisfile = new File(chooser.getCurrentDirectory(), filename);
    DocumentIsSaved = true;
    save();
    resetTitle();
    repaint();
    public void save()// Save method. Used by "Save As..." as well
    if (DocumentIsSaved)
    try
    FileOutputStream out = new FileOutputStream(thisfile);
    if ((filetype.equals(".rtf")) || (filetype.equals(".doc")))
    rtfkit.write(out, doc, 0, doc.getLength());
    else
    edkit.write(out, doc, 0, doc.getLength());
    catch (Exception e)
    System.out.println("" + e.getMessage() + "");
    DocumentIsUnedited = true;
    else
    saveas();
    public void open()// Find a file and read it into the document
    if (DocumentIsUnedited)
    int n = chooser.showOpenDialog(this); // get the outcome of the dialog
    if (n == 0)
    File file = chooser.getSelectedFile();
    filename = chooser.getName(file);
    setFiletype();
    resetTitle();
    initDoc();
    try
    FileInputStream in = new FileInputStream(file);
    if (filetype.equals(".rtf"))
    rtfkit.read(in, doc, 0);
    edkit.read(in, doc, 0);
    catch (Exception e)
    System.out.println("" + e.getMessage() + "");
    thisfile = new File(chooser.getCurrentDirectory(), chooser.getSelectedFile().getName());
    DocumentIsUnedited = true;
    DocumentIsSaved = true;
    resetTitle();
    repaint();
    else
    switch (showNotSavedDialog("Open"))
    case JOptionPane.YES_OPTION:
    save();
    open();
    break;
    case JOptionPane.NO_OPTION:
    DocumentIsUnedited = true;
    open();
    break;
    case JOptionPane.CANCEL_OPTION:
    break;
    private void setFiletype()// Helper method to get the filetype of saved/opened documents
    filetype = null;
    for (int i = 0; i < FileFormats.length; i++)
    if (filename.toLowerCase().endsWith(FileFormats[i]))
    filetype = FileFormats[i];
    else
    for (i = 0; i < filename.length(); i++)
    if (filename.toLowerCase().charAt(i) == '.')
    filetype = filename.substring(i);
    if (filetype == null) filetype = ".txt";
    private void resetTitle()
    this.setTitle("SimpleTextEditor - " + filename);
    private ImageIcon getMyIcon(String filename)
    ImageIcon pic = new ImageIcon("Images/" + filename);
    return pic;
    private int showNotSavedDialog(String title)// Helper method to create "Save? Yes/No/Cancel" dialogs
    int n = JOptionPane.showConfirmDialog(this, "The last document has not been saved. \nDo you want to save it first?",
    title,
    JOptionPane.YES_NO_CANCEL_OPTION,
    JOptionPane.QUESTION_MESSAGE);
    return n;
    //-----------------| Listeners and Helper classes |----------------
    protected class MyDocumentListener implements DocumentListener
    public void insertUpdate(DocumentEvent e)
    SimpleTextEditor.this.DocumentIsUnedited = false;
    public void removeUpdate(DocumentEvent e)
    SimpleTextEditor.this.DocumentIsUnedited = false;
    public void changedUpdate(DocumentEvent e)
    SimpleTextEditor.this.DocumentIsUnedited = false;
    protected class MyUndoableEditListener implements UndoableEditListener
    public void undoableEditHappened(UndoableEditEvent e)
    //Remember the edit and update the menus.
    undo.addEdit(e.getEdit());
    undoAction.updateUndoState();
    redoAction.updateRedoState();
    //Helper class for FileFilter, allows a description to be assigned to a filetype
    protected class SimpleFilter extends javax.swing.filechooser.FileFilter
    String type,des;
    public SimpleFilter(String type, String des)
    this.des = des;
    this.type = type;
    public boolean accept(File f)
    if (f.isDirectory())
    return true;
    else
    if (f.getName().toLowerCase().endsWith(type))
    return true;
    else
    return false;
    public String getDescription()
    return des;
    //------------| Methods to help create menus and toolbar |--------------
    protected JMenu createStyleMenu()
    JMenu menu = new JMenu("Style");
    menu.add(bold);
    menu.add(italic);
    menu.add(underline);
    menu.addSeparator();
    menu.add(new StyledEditorKit.FontSizeAction("12", 12));
    menu.add(new StyledEditorKit.FontSizeAction("14", 14));
    menu.add(new StyledEditorKit.FontSizeAction("18", 18));
    menu.addSeparator();
    menu.add(new StyledEditorKit.FontFamilyAction("Serif", "Serif"));
    menu.add(new StyledEditorKit.FontFamilyAction("SansSerif", "SansSerif"));
    menu.addSeparator();
    Action red = new StyledEditorKit.ForegroundAction("Red", new Color(255, 0, 0));
    red.putValue(Action.SMALL_ICON, getMyIcon("red.gif"));
    menu.add(red);
    Action green = new StyledEditorKit.ForegroundAction("Green", new Color(0, 150, 0));
    green.putValue(Action.SMALL_ICON, getMyIcon("green.gif"));
    menu.add(green);
    Action blue = new StyledEditorKit.ForegroundAction("Blue", new Color(0, 50, 150));
    blue.putValue(Action.SMALL_ICON, getMyIcon("blue.gif"));
    menu.add(blue);
    Action black = new StyledEditorKit.ForegroundAction("Black", new Color(0, 0, 0));
    black.putValue(Action.SMALL_ICON, getMyIcon("black.gif"));
    menu.add(black);
    menu.add(more);
    return menu;
    protected JMenu createEditMenu()
    JMenu menu = new JMenu("Edit");
    menu.add(undoAction);
    menu.add(redoAction);
    menu.addSeparator();
    menu.add(cut);
    menu.add(copy);
    menu.add(paste);
    menu.addSeparator();
    Action selectall = getActionByName(DefaultEditorKit.selectAllAction);
    selectall.putValue(Action.NAME, "Select All");
    menu.add(selectall);
    return menu;
    protected JMenu createFormatMenu()
    JMenu menu = new JMenu("Format");
    menu.add(spellchecker);
    menu.add(alignleft);
    menu.add(alignright);
    menu.add(aligncentre);
    menu.add(alignjustify);
    return menu;
    protected JMenu createInsertMenu()
    JMenu menu = new JMenu("Insert");
    Action insertimage = new InsertImageAction(this);
    menu.add(insertimage);
    Action insertdate = new InsertDateAction();
    menu.add(insertdate);
    Action insertline = new InsertLineAction();
    menu.add(insertline);
    JMenu bullets = new JMenu("Bullet Points");
    bullets.add(new InsertBulletAction(CIRCLE, "Circle"));
    bullets.add(new InsertBulletAction(TRIANGLE, "Triangle"));
    bullets.add(new InsertBulletAction(SQUARE, "Square"));
    menu.add(bullets);
    return menu;
    public JToolBar createToolbar()
    JToolBar bar = new JToolBar();
    JButton newbutton = new JButton(getMyIcon("new.gif"));
    newbutton.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    newDoc();
    bar.add(newbutton);
    JButton savebutton = new JButton(getMyIcon("save.gif"));
    savebutton.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    save();
    bar.add(savebutton);
    JButton openbutton = new JButton(getMyIcon("open.gif"));
    openbutton.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    open();
    bar.add(openbutton);
    bar.addSeparator();
    for (int i = 0; i < tools.length; i++)
    JButton button = new JButton();
    button.setAction(tools[i]);
    button.setIcon(getMyIcon(tools[i].getValue(Action.NAME) + ".gif"));
    button.setText("");
    bar.add(button);
    if ((i == 2) || (i == 6)) bar.addSeparator();
    return bar;
    public void createToolbarActions()
    bold = new StyledEditorKit.BoldAction();
    bold.putValue(Action.NAME, "Bold");
    italic = new StyledEditorKit.ItalicAction();
    italic.putValue(Action.NAME, "Italic");
    underline = new StyledEditorKit.UnderlineAction();
    underline.putValue(Action.NAME, "Underline");
    more = new MoreColorsAction();
    cut = getActionByName(DefaultEditorKit.cutAction);
    cut.putValue(Action.NAME, "Cut");
    copy = getActionByName(DefaultEditorKit.copyAction);
    copy.putValue(Action.NAME, "Copy");
    paste = getActionByName(DefaultEditorKit.pasteAction);
    paste.putValue(Action.NAME, "Paste");
    alignleft = new StyledEditorKit.AlignmentAction("Left Justify", StyleConstants.ALIGN_LEFT);
    alignright = new StyledEditorKit.AlignmentAction("Right Justify", StyleConstants.ALIGN_RIGHT);
    aligncentre = new StyledEditorKit.AlignmentAction("Align Centre", StyleConstants.ALIGN_CENTER);
    alignjustify = new StyledEditorKit.AlignmentAction("Fully Justify", StyleConstants.ALIGN_JUSTIFIED);
    spellchecker = new StyledEditorKit.AlignmentAction("Spell Checker", StyleConstants.ALIGN_JUSTIFIED);
    tools = new Action[]{cut, copy, paste, bold, italic, underline, more, alignleft, alignright, aligncentre, alignjustify, spellchecker};
    // helper methods to enable menu creators to get their actions by name
    private void createActionTable(JTextComponent textComponent)
    actions = new Hashtable();
    Action[] actionsArray = textComponent.getActions();
    for (int i = 0; i < actionsArray.length; i++)
    Action a = actionsArray[i];
    actions.put(a.getValue(Action.NAME), a);
    private Action getActionByName(String name)
    return (Action) (actions.get(name));
    //----------------| Custom Actions |--------------------
    class InsertImageAction extends AbstractAction
    protected SimpleTextEditor parent;
    public InsertImageAction(SimpleTextEditor parent)
    super("Image...");
    this.parent = parent;
    public void actionPerformed(ActionEvent e)
    int n = parent.picChooser.showOpenDialog(parent);
    if (n == 0)
    String filename = picChooser.getSelectedFile().getName();
    File file = new File(picChooser.getCurrentDirectory(), filename);
    Icon pic = new ImageIcon(file.getAbsolutePath());
    textpane.insertIcon(pic);
    SimpleTextEditor.this.repaint();
    class InsertDateAction extends AbstractAction
    public InsertDateAction()
    super("Date");
    public void actionPerformed(ActionEvent ble)
    Calendar c = Calendar.getInstance();
    String[] months = new String[]{"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
    textpane.replaceSelection(c.get(c.DAY_OF_MONTH) + "/" + months[c.get(c.MONTH)] + "/" + c.get(c.YEAR));
    class InsertLineAction extends AbstractAction
    public InsertLineAction()
    super("Horizontal line");
    public void actionPerformed(ActionEvent e)
    Icon pic = new ImageIcon("Images/line.gif");
    textpane.insertIcon(pic);
    class InsertBulletAction extends AbstractAction
    protected int type;
    protected String filenames[] = new String[]{"square.gif", "triangle.gif", "circle.gif"};
    public InsertBulletAction(int type, String name)
    super(name);
    this.type = type;
    this.putValue(SMALL_ICON, new ImageIcon("Images/" + filenames[type]));
    public void actionPerformed(ActionEvent e)
    Icon pic = new ImageIcon("Images/" + filenames[type]);
    textpane.insertIcon(pic);
    textpane.replaceSelection(" ");
    class MoreColorsAction extends AbstractAction
    public MoreColorsAction()
    super("More Colors");
    public void actionPerformed(ActionEvent e)
    AttributeSet as = textpane.getCharacterAttributes();
    SimpleAttributeSet sas = new SimpleAttributeSet(as);
    Color newColor = JColorChooser.showDialog(
    SimpleTextEditor.this,
    "Choose Text Color",
    doc.getForeground(as));
    if (newColor != null)
    StyleConstants.setForeground(sas, newColor);
    textpane.setCharacterAttributes(sas, true);
    SimpleTextEditor.this.repaint();
    class UndoAction extends AbstractAction
    public UndoAction()
    super("Undo");
    setEnabled(false);
    public void actionPerformed(ActionEvent e)
    try
    undo.undo();
    catch (CannotUndoException ex)
    System.out.println("Unable to undo: " + ex);
    ex.printStackTrace();
    updateUndoState();
    redoAction.updateRedoState();
    protected void updateUndoState()
    if (undo.canUndo())
    setEnabled(true);
    putValue(Action.NAME, undo.getUndoPresentationName());
    else
    setEnabled(false);
    putValue(Action.NAME, "Undo");
    class RedoAction extends AbstractAction
    public RedoAction()
    super("Redo");
    setEnabled(false);
    public void actionPerformed(ActionEvent e)
    try
    undo.redo();
    catch (CannotRedoException ex)
    System.out.println("Unable to redo: " + ex);
    ex.printStackTrace();
    updateRedoState();
    undoAction.updateUndoState();
    protected void updateRedoState()
    if (undo.canRedo())
    setEnabled(true);
    putValue(Action.NAME, undo.getRedoPresentationName());
    else
    setEnabled(false);
    putValue(Action.NAME, "Redo");
    //-------------| Very nice Image Previewer 'borrowed' from Sun's Java Tutorial
    class ImagePreview extends JComponent implements PropertyChangeListener
    ImageIcon thumbnail = null;
    File file = null;
    public ImagePreview(JFileChooser fc)
    setPreferredSize(new Dimension(100, 50));
    fc.addPropertyChangeListener(this);
    public void loadImage()
    if (file == null)
    return;
    ImageIcon tmpIcon = new ImageIcon(file.getPath());
    if (tmpIcon.getIconWidth() > 90)
    thumbnail = new ImageIcon(tmpIcon.getImage().getScaledInstance(90, -1,
    Image.SCALE_DEFAULT));
    else
    thumbnail = tmpIcon;

  • Flash movie acts differently on different browsers

    hi
    i have created an online calendar, you can see it on
    this
    link
    this application uses php as well which is called through the
    actionscript
    it works fine on firefox browsers, and some versions of IE,
    the version i have is explorer 7 (which i really dont like), and it
    doesnt work well at all. dont know if it works on safari or other
    browsers, i havent checked it out yet
    (the main problem is trying to write more than one message,
    it isnt displayed on the messageboard on IE)
    does anyone have an idea what the problem could be?
    also if someone sees any problems on different browsers i
    would like to know
    thanks

    "and it doesnt work well at all."
    Is there sometime more specific to describe what is the
    problem?

  • HELP! Please :) my website looks different in different browsers. Link boxes are showing in IE!!

    Please help me!  I'm pretty new to web design.  Built this website from scratch - designed in photoshop and put together in dreamweaver.  I launched the site and it looks great in safari, but had a friend look at it with explorer and the blue link boxes (the one that lets you know you have something linked in dreamweaver) are showing up on the interent explorer browser and I can only assume there are issues in other browsers as well.  Please help if you can.  Here is a link to my website:   www.shandryntrumble.com  Thanks

    Thanks for your help!Should I create an external style sheet?  I'm still unsure of where and what to put in the document.  Where are the CSS  tags?  And what exactly do I place in them?  Sorry, I'm so new to this.  Thanks for your patience.
    Date: Fri, 22 Mar 2013 10:13:43 -0700
    From: [email protected]
    To: [email protected]
    Subject: HELP! Please my website looks different in different browsers. Link boxes are showing in IE!!
        Re: HELP! Please my website looks different in different browsers. Link boxes are showing in IE!!
        created by Nancy O. in Dreamweaver - View the full discussion
    Bad information.  You don't need a class for this.  Simply add the following CSS code to your style sheet.  An external style sheet is preferred but it if you don't have one yet, add this code to the CSS inside the  tags of your HTML document. /*remove borders from all linked images*/a img    Nancy O.
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5170378#5170378
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5170378#5170378
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5170378#5170378. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Dreamweaver by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

Maybe you are looking for

  • How do i install a kodak printer esp5250

    I have recently gone over to Apple from Windows with the purchase of the latest updated Imac 21.5. Have tried to install my Kodak ESP5250 printer to find that it is not supported.  What do it do? Bob

  • Switching between devices on Airplay?

    Hello! I received a new Apple TV for Christmas. I have an iPhone and so does one of my roommates, and another has an iPad. I was wondering if there was an easy way to switch between devices using Airplay on the Apple TV. As of now I've just been powe

  • Play Count / Last Played inconsistencies

    I have a smart playlist that simply shows all music that I've never played. I set this up to simply show music where Plays=0. I've noticed recently that music I know I've listened to is still in the playlist, looking at the screenshot below you can s

  • Photo diaplay in Infotype 0002

    Dear Gurus, We have stored the photos in DMS. Now the user wants to dispaly the photo info type 0002 or in TCode PA20. I got many documents which talks about the archive link. But I am not sure about linking photo stored in DMS with IT0002. Thanks fo

  • Can't update Windows XP SP1 to SP3 via CD to run on Boot Camp partition

    I have just partitioned my Mac HD via Boot Camp - with a 42GB Windows XP partition to run a program not available for Mac. The Windows XP (retail version with license) I purchased came with SP1 "upgradeable to SP3 for free" after purchase. Now the co