Is there any easy & simple way to set specify font to all text

Is there any way to set a specific font to all text of Swing controls (JLabel, JButton, etc)? And their font's style (bold, underscore...) and font's size still remain to their customized settings.
Thanks in advance.
null

perhaps you're just after deriveFont()
run this, you'll see both fonts the same
import javax.swing.*;
import java.awt.*;
class Testing
  public void buildGUI()
    JLabel label_1 = new JLabel("Hello");
    JLabel label_2 = new JLabel("World");
    label_1.setFont(new Font("monospaced",Font.BOLD|Font.ITALIC,12));
    label_2.setFont(label_1.getFont());
    //label_1.setFont(label_1.getFont().deriveFont(36f));//<----------
    JFrame f = new JFrame();
    f.getContentPane().add(label_1,BorderLayout.NORTH);
    f.getContentPane().add(label_2,BorderLayout.SOUTH);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
  public static void main(String[] args)
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        new Testing().buildGUI();
}now uncomment the indicated line, recompile/rerun
you'll see the style remains, but the size increased

Similar Messages

  • Output_link is there any easier (shorter) way??

    Is there any easier (shorter) way to create an simple link as the code below? I am wondering that the code for creating an simple link moved from one line
    <h:command_hyperlink href="login.jsp" label="Login Page"/>
    To 4 lines:
    <h:output_link value="login.jsf">
    <f:verbatim>Login Page</f:verbatim>
    </h:output_link>

    AFAIK, there's not an easier way in the beta. I'll pass this on to the rest of the EG.
    Regards,
    Adam Winer (EG member)

  • Is there a way to change the font of all text in all layers all at the same time in

    I'm wondering if there is a way to change the font of all text in all layers all at the same time in Illustrator CS5.

    From the menu...... Type > Find Font

  • Is there an easier/simpler way of obtaining this result ?

    Good morning (afternoon to you, BluShadow),
    I obtained the following correct, as desired, output (derived from the EMP table):
    D10     D20     D30     PREZ    MGRS    ANALS   SALESM  CLERKS
    CLARK   JONES   WARD    KING    BLAKE   FORD    ALLEN   ADAMS
    KING    FORD    TURNER          CLARK   SCOTT   MARTIN  JAMES
    MILLER  ADAMS   ALLEN           JONES           TURNER  MILLER
            SMITH   JAMES                           WARD    SMITH
            SCOTT   BLAKE
                    MARTINusing the following query:
    with
       -- pivoted departments  (haven't studied the Oracle PIVOT clause yet)
       depts as
        select max(case deptno
                     when 10 then ename
                   end)                                 as d10,
               max(case deptno
                     when 20 then ename
                   end)                                 as d20,
               max(case deptno
                     when 30 then ename
                   end)                                 as d30,
               rnd
          from (
                select deptno,
                       ename,
                       row_number() over (partition by deptno
                                              order by deptno)  rnd
                  from emp
         group by rnd
         order by rnd
       -- pivoted jobs
       jobs as
        select max(case job
                     when 'CLERK'         then ename
                   end)                                 as Clerks,
               max(case job
                     when 'PRESIDENT'     then ename
                   end)                                 as Prez,
               max(case job
                     when 'MANAGER'       then ename
                   end)                                 as Mgrs,
               max(case job
                     when 'ANALYST'       then ename
                   end)                                 as Anals,
               max(case job
                     when 'SALESMAN'      then ename
                   end)                                 as SalesM,
               rnj
          from (
                select job,
                       ename,
                       row_number() over (partition by job
                                              order by ename)   as rnj
                  from emp
         group by rnj
         order by rnj
    select d10,
           d20,
           d30,
           Prez,
           Mgrs,
           Anals,
           SalesM,
           Clerks
      from depts a full outer join jobs b
                                on a.rnd = b.rnj
    order by rnj, rnd;which takes a total of 5 selects to get there.
    I was trying to find a query that would be, hopefully simpler, easier and didn't require as many selects. My last attempt is the following (which is close to the desired result but doesn't get a cigar yet):
    select case deptno
             when 10 then ename
           end                                 as d10,
           case deptno
             when 20 then ename
           end                                 as d20,
           case deptno
             when 30 then ename
           end                                 as d30,
           case job
             when 'CLERK'         then ename
           end                                 as Clerks,
           case job
             when 'PRESIDENT'     then ename
           end                                 as Prez,
           case job
             when 'MANAGER'       then ename
           end                                 as Mgrs,
           case job
             when 'ANALYST'       then ename
           end                                 as Anals,
           case job
             when 'SALESMAN'      then ename
           end                                 as SalesM,
           row_number() over (partition by deptno
                                  order by deptno)  as rnd,
           row_number() over (partition by job
                                  order by ename)   as rnj
      from emp
    order by rnj;The above query gets me to this result which is encouraging but... short of the mark:
    D10     D20     D30     CLERKS  PREZ    MGRS    ANALS   SALESM   RND  RNJ
                    ALLEN                                   ALLEN      3    1
            ADAMS           ADAMS                                      2    1
                    BLAKE                   BLAKE                      6    1
    KING                            KING                               2    1
            FORD                                    FORD               1    1
            SCOTT                                   SCOTT              5    2
                    JAMES   JAMES                                      5    2
    CLARK                                   CLARK                      3    2
                    MARTIN                                  MARTIN     2    2
                    TURNER                                  TURNER     1    3
    MILLER                  MILLER                                     1    3
    D10     D20     D30     CLERKS  PREZ    MGRS    ANALS   SALESM   RND  RNJ
            JONES                           JONES                      3    3
                    WARD                                    WARD       4    4
            SMITH           SMITH                                      4    4It uses only one SELECT statement and has all the data that needs to be displayed but, I cannot find a way of eliminating the nulls without losing either some jobs or some depts.
    Your help is welcome and appreciated,
    John.
    PS: I'll be perfectly happy learning that there is no easier/simpler way. In other words, if the answer is simply "No, there is no simpler/easier way", please do let me know that is the case. (I ask that you be fairly sure of that though, thank you)
    Edited by: 440bx - 11gR2 on Jul 25, 2010 7:19 AM - Added PS.

    Hi, John,
    You had part of the solution in each of your attempts.
    Do a FULL OUTER JOIN, as in your first query, on two copies of the result set of your second query.
    Using Oracle 9 features only:
    WITH     got_row_numbers     AS
         select     case WHEN deptno = 10 then ename end               as d10,
                     case WHEN deptno = 20 then ename end                    as d20,
                     case WHEN deptno = 30 then ename end                    as d30,
                     case WHEN job = 'CLERK'     then ename       end        as Clerks,
                     case WHEN job = 'PRESIDENT' then ename       end        as Prez,
                     case WHEN job = 'MANAGER'   then ename       end        as Mgrs,
                     case WHEN job = 'ANALYST'   then ename       end        as Anals,
                     case WHEN job = 'SALESMAN'  then ename       end        as SalesM,
                     row_number () over ( partition by      deptno
                                            order by           NULL
                           )                           as rnd,
                     row_number () over ( partition by      job
                                            order by           ename
                           )                            as rnj
      from      emp
    SELECT       MIN (d.d10)          AS d10
    ,        MIN (d.d20)          AS d20
    ,       MIN (d.d30)          AS d30
    ,       MIN (j.clerks)     AS clerks
    ,       MIN (j.prez)          AS prez
    ,       MIN (j.mgrs)          AS mgrs
    ,       MIN (j.anals)          AS anals
    -- ,        MIN (j.salesm)     AS salesm
    FROM            got_row_numbers     d
    FULL OUTER JOIN     got_row_numbers     j     ON     d.rnd     = j.rnj
    GROUP BY  NVL (d.rnd, j.rnj)
    ORDER BY  NVL (d.rnd, j.rnj)
    ;I've been trying to think of a good name for this kind of query where the items one the n-th row have nothing in common except that they are on the n-th row. For lack of anything better, I call it a Prix Fixe Query , because it resembles the menus where, for a fixed price, yuu can choose different options for each course:
    Appetizer     Soup          Main Course     Desert
    Pakora          Coconut          Aloo Gobi     Galabjamun
    Salad          Lentil          Bharta          Halwa
    Samosa                    Dhosa          Kulfi
                        Saag PaneerAbove, each column is sorted alphabeticlly. There is nothing but pure coincidence linking 'Pakora' with 'Coconut' or "Aloo Ghobi' with 'Galabjamun': they just happen the be the first items, in alphabetic order, in their respective columns.
    You may notice that I used
    "PARTITION BY deptno ORDER BY NULL " where you used
    "PARTITION BY deptno ORDER BY deptno "
    It never makes sense to ORDER BY anything in the PARTITION BY list. Each distinct item in the PARTITION BY list is a world of its own. You will only sort things that are identical with respect to the PARTITION BY list. That is, if the system has to decide whether to give 'CLARK' or 'KING' the lower ROW_NUMBER in deptno=10, deptno itself will not help the decision: the deptno for both will necessarily be the same. There's no syntax error, it just doesn't do any good, and the order of the output will be arbitrary.
    There would be a syntax error if you omitted the ORDER BY clause: ROW_NUMBER must be done in the context of some ordering. If you really want the order to be arbitrary, then be clear about it. ORDER BY a constant (such as NULL) so that nobody reading the query quickly is fooled into thinking you really are ordering by something. (A comment would be helpful in that case, also.)
    You probably want to "ORDER BY ename", or something meaningful, in this case.
    Edited by: Frank Kulash on Jul 25, 2010 2:41 PM
    Added digression of "PARTITION BY x ORDER BY x"

  • Is there a simple way to set the homepage for all users?

    We are in a high school environment with 500 plus computers and would like to set the school newspaper website as the default homepage for all users of all computers.

    Use a mozilla.cfg file in the Firefox program folder to lock prefs or specify default values.
    Place a file local-settings.js in the defaults\pref folder where you also find the file channel-prefs.js to specify using mozilla.cfg.
    pref("general.config.filename", "mozilla.cfg");
    pref("general.config.obscure_value", 0); // use this to disable the byte-shift
    See:
    * http://kb.mozillazine.org/Locking_preferences
    You can use these functions in mozilla.cfg:
    defaultPref(); // set new default value
    pref(); // set pref, but allow changes in current session
    lockPref(); // lock pref, disallow changes

  • Syncing an iPhone 4s with a Droid razr M - is there any relatively simple way to do this?

    My wife has a 4s and our computer is a MacBook Pro.  Is it possible for me to have an Android phone (the new Razr M) and to somehow have it be compatible with those Aplle devices in our household?  I like the 4s, but am concerned its technology won't be able to keep up with the changes that are likely to occur before the end of my next 2 year Verizon contract.
    So, should I get a Razr M and try to make it compatible or should I just get a 4s?  (BTW - an iPhone 5 isn't in our budget right now)
    Thanks.

    Only your service provider can unlock the phone. Check with the provided.

  • Is there any easier way to edit imovie files that have been exported as mov file then added to FCE 4?? As every move I make has to be rendered and takes forever??? Also my recording is going out of focus without me touching the camera, why has this happen

    Is there any easier way to edit imovie files that have been exported as mov file then added to FCE 4?? As every move I make has to be rendered and takes forever??? Also my recording is going out of focus without me touching the camera, why has this happened any idea what causes this??
    iMovie '08, Mac OS X (10.5.8), FCE 4

    My daughter has had her Razr for about 9 months now.  About two weeks ago she picked up her phone in the morning on her way to school when she noticed two cracks, both starting at the camera lens. One goes completely to the bottom and the other goes sharply to the side. She has never dropped it and me and my husband went over it with a fine tooth comb. We looked under a magnifying glass and could no find any reason for the glass to crack. Not one ding, scratch or bang. Our daughter really takes good care of her stuff, but we still wanted to make sure before we sent it in for repairs. Well we did and we got a reply from Motorola with a picture of the cracks saying this was customer abuse and that it is not covered under warranty. Even though they did not find any physical damage to back it up. Well I e-mailed them back and told them I did a little research and found pages of people having the same problems. Well I did not hear from them until I received a notice from Fed Ex that they were sending the phone back. NOT FIXED!!! I went to look up why and guess what there is no case open any more for the phone. It has been wiped clean. I put in the RMA # it comes back not found, I put in the ID #, the SN# and all comes back not found. Yet a day earlier all the info was there. I know there is a lot more people like me and all of you, but they just don't want to be bothered so they pay to have it fix, just to have it do it again. Unless they have found the problem and only fixing it on a customer pay only set up. I am furious and will not be recommending this phone to anyone. And to think I was considering this phone for my next up grade! NOT!!!!

  • Is there any easy way to send free invoice via email without my credit info

    Is there any easy way to send free invoice via email without my credit info?

    Depends upon what you mean by 'it failed'. If it's that you are getting a message to contact iTunes Support then no, you will have to contact them (the 48 hours should be the maximum time that it takes for them to reply).

  • Is there any (easy) way to use Pages to edit documents imported via iFiles?

    Is there any (easy) way to use Pages to edit documents imported via iFiles?

    That is a question better answered by the developer:
    http://www.ifilesapp.com/
    Peter

  • Is there any easy way to compare LIKE Addresses from one table, which contains 3rd party data, to another table, our database source

    We have a 3rd party that is supplying us data and we need to compare the addressing between the 3rd party data to our source database addressing. I'd like to make it somewhat flexible meaning I'd like to somehow use the LIKE comparison rather than comparing
    the exact address values. (I have noticed that the 3rd party addressing sometime has a leading <space> at the beginning of the address...why I'd prefer to use LIKE)
    Is there any easy way to do this? Or does this dictate using a CURSOR and processing through the CURSOR of 3rd party data and plugging in the address LIKE as dynamic SQL?
    Please let me know your thoughts on this and I appreciate your review and am hopeful for a reply.

    Yes, it's possible and there are a variety of options but it's may not be for the faint of heart.
    The last time I did it, I ended up taking several passes at the data.
    1st pass was a straight up comparison with no modifications or functions.
    2nd pass was the same but with all special characters removed.
    3rd pass involved splitting the numeric portion of address and comparing just the street numbers and used a double meta-phone function (kind of like a soundex on steroids) to compare the street names.
    Jason Long

  • I am receiving excel files, which I need to convert with my macbook pro...I did this with export, but the file I got didnt show graphs as it should...can you help...do I need to buy excel for Apple computer, or is there any easier way of dealing with it..

    I am receiving excel files, which I need to convert with my macbook pro...I did this with export, but the file I got didnt show graphs as it should...can you help...do I need to buy excel for Apple computer, or is there any easier way of dealing with it..does App  "Numbers" help here?

    Numbers should be able to read Excel files without any problems.    If Numbers does not read the graphics properly then you can try Excel Online. https://office.live.com/start/Excel.aspx

  • I allocated too much space on the Windows side when using bootcamp and want to take some space back for the Mac side is there any easy way to do this?

    I allocated too much space on the Windows side when using bootcamp and want to take some space back for the Mac side is there any easy way to do this?

    Purchase and use Paragon Camp Tune

  • How do I sync music onto old iPod when my music is on iTunes match? I have connected the iPod to my mac but it indicates no music to sink (as my music is in the cloud). I assume there is a simple way to resolve without downloading all music onto my mac?

    How do I sync my music onto an old iPod when my music is located on iTunes match? I have connected the iPod to my mac but it indicates no music to sink (as my music is stored in the cloud). I assume there is a simple way to resolve without downloading all music onto my mac as this would be ridiculous?
    Any halp with this would be excellant.
    Thanks :P

    Hi,
    Your old pod can only sync with music that is physically in your itunes library and on your hard drive. Therefore there is simple way to resolve is to download your music to your hard drive.
    Jim

  • Is there way to set thicker font for Clock widget?

    Is there way to set thicker font for Clock widget (including Home and Unlock screens) ?
    Solved!
    Go to Solution.

    As I understand, not by default.
    Check on Google Play store if you can find any clock widgets that may suit your needs.
     - Community Manager Sony Xperia Support Forum
    If you're new to our forums make sure that you have read our Discussion guidelines.
    If you want to get in touch with the local support team for your country please visit our contact page.

  • Is there a (relatively simple) way to skip tracks with an iPod touch 5th gen using a physical button? I'm aware songs can be skipped on-screen without unlocking the iPod, but I'm looking for a method that doesn't require taking my eyes off the road.

    Is there a (relatively simple) way to skip tracks with an iPod touch 5th gen using a physical button? I'm aware songs can be skipped on-screen without unlocking the iPod, but I'm looking for a method that doesn't require taking my eyes off the road while driving. For that reason, I'm also not interested in adding in headphones or additional devices that have the desired button functions. Going both forward and back would be great but I would be pleased just to have a "sight-free" way to go forward.
    I've seen some mention here and there about ways to maybe change it so the volume buttons change tracks and holding the volume buttons changes the volume... but I don't know what's involved in that or if its even possible/recommended for a new 5th gen iPod. I think its a great device but its sadly lacking in music oriented functions and features... which is disappointing since music is why most people would bother getting one instead of some other "iDevice" :/

    Given that you cannot do what you have asked for, perhaps you simply need to find another solution to your root problem.
    Presumably, you want to skip to the next track because you don't want to hear the current one, and that is because...
    You don't like it.
    You've heard it recently and don't want to hear it now.
    Simply don't want to hear it at this time.
    For problem number 1. Don't put it on the iPod in the first place. (I know, obvious answer!)
    For problem number 2. How about playing from a Smart Playlist (initially created in your iTunes Library) which has only songs you've not played recently?
    For problem number 3. Hhhmmm! Create alternative Playlists for use in the car.
    As for going back to the start of the "now playing" track.... Well, if your Playlist has only songs that you really, really want to hear, then you'll be looking forward to that rather go back to the beginning of the current song.
    I'm not trying to be prescriptive, just giving you food for thought.
    (They are all cheaper options than buying a car which can control the iPod from the steering wheel.)

Maybe you are looking for