HELP !!! How can I set the size of each component separately

Please tell me, when adding components (a mix of
labels , buttons etc.) on a container (swing), how can I set the size
of each component separately.
for example:
the code here has a mix of button and a grid that is actually another JPanel. Its a part of a bigger
program. When running the grid is cut (not seen in its full size).
So, please try to anser also about the specific acse of frame contining another frame in it , and the interior should be right sized.
The relevant part of the code:
=========================================
public class Reversi extends JFrame {
public static void main(String[] args) {
Reversi ourGame = new Reversi();
public Reversi() {
super("Grid Reversi");
setSize(new Dimension(300, 300));
setDefaultCloseOperation(EXIT_ON_CLOSE);
Grid g = new Grid(); // the grid was built at another part..
ReversiGame ourGame = new ReversiGame();
JButton b;
JFrame f = new JFrame("Hello Java");
f.setSize(new Dimension(300, 300));
f.setDefaultCloseOperation(EXIT_ON_CLOSE);
Container c = f.getContentPane();
c.add(g,BorderLayout.NORTH );
c.add(b = new JButton("Hola"), BorderLayout.CENTER);
//f.pack();
f.show();

BorderLayout chooses the sizes of each of the components added to it. Choose a different layout manager (or set the placement/size manually with a 'null' layout)
http://java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/shortcourse.html

Similar Messages

  • How can I set the size of the font so I don't have to change every new word?

    How can I set the size of the font so I don't have to change every new word?

    In what application?

  • How can I set the size of an image in java?

    How can I set the size of an image in java? I have to choose the width and height of image...thanks to everybody...sorry for my english :-)

    Hi 43477
    Can you provide more details, do you want to setsize to display an image on a screen of when saving image etc?
    PS.
    There is a good invention called googlegoogle is good, but sometimes it's better to use more specific search, there is a search field avove on this page :)

  • How can I set the field ICt in component table of the Tasklist as "Input" ?

    Hi experts,
    How can I set the field ICt (BOM's Item Category (POSTP)) in component table of the Tasklist as "Input" Status (The system is in gray now).
    I can define the different Category value by IB01 or IB02,then I can select them at the Tasklist's component table.But sometimes I need batch input such as LSMW,so pls kindly tell me how to setup it,thanks!
    Yinjun

    Hi,
    BOM is created with some component and item category.
    In task list when you go to component, in normal case one selects and copies BOM over there by clicking component selection button.
    Once BOM is copied over there the BOM item category will get copied. As it is BOM item category in Task list it is greyed and it will get copied automatically from BOM.
    You specify item category required by you in IB01 or IB02 and then use that BOM in task list. Go to componenet tab and click component selection button. Once BOM is copied over there the BOM item category will get copied

  • Time Machine: How can I find the size of each individual backup?

    When I look in the Time Machine external hard drive under Backups.backupdb, I see all of the backups. I also see the total space remaining on the Time Machine. However, I would like to know the size of each individual backup file. Is there a way to get this information? It does not show in the "Get Info" window of the backup.
    Thanks

    The question is ambiguous, because a snapshot may consist almost entirely of references to other snapshots and thus take up almost no space on the backup volume. There is a shell command that enables you to see how much data was copied from the sources in the last snapshot. An example of how to use it is below.
    Triple-click anywhere in the line below to select it:
    tmutil compare
    Copy the selected text to the Clipboard (command-C).
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V).
    The command will take at least a few minutes to run. Eventually some lines of output will appear below what you entered.
    Each line that begins with a plus sign (“+”) represents a file that has been added to the source volume since the last snapshot was taken. These files have not been backed up yet.
    Each line that begins with an exclamation point (“!”) represents a file that has changed on the source volume. These files have been backed up, but not in their present state.
    Each line that begins with a minus sign (“-“) represents a file that has been removed from the source volume.
    Files that you’ve excluded from backup, or that are excluded automatically, are ignored.
    At the end of the output, you’ll get some lines like the following:
    Added:
    Removed:
    Changed:
    These lines show the total amount of data added, removed, or changed on the source(s) since the last snapshot.

  • How can I set the size of combo boxes on a toolbar

    Hi, I am trying to use setMinimumSize of a combo box on a toolbar, It doesn't seem work. The code as following? Can anyone tell me how I can do it ?
    JComboBox sw = New ComboBox();
    sw.setMinimumSize(new Dimension(10,10));
    Thank you.
    Scott

    use the method preferred size of the JComponent superclass of the combos:
    setPreferredSize
    public void setPreferredSize(Dimension preferredSize)
    Sets the preferred size of the receiving component. If preferredSize is null, the UI will be asked for the preferred size.

  • How can i set the size of the task windows and text to something more suitable?

    When i bought my HP Touchsmart 600 pc the text size and window size on the desktop were tiny as Default, i manage to change it where it wasnt to big or small it was just right.
    but recently i had to restore my whole computer back to factory settings and now the text is huge and the windows are coming up big as well. i played around in the display settings and put it at 100% default and that doesnt help i then tried it on 125% but that is still big...
    i cant remember how i did it last time and its really hard to explain. but could anyone help me and point me in the right direction cause its annoying i use to fit like 10 icons vertically in a row on my desktop now i can fit only 8 and the start menu comes up huge.
    so if any one could help me out it would be great! thankyou in advance. 

    Hi 43477
    Can you provide more details, do you want to setsize to display an image on a screen of when saving image etc?
    PS.
    There is a good invention called googlegoogle is good, but sometimes it's better to use more specific search, there is a search field avove on this page :)

  • Formatting issues: when I open a msg, the font is sooo small you need a magnifier to read it. How can I set the font size to one I can easily read?

    == Issue
    ==
    I have another kind of problem with Firefox
    == Description
    ==
    I have various formatting issues:
    a. When I open a msg from my web browser (Cablevision), the font is sooo small I need a magnifier to read it. How can I set the font to a size I can easily read?
    b. When I forward msgs, the text gets all distorted and I need to clean it up (some symbols, lots of spaces between words). How can this be fixed?
    c. When I want to tell someone about a website, I cannot type the URL in so that all they have to do is click on it. How can this be fixed?
    d. When I open messages, the text opens in a small window and covers the "Show Images" button. Why?
    == This happened
    ==
    Every time Firefox opened
    == Ever since I started using Firefox (a few months ago)
    ==
    '''Troubleshooting information'''
    I didn't find any results
    == Firefox version
    ==
    3.6.3
    == Operating system
    ==
    Windows 7
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
    == Plugins installed
    ==
    *-nphpclipbook
    *Office Plugin for Netscape Navigator
    *The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
    *Default Plug-in
    *Adobe PDF Plug-In For Firefox and Netscape "9.3.2"
    *NPRuntime Script Plug-in Library for Java(TM) Deploy
    *The Hulu Desktop Plugin allows Hulu.com to integrate with the Hulu Desktop application.
    *Shockwave Flash 10.0 r45
    *Adobe Shockwave for Director Netscape plug-in, version 11.5
    *iTunes Detector Plug-in
    *3.0.40624.0
    *NPWLPG
    *Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers

    The text editor is the text area that you use on the webmail (Yahoo, Hotmail) website to create a new mail.
    You can compare that with the ''Post new message'' text area that you use to create a new post on this forum.
    Just above the text area that you use to enter the message text there is usually a button bar with buttons that allows some text formatting like Bold and Italic and can also include a button to make a clickable hyperlink.
    Check the tooltip of each button by hovering with the mouse over each button.
    Make Link - https://addons.mozilla.org/firefox/addon/142

  • How can i set the dos can compile and excute the jar file?please help?

    How can i set the dos prompt can compile my .java file and execute my jar file.

    Go to where you downloaded your Java SDK. Look around for a button labled "Installation." Click the button. Download the installation instructions. Read them. Then read them again.

  • How Can I Determine the Size of the 'My Documents' Folder for every user on a local machine using VBScript?

    Hello,
    I am at my wits end into this. Either I am doing it the wrong way or it is not possible.
    Let me explain. I need a vb script for the following scenario:
    1. The script is to run on multiple Windows 7 machines (32-Bit & 64-Bit alike).
    2. These are shared workstation i.e. different users login to these machines from time to time.
    3. The objective of this script is to traverse through each User Profile folder and get the size of the 'My Documents' folder within each User Profile folder. This information is to be written to a
    .CSV file located at C:\Temp directory on the machine.
    4. This script would be pushed to all workstations from SCCM. It would be configured to execute with
    System Rights
    I tried the script detailed at:
    http://blogs.technet.com/b/heyscriptingguy/archive/2005/03/31/how-can-i-determine-the-size-of-the-my-documents-folder.aspx 
    Const MY_DOCUMENTS = &H5&
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(MY_DOCUMENTS)
    Set objFolderItem = objFolder.Self
    strPath = objFolderItem.Path
    Set objFolder = objFSO.GetFolder(strPath)
    Wscript.Echo objFolder.Size
    The Wscript.Echo objFolder.Size command in the script at the above mentioned link returned the value as
    '0' (zero) for the current logged on user. Although the actual size was like 30 MB or so.
    I then tried the script at:
    http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_27869829.html
    This script returns the correct value but only for the current logged-on user.
    Const blnShowErrors = False
    ' Set up filesystem object for usage
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("WScript.Shell")
    ' Display desired folder sizes
    Wscript.Echo "MyDocuments : " & FormatSize(FindFiles(objFSO.GetFolder(objShell.SpecialFolders("MyDocuments"))))
    ' Recursively tally the size of all files under a folder
    ' Protect against folders or files that are not accessible
    Function FindFiles(objFolder)
    On Error Resume Next
    ' List files
    For Each objFile In objFolder.Files
    On Error Resume Next
    If Err.Number <> 0 Then ShowError "FindFiles:01", objFolder.Path
    On Error Resume Next
    FindFiles = FindFiles + objFile.Size
    If Err.Number <> 0 Then ShowError "FindFiles:02", objFile.Path
    Next
    If Err.Number = 0 Then
    ' Recursively drill down into subfolder
    For Each objSubFolder In objFolder.SubFolders
    On Error Resume Next
    If Err.Number <> 0 Then ShowError "FindFiles:04", objFolder.Path
    FindFiles = FindFiles + FindFiles(objSubFolder)
    If Err.Number <> 0 Then ShowError "FindFiles:05", objSubFolder.Path
    Next
    Else
    ShowError "FindFiles:03", objFolder.Path
    End If
    End Function
    ' Function to format a number into typical size scales
    Function FormatSize(iSize)
    aLabel = Array("bytes", "KB", "MB", "GB", "TB")
    For i = 0 to 4
    If iSize > 1024 Then iSize = iSize / 1024 Else Exit For End If
    Next
    FormatSize = Round(iSize, 2) & " " & aLabel(i)
    End Function
    Sub ShowError(strLocation, strMessage)
    If blnShowErrors Then
    WScript.StdErr.WriteLine "==> ERROR at [" & strLocation & "]"
    WScript.StdErr.WriteLine " Number:[" & Err.Number & "], Source:[" & Err.Source & "], Desc:[" & Err.Description & "]"
    WScript.StdErr.WriteLine " " & strMessage
    Err.Clear
    End If
    End Sub
    The only part pending, is to achieve this for the 'My Documents' folder within each User Profile folder.
    Is this possible?
    Please help.

    Here are a bunch of scripts to get folder size under all circumstances.  Take your pick.
    https://gallery.technet.microsoft.com/scriptcenter/site/search?query=get%20folder%20size&f%5B0%5D.Value=get%20folder%20size&f%5B0%5D.Type=SearchText&ac=2
    ¯\_(ツ)_/¯

  • How can I control the size of a cell in the GridBagLayout?

    Hi,Swing Gurus
    I am developing a swing-based program using JBulider5 enterprise.
    It seems to me that the GridBagLayout is really a hard nut!
    How can I control the size of a cell in the GridBagLayout?
    It seems that I cann't control the size of a cell directly.
    But how the size of a particular cell is determined when I switch the layout manager from XYLayout to GridBagLayout?
    Thx in advance!
    Regards,
    Justine

    hi,i have not done what you are asking but there are fields like
    COLUMNWIDTH, MINSIZE, MAXGRIDSIZE, PREFEREDSIZE to which you can set the appropriate values and test for your need.hope this helped.bye martian.

  • How do i set the size of 3d picture control

    dear sir,
                I have attached my vi.I have one doubt  ie I have used translate object. vi in my vi to move my picture according to the value set by the y position.This y position indicates depth my object.this is sample object  insteat of i am going to update my underwater vehicle.
    What my problem is when i chnage the y value beyond 200 I can not see my picture.so  how do i set the size of the 3d picture control size.
           I have to see my picture within the 3d picture control eventhough i change the y value between 0-500,how do i solve my problem.
    Another my doubt is how do i show the depth value (ie y value in translate object .vi) in 3d picture control ie while the picture is moving in a 3d picture control at the same time i want to display the corresponding depth rating in the 3d picture control
    Pls anyone suggest me as soon as possible.
    Thanks and regards
    jayanthi.k
    Attachments:
    Untitled 1.llb ‏67 KB

    Jayanth,
    Take a look at the attached example.  Alternatively, you can search for it in NI Example Finder by going to Help>>Find Examples in LabVIEW, click on the search tab, and search for meshes.  I had difficulty reading your code, but I believe you need to position your lighting source in the optimal location to get better definition.  And the example shows how to bind a color to the object.
    Trey B
    Applications Engineering
    National Instruments
    Attachments:
    Using Meshes.vi ‏76 KB

  • How can i Change the Size of the selected text in JTextPane using ConboBox

    plzz help...
    How can i Change the Size of the selected text in JTextPane using ConboBox ???
    i m using if(cb.getSelectedItem=="small")
    cb.setAction(new StyledEditorKit.FontSizeAction("double click", 12);)
    if(cb.getSelectedItem=="medium")
    cb.setAction(new StyledEditorKit.FontSizeAction("double click", 14);)
    if(cb.getSelectedItem=="large")
    cb.setAction(new StyledEditorKit.FontSizeAction("double click", 16);)
    this code is not working properly according to the action i set on comboBox.
    when i select medium the previously set action on comboBox works like small action work.
    when i select large the medium action starts .
    means its not working in correct time when i select item of combox n action of that item is not working at that time..
    plzz plzz help me:(

    Action action1 = new StyledEditorKit.FontSizeAction(
    "double click", 12);
    Action action2 = new StyledEditorKit.FontSizeAction(
    "double click", 14);
    Action action3 = new StyledEditorKit.FontSizeAction(
    "double click", 18);
    s2 = (String) cb7.getSelectedItem();
    if (s2.equals("Small")) {
    cb7.setAction(action1);
    e1.setSource(cb7);
    } else
    if (s2.equals("Medium")) {
    cb7.setAction(action2);
    e1.setSource(cb7);
    } else if (s2.equals("Large")) {
    cb7.setAction(action3);
    // e1.setSource(cb7);
    when i chooze any combobox item then according to that item i set the Action on ComboBox but that action is not working properly on the selected text in the JTextPane..means selected text in JText Pane is not changes its Size according to the comboBox selected ITEM.
    PLZ plzzzzzzzzzz help me:((.i will be thankfull to u.

  • How can i set the alternating colors for a table rows

    Dear All,
    Please any one help me how can i set the Alternating colors for Table Rows.
    i created a theam there i set the background alternating color to brown and i set the table design properity to alternating. but it is not reflecting.

    Hi,
    The design property in Table properties should work for your requirement. Select "alternating" value for design.
    Please see the API below:
    design
    Determines the appearance of the table. The property design can take the following values and is represented by enumeration type WDTableDesign.
    alternating - The table rows are displayed alternately in a different color.
    standard - The table background has one color. The individual table rows are displayed with grid net lines.
    transparent - The table background is transparent. The individual table rows are displayed without grid net lines.
    Check whether you have changed the right property or not? Also table should contain more than one rows to test this scenario.
    Regards,
    Jaya.
    Edited by: VJR on Jun 17, 2009 6:43 PM

  • How can I set the language when sending an e-mail with attachment - 'Html'?

    "Character Broken"
    I made an ALV program, and this convert to "HTML',  and send an e-mail with this.
    Used Process is:
    DATA: gt_abaplist LIKE TABLE OF abaplist,
          gt_html LIKE TABLE OF w3html,
          doc_chng LIKE sodocchgi1,
          objpack LIKE TABLE OF sopcklsti1 WITH HEADER LINE,
          objhead LIKE TABLE OF solisti1 WITH HEADER LINE,
          mail LIKE TABLE OF solisti1 WITH HEADER LINE,
          reclist LIKE TABLE OF somlreci1 WITH HEADER LINE,
          lv_line TYPE i.
    DELETE FROM MEMORY ID '%_LIST'.
    SUBMIT z_template
       AND RETURN EXPORTING LIST TO MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = gt_abaplist
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
      TABLES
        html       = gt_html
        listobject = gt_abaplist.
    doc_chng-obj_name   = 'URGENT'.
    doc_chng-sensitivty = 'O'.
    doc_chng-obj_descr  = ' '.
    doc_chng-obj_langu  = '3'.
    objhead-line        = ' '.
    APPEND objhead.
    mail[] = gt_html[].
    DESCRIBE TABLE mail LINES lv_line.
    CLEAR: objpack.
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = lv_line.
    objpack-doc_type   = 'htm'.
    objpack-obj_descr  = ' '. 
    objpack-doc_size   = lv_line * 255.
    objpack-obj_langu = '3'.
    APPEND objpack.
    CLEAR: reclist.
    reclist-receiver = 'e-mail address'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng 
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = mail
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        document_type_not_exist    = 3
        operation_no_authorization = 4
        parameter_error            = 5
        x_error                    = 6
        enqueue_error              = 7
        OTHERS                     = 8.
    SUBMIT rsconn01 AND RETURN.
    I want to show  this by "Japanese".
    But the character is broken.
    LIke This:
    u01D1u072C          u0205|            u0205u072C          u0508           QC u04B90m
    How can I set the language?  How can I solve "Charancter Broken" ?
    Plesse, let me know.
    Thank you so much.
    Edited by: Jaime White 999 on Nov 21, 2011 8:45 AM
    Edited by: Jaime White 999 on Nov 21, 2011 8:46 AM

    Hi Jaime,
    Are you saying, you are getting junk characters in the email attachment? Then pls check the following. Since you want to send Japanese fonts, please pass language 'J' in both  objpack-obj_langu = '3' & doc_chng-obj_langu  = '3' instead of '3' please replace it with 'J'.
    Another thing which you may have to check is the SCOT device type. As I understand from my basis colleague, this may also affect your attachment fonts since the emails are sent through SCOT. Go to transaction SCOT-> Settings-> Device types for format conversion. Check whether wrong device type is defined for Japanese there. Hope this helps
    Regards,
    Gokul

Maybe you are looking for

  • Cannot send email from yahoo mail client

    I cannot open or send or attach anything to my email in the yahoo mail.  I know there's nothing wrong with the email because it works on my laptop, just not on my computer.  Could there be a setting problem, or a cookie problem or something? I also c

  • ODBC Data Source Error

    I was having with Crystal communicating with one of my Access databases that had a list box. In Crystal it would take the list box, add and remove letters. It was suggested that I check with my IT department to see if there are any updates. Well they

  • VS2012 removing Package folder for SharePoint 2013

    Hi, Has anybody faced a problem with Visual studio 2012 where it removes the package folder automatically when you open the project and working in a team. After that it throws error in publishing and deploying and one has to readd this folder from ba

  • How can I turn off the animated download arrow (on top-right of screen) in FF 20.0.1?

    The new animated download arrow is extremely distracting & quite annoying (and I know I'm definately not the only one who thinks so). If there is no option to turn it off, I really hope you include that feature in the next update.

  • Report S_ALR_87013533 COLUMN REMORDPLA -  HOW IS IT CALCULATED?

    hI, Does anyone know how the column remordpla is calculated into report S_alr_87013533? What are its exact calculation steps? I mean , those data how it is extracted? Thanks a lot ,Carlo