Does "changing of fonts" act like a state-machine?

hi all,
in the past...i changed the font of a JComponent one at a time...i'm just wondering if changing fonts in Swing would be something like changing colours in OpenGL...
for example:
setColor(0, 0, 1);
drawRectangle();
drawCircle();
setColor(0, 1, 0);
drawTriangle();
in the above...the rectangle and circle would be drawn with colour(0, 0, 1) but the triangle would be in colour(0, 1, 0)...
how about in Swing GUI...can i specify the font just a line above each time i want the JComponent be in a different font?
and is there a way to specify a font for the entire JPanel and all the JComponents it is containing?
thank you very much!

Well, the setFont() call should probably act in the way you describe, but I find it doesn't always.
Particularly when you're using JMenuBars or applets, I find it important to set the font on each
component individually.
Also, it's pretty easy to set the font on a panel and everything underneath it...
public void setFontRecursive(Container c, Font f) {
    c.setFont(f);
    Component[] children = c.getComponents();
    if (children != null) {
        for (int i=0; i < children.length; i++) {
            if (children[i] instanceof Container) {
                setFontRecursive(children, f);
} else {
children[i].setFont(f);
Bear in mind that this method will work for anything that extends Container (including Panel).
Hope that helps!
Martin Hughes

Similar Messages

  • ReadObjectQuery acts like a gambling machine

    Hi there,
    I figured out that a ReadObjectQuery acts like a gambling machine, when the underlying TopLink expression and SQL statement respectively, selects more than one row. In this case the ReadObjectQuery does not throw an exception and returns some object of the result set.
    How can I force the ReadObjectQuery throwing an exception, if the result set has more than one object?
    Thanks,
    Leif Jakobsmeier

    Leif,
    There is an event on SessionEventListener that will notify you when a ReadObjectQuery returns more then one row.
    http://download-west.oracle.com/docs/cd/B10464_01/web.904/b10491/oracle/toplink/sessions/SessionEventListener.html#moreRowsDetected(oracle.toplink.sessions.SessionEvent)
    You can have your own exception thrown my simply implementing and registering an event listener to handle this.
    Example:
    session.getEventManager().addListener(new SessionEventAdapter() {
         public void moreRowsDetected(SessionEvent event) {
    throw new RuntimeException("More then one row returned from ReadObjectQuery");
    Doug

  • Help! iTunes is making my iMac act like a Windows machine!

    Here is the basic problem:
    Some songs will not play properly in iTunes, pausing often and causing the spinning beach ball of death to freeze my iMac for 5 to 10 minutes at a time, sometimes longer. I am also having problems ripping those songs to a CD.
    I am trying to decide if I should uninstall iTunes or simply back everything up and do a clean install of Snow Leopard and iTunes.
    I’m also wondering if simply getting more RAM would solve my woes. I have 2GB, which worked well for years. I have 4GB coming in the mail.
    I have a 2008 iMac. It has about 175GB of free space on its hard drive, about 144 GB in use. With iTunes playing a file and nothing of particular note open, it has just under 1GB of free system memory, or RAM. I have both the latest version of Snow Leopard and iTunes installed. All software is up to date. Except, of course, that I'm not running Lion.
    I have a 45GB in music and 54GB in podcasts in my iTunes library.
    I have corrected my hard drive’s permissions repeatedly but am unaware of any other maintenance I should be doing on my hard drive.
    Here are some observations that may or may not be helpful:
    Songs in the same folder are behaving differently, some consistently playing without a problem, others consistently spinning the beach ball.  For example, five songs off an album will freeze up my iMac but the album’s other songs do not.
    I can, however, duplicate the symptoms with otherwise dependable songs by having more applications open. Nothing major, say Safari, Finder and iTunes. What I don’t get is why some songs would play well and others not when only iTunes is open.
    Having a handful of applications open now sometimes prompts the spinning beach ball of death. This never used to happen, hence the RAM coming in the mail.
    When I check information on the malfunctioning music files, it shows they contain data, but I start getting the beach ball checking  the file’s “sharing & permissions” status in "Get Info."
    Interestingly, I recently had to stop backing up my podcasts in Time Machine because some of them were crashing it. My music files, however, have been backing up fine in Time Machine, so far.
    Also, when I try to copy my music files onto an external drive or my desk top – in anticipation of reinstalling iTunes -- my iMac cites error 36 and stops the process.
    My iMac’s performace problems started to occur before I finally updated to Snow Leopard a few months ago. Indeed, I thought updating would solve them.
    I had been regularly updating iTunes, however, I recall reading somewhere that upgrading to Snow Leopard while having an up-to-date iTunes installed might cause problems.
    There you have it. Any advice or insights would he most welcome.

    Well, I seem to have solved my own problem. Do I get 10 points, I wonder? It appears that my poor iMac was in desperate need of a masssive cleaning. Thanks to other posts here and elsewhere, I found out about Cocktail, a free download -- unless you chip in for the more advanced version. This is a powerful and easy to understand tool. I used it to perk my iMac up to a level I have not seen in a LONG time. The spinning beach ball of death must go play elsewhere.  Among other things, I cleared out all my caches, eliminated a ton of foreign languages and did several repairs, including tracking down and killing a corrupted permission. It also taught me how to tap into my computer's activity logs and gave me other useful insights. GOOD stuff. I did other things not related to Cocktail to free up processing power -- such as turning off file- size view option in Finder -- but Cocktail is what solved this problem. As I type this, I am happily listening to songs that earlier would not play. What a relief. I am now especially looking forward to that new RAM. We'll be blazing fast then, by gum.

  • CS6 it is being hanged attempting to change the font property

    Hi,
    I am working on Flash CS 6 is working fine but one issue i am facing all the time while working on any file whenever i am attempting to change the font property (like from arial or verdana etc.) it is being hanged for few moments like 1 to 2 minutes.
    Can help in solving this issue.

    You're at the point where you've done every other rational thing to solve the issue. If you have no issue using font drop-downs in any other Adobe or any other app and have reset Flash to defaults, have no font manager or any corrupt settings, I'm out of suggestiong.
    Since Flash is basically back to default install status, that's the last recommendation I could make. If you reinstall Flash and you still have the issue, this is something Adobe support may need to jump in on. There has to be a difference between your environment and everyone elses, only you know what that is. If a fresh install of Flash doesn't work, there's an environment issue.
    Are you using an encrypted filesystem or have you manually copied any web fonts into your Windows font directory (where typically they're colored green) and have not clicked 'Unblock' on the file? Windows can sometimes mark downloaded files as dangerous until you view the file properties and click to 'Unblock' it. It's down to this level of "some small thing" that's causing this odd hiccup for Flash.

  • Finite state machine using jsf ?

    I am building an online payment module and would like to implement it using a finite state machine. I am hoping that someone may give us advice on how to build it with jsf.
    Firstly, I am just beginning with jsf.
    Here is the example: Let's say that in the module there are 7 possible states that the user may be in, each represented by a jsp. I cannot decide where to manage state transitions. One option is to change states in the backer bean of every state, but that is dispersing transition logic across all my backer beans. The other option I can see is to have one single actionListener and have all action events pass through the 'processAction' method, keeping all the state management logic in one place.
    Please comment on either of these two approaches...or any alternatives :)
    Thanks in advance !
    Mark

    Sounds like a state machine in combination with a decorator on the ViewHandler might do the trick.
    Off the top of my head I'd suggest creating a managed bean in session scope that keeps track of the state in the user's session (the state machine). Check the bean from the ViewHandler decorator when a page is requested and direct the user to the correct page if they are trying to navigate to a page that conflicts with what is allowed for their current state.
    Your actionlisteners or action methods could change the user's state in the session as they process their actions.
    http://forum.java.sun.com/thread.jsp?forum=427&thread=502322
    The above thread discusses the use of a decorator to control navigation for authentication purposes, but it should be adaptable to this use.
    Is that plausable or am I smoking crack? :-)
    -jeff howard

  • Need help setting up a Finite State Machine in BlueJ

    Hey all, I joined these forums to hopefully help me catch up with my Java skills. I haven't programmed in Java for almost a year, and the class I'm in now does little for review so I'm rusty to say the least. The assignment we were given recently is to create a Finite State Machine resembling a gumball machine. This are basically the requirements given:
    The operation of the gumball machine is simple. It takes a quarter to get a gumball dispensed. The customer needs to deposit a quarter and turn the crank, and a gumball will be dispensed if the machine contains one or more gumballs.
    Design steps:
    There are a number of states: No_Quarter, Has_Quarter, Gumball_Sold, Out_of_Gumballs
    Create an instance variable to hold the current state and define values for each of the states.
    All the actions that can happen in the system are: insert_quarter, ejects_quarter, turns_crank, dispense_gumball, and refill_gumballs. The action dispense_gumball is an internal action the machine invokes when it reaches the Gumball_Sold state.
    Create a class that acts as the state machine. For each action, create a method that uses conditional statements to determine what behavior is appropriate in each state.
    Write a test program to test the GumballMachine class. You consider not just normal operations i.e. insert a quarter, turn the crank; but also operations such as insert a quarter, eject the quarter, turn the crank. Or what if you turn the crank twice after insert one quarter. Or what if you insert two quarters in a row.
    Now trust me, I'm not asking for someone to come here with a hunk of code and say, ok use this, and it's done. What I'm here for is hopefully someone can walk me through the right thought process of how to implement the states, and where/how to include the actions to go along with the states. We're to use BlueJ to write the code, and I'm still pretty unfamiliar with its arrow system that tells Test Programs to use the linked class(es).
    Thanks for any help in advance, and for what it's worth, speedy responses are especially appreciated!

    Did you upload everything to your server?  Did you perform the compatibility check?
    FormCaptcha’s requirements:
    PHP 4.0 or later.
    GD Library for PHP, version 2.0 or greater (it's installed on most web servers but it may not be enabled).
    The page that processes the form must have .PHP extension.
    Tip: If you want to be sure that your web server supports this captcha tool, then you can download and test our free captcha compatibility check. This is a script that checks if your web server can generate captcha images and perform the captcha validation.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/

  • Use event to jump to a case in a state machine

    How would I use an event to force a jump to a certain case in a state machine? For example, in the attached VI, I have a state machine that will simply blink a green LED indicator on and off for five seconds. I have a case in which the LED turns red for five seconds and a button which I would like to use to jump to this case. In other words, if the state machine is currently halfway (2.5 seconds) through my "Green_Light_ON" case when the button is pressed, I would like the state machine to immediately jump out of the "Green_Light_ON" case and into the "Red_Light_ON" case. This is not my ACTUAL VI, but it's a simplified example that will work for finding my solution. Thank you very much in advance for your help! 
    Attachments:
    DemoStateMachine.zip ‏18 KB

    Sounds like the classic "Producer-Consumer (Events)" design pattern.  File>>New...>>VI from template.  There is a good shipping example as well as the comments on the template vi
    Jeff

  • How do I change the fonts on the main page.My fonts have recently changed without my doing anything. They are like 6 point instead of the 12 I am used to. Email font is now huge. Is this an ATT/Yahoo problem or Firefox. Safari fonts seem to be o.k.

    How do I change the fonts on the home page? They recently shrank from 12 to very tiny..(6 pt?). I did nothing to change them, but after the event tried to change them using "preferences-Fonts"which had no effect. ATT seems to have made a change in their email. The fonts in the email are now huge (18 pt?). This could be an ATT/Yahoo problem with Mac, although Safari seems to be working o. k.

    Jim, extensions are also add-ons. Add-ons include extensions, themes and plugins.
    Whenever you have a problem with Firefox, whatever it is, you need to make sure it's not coming from one of your installed add-ons, be it an extension, a theme or a plugin. To do that easily and cleanly, run Firefox in [http://support.mozilla.com/en-US/kb/Safe+Mode safe mode] and select ''Disable all add-ons''. If the problem disappears, you know it's from an add-on. Disable them all in normal mode, and enable them one at a time until you find the source of the problem. See [http://support.mozilla.com/en-US/kb/Troubleshooting+extensions+and+themes this article] for information about troubleshooting extensions and theme. You can troubleshoot plugins the same way.
    If you want support for one of your add-ons, you'll need to contact its author.

  • How does one change the font size for folders and/or file lists in the Bookmarks Library?

    How does one change the font size for folders and/or file lists in the '''Bookmarks''' Library?
    Since the upgrade to version 9.0.1 of Firefox, the Bookmarks feature changes are confusing me. They seem to be confusing themselves as well. The list of bookmarks has changed. The font size is so small that my aging eyes cannot read it without fogging the screen with my breath. Some folders are out of alphabetical order (where I know they were previously good), and some are missing altogether (folders to which I frequently add references).
    As for missing or deranged files or folders, was there something that I should have done or now need to do to recover those after the upgrade (or before)?
    With regard to font size,
    1. there is no “Edit Bookmarks” or like option to edit the list in this version
    2. the “zoom” option in the “view” list of functions is greyed out when in “Show All Bookmarks” window
    3. expanding the browser window has no effect on font size
    4. “Preferences” settings for font size has no effect in that window either, including advanced settings
    5. “Help” offers none that I can find.
    Can any of you Help?!?

    Maybe this extension helps:
    *Theme Font & Size Changer: https://addons.mozilla.org/firefox/addon/theme-font-size-changer/

  • I cannot change the font; the Content panel in Options does not have a font setting

    I would like to change the font in my Firefox browser. The help instructions tell me to got to 'Tools,' 'Options,' and then open the 'Content' panel. However, when I do so there is nothing in the Content panel that allows me to change fonts.

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • Changing the font size does not work with Textarea with HTML Editor

    If you change the font size in the text area of a "Textarea with HTML Editor" item it does not work. I've searched the forum and the only solution I've seen is to use an HTML editor foriegn to APEX. Does anyone have a better solution? Thanks, Elizabeth

    I'm having a similar issue except with HTML Editor Standard.
    What I'm doing is allow someone to write to an HTML Editor Standard field and then an HTML marked up text is saved to a db CLOB column. In another page, I reference this DB column and show it in an HTML Region (I do a computation Before Regions for a hidden item that writes out the html with "htp.p")
    Everything shows up fine EXCEPT the font tags and headings. I'm finding that the HTML Region sets the font size only with the < d i v s t y l e="font-size: large" >and NOT < f o n t size:6 >. When the HTML Editor renders the user's text input, any size changes are made with the < f o n t > tag, which is depreciated anyways, and not with "style". That's why the size is not showing up.
    I can't really figure out why the headings aren't showing up except maybe the css style in the region is overridding it...
    Is there another APEX item type like HTML Editor (which uses FCKEditor) that I can use, or maybe another approach to remedy this issue? Or maybe this post calls for an enhancement with the HTML Editor?{size}{size}
    </div>
    Edited by: maui26 on Mar 4, 2009 10:43 AM

  • Does iCloud Make Pop Mail Act like IMAP?

    I have basically 1 main question, but 2 different scenarios I'm dealing with - one personally for my mail and the other for my boss.
    Though a longtime Mac user, I am new to using Mountain Lion, iPhone, iPad and iCloud and historically I have always had numerous email accounts in Mac Mail set up as POP and countless elaborate folders that I file and keep all my old emails in for reference.
    When buying my new iMac with ML, the one thing I have not yet done is turn on iCloud for mail.
    If I am understanding how this works (before I do it and create a nightmare of duplication on my iPhone & iPad, etc), if I continue to create my email accounts as POP on my new ML iMac, with their various folders, etc., and turn on iCloud for mail, will it simply reflect on my other devices all the same email accounts and folders and in essence act like an IMAP account in that if you move or delete a piece of mail on one device it will do so on all the devices?
    I not only need to sort this on my computer, but my boss'.  She currently only uses gmail and has all these same devices but they are set up as IMAP and iCloud is turned on and she has mass duplication that is unbearable.
    I am thinking it would be best for me to make her gmail account set up as a POP account and keep iCloud turned on and it will basically eliminate the gmail replication but still allow her devices to all be in sync and have action on one device be seen on all the others.
    This would allow me to create folders for her on her computer in Mac Mail and not use the folder system in gmail at all.
    Am I understanding this correctly?  Hope I'm making sense!
    Thanks so much!

    Hi Glenn:
    Thanks for your response.  I do understand what IMAP does, and I do purposely want all my emails POP so they are downloaded as localized on my computer.
    But where the confusion is for me is iCloud.
    There is "iCloud mail" which I DO NOT WANT.  I don't need yet another mail account.
    I mean "turning on" iCloud for your existing mail.  The way you can turn it on for Calendar, Contacts etc. in Systme Preferences>iCloud> check Mail.  Right now I do not have this checked on my iMac and I actually set up only one of my email accounts on my iPhone as a POP.
    I was hoping that if I organize my email POP accounts the way I want on my iMac and file the various emails into whatever folders, that if I "turned on" iCloud, that it would reflect the same on my phone.  If not, I will not add these accounts to my phone, as I don't want all that on my phone. 
    I like being able to glance at an email on the phone if I'm in town and be able to delete it, but still know its waiting for me to actually deal with and/or file when I get back to my main computer.
    I monitor over 100 email accounts, some mine, but many for business clients and this is why I don't want my phone clogged with all this.  But if turning on iCloud would mimic my iMac mail, then I could just file the emails on the Mac and know they are there in the phone (and I wouldn't delete them on the phone, as it would delete them on the Imac).  Hope this is making sense!
    In my boss' case, she has the reverse issue.
    Someone in the UK set up her iPad, iPhone and laptop with Gmail - her only email account.
    It is IMAP.  They also turned on iCloud (not @icloud mail) and what she has is not only the duplicates caused by Gmail IMAP settings (which you have to remove in Gmail Settings so you don't have the dual Inbox and Gmail "All Mail" inbox on your devices, but to make things more complex for her, she has a Portuguese iPhone and a US iPhone (rather than just swapping SIM cards).
    What I hear all day long is "why do I have all these duplicate emails"  "where did everything go I was just looking at?"  yadda yadda yadda.
    She has her Inbox which has 2000 unread emails sitting in it and her "All Mail" with even more.  Its a mess I want to clean up but don't want to do the wrong thing without fully understanding here what would happen.
    I was hoping that "turning on" iCloud for your MacMail would actually reflect on your devices the same folders and accounts, in which case I could change her Gmail to a POP account and make folders for her and simply have them reflected on her devices once.
    But is turning on iCloud in Syst. Pref for Mail doesn't do that, it won't work.
    Thanks!!!!

  • When I convert my pdf doc to word, the fonts go really weird and it also puts some text into boxes. when I try to select the test and change the font, it does not change it properly?

    When I convert my pdf doc to word, the fonts go really weird and it also puts some text into boxes. when I try to select the text and change the font, it does not change it properly? This is making it impossible to amend.

    Hi Janedance1,
    If the PDF that you converted already has searchable text, please try disabling OCR as described in this document: How to disable Optical Character Recognition (OCR) when converting PDF to Word or Excel. (If the PDF was created from a scanned document and doesn't already have searchable text, disabling OCR isn't a great option, as the text won't be searchable/editable in the converted Word doc.)
    Please let us know how it goes.
    Best,
    Sara

  • Photos does not support external editing like iPhoto. Is there likely to be an upgrade to change this or will I abandon Photos for software that does support editing in Photoshop?

    Photos does not support external editing like iPhoto. Is there likely to be an upgrade to change this or will I abandon Photos for software that does support editing in Photoshop?

    iPhoto does work and there is an upgrade:
    Go to the App Store and check out the Purchases List. If iPhoto is there then it will be v9.6.1
    If it is there, then drag your existing iPhoto app (not the library, just the app) to the trash
    Install the App from the App Store.
    Sometimes iPhoto is not visible on the Purchases List. it may be hidden. See this article for details on how to unhide it.
    http://support.apple.com/kb/HT4928
    One question often asked: Will I lose my Photos if I reinstall?
    iPhoto the application and the iPhoto Library are two different parts of the iPhoto programme. So, reinstalling the app should not affect the Library. BUT you should always have a back up before doing this kind of work. Always.

  • How do I change the font size and color in a text box in Adobe Acrobat 9 Pro (ctrl e does not work)?

    I need to mark up scanned pdf documents with text box comments. I can insert the text box and type text but I cannot change the font or color. When I press Crtl E, no tool bar appears in the menu bar. What does appear in the menu bar is "No current selection". Please advise.

    I am already doing that: creating the text box, typing the text, selecting the text i.e. highlighting the text. This morning, for a scant minute, the properties tool bar appeared and I was able to refine the text in a text box. Then it disappeared never to be activated again this morning.
    I work half of my weekly hours at this client office and I only have this problem on their pc and adobe software (version 9 pro). When I am home, my laptop and the adobe software (version 10 pro) is fine. I can create the text boxes and refine the format at will with no issues. Could it be a software version and/or update issue? Thanks for any assistance.

Maybe you are looking for

  • HT1338 how do i get mac app store

    the app store aint in my apple botton inthe top left coner

  • Problem in copying a mapping from OMB+..soln needed asap

    I am trying to copy a mapping from OMB+. This is a simple copy in the same module....but its giving the following error. can somebody help me in this... OMB+> OMBCOPY MAPPING 'M_STG_BP_AP_INTL_SUBSCRIPTION' TO 'BI_STAGING/' USE REPLACE_MODE OMB01059:

  • How to include PL/SQL routines in a script

    I have some procedures in PL/SQL scripts (as libraries) and I need to use it in some other scripts. So I want to "include" the first ones in the seconds. Anything works ... PS : I use TOAD to update my database. Thanks for your help

  • CSM TCL script or http checksum

    Hello, I need to do some HTTP keepalive based on the http page itself (no error code returned by the server). With the CSS we were able to do it because the css was doing a checksum of the http page. So when there was changes the service was consider

  • Layers Workflow Dilema

    How do i switch from an adjustment layer to a new layer ( Layer>New>Layer). Example: When i go from, say a curves adjustment layer to a new transparent layer to run a High Pass Filter. It comes up 'Unable as no pixels are selected'. The only way I kn