Adjust border size

anyone know how to change the border dimensions for the set of buttons? for the image the border is fine but for the buttons it takes up half the frame where the buttons only take up a quarter of the frame
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
public class TestImageIcon extends JFrame{
    private ImageIcon myicon = new ImageIcon("C:/Users/Documents/NetBeansProjects/OOPjava/src/Chapter15/image/my.jpg");
    private JButton okbt = new JButton("OK");
    private JButton cancelbt = new JButton("Cancel");
    public TestImageIcon(){
        JPanel p2 = new JPanel();
        p2.setLayout(new GridLayout(1,1,10,20));
        p2.add(new JLabel(myicon));
        okbt.setForeground(Color.ORANGE);
        okbt.setBackground(Color.red);
        JPanel p1 = new JPanel();
        p1.setLayout(new FlowLayout());
        p1.add(okbt);
        p1.add(cancelbt);
        p1.setBorder(new TitledBorder("Two Buttons"));
        p2.setBorder(new TitledBorder("My picture"));
      setLayout(new GridLayout(2, 1, 5, 5));
      add(p2);
      add(p1);
    public static void main(String[] args){
      TestImageIcon frame = new TestImageIcon();
      frame.setTitle("TestImageIcon");
      frame.setLocationRelativeTo(null); // Center the frame
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setSize(300, 300);
      frame.setVisible(true);
} Edited by: 87654321 on 07-Sep-2011 06:12

Don't use a GridLayout for the content pane of the frame. The GridLayout makes all components the same size.
Use the BorderLayout which is the default layout for a frame anyway.
//setLayout(new GridLayout(2, 1, 5, 5));
//add(p2);
//add(p1);
add(p2, BorderLayout.CENTER);
add(p1, BorderLayout.NORTH);

Similar Messages

  • Adjusting border size when printing

    I'm trying to print photos. Last time I did this, I could adjust the size of the image within the given paper size (4x6) with a simple slider control. This made the white border around the picture bigger or smaller accordingly. I'm not finding the slider this time. Has something changed, or have I forgotten how to do that?

    You must have been using iPhoto 6 the last time as that's not available any more. There are themes now with different border options but no continuously adjustable border width.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    Note: There now an Automator backup application for iPhoto 5 that will work with Tiger or Leopard.

  • Trouble with Border Size when Printing

    I am having a great deal of difficulty with border size using PSE 9 and an Epson R800.  I have the latest driver for Windows 7, and still all of my photos come out with a .25" border (or greater if border is checked in the Adobe settings as well) when "borderless" is left unchecked.  I have tried all possible permutations of borderless with an added border, changing print size to trick the program, but cannot get the 3mm (.125") border I am accustomed to. Can anyone figure out what I am doing wrong?  Is a quarter of an inch on a 4x6 print the standard border?
    Thanks in advance
    Gregg

    You must have been using iPhoto 6 the last time as that's not available any more. There are themes now with different border options but no continuously adjustable border width.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    Note: There now an Automator backup application for iPhoto 5 that will work with Tiger or Leopard.

  • Why FlowLayout - JPane will NOT auto adjust in size?

    Hello java friends,
    I don't understand why my little demo program's JPane(use FlowLayout manager) will not adjust the size correctly. When run, I see one row of buttons, which only show 11 of them; the rest are shown on secon row which only visible if I go resize the window. Why is that? Wouldn't FlowLayout manager will auto size the pane? My main frame used the pack() method, so it's up to the pane's preferredsize. Please give me some ideas. Thanks.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Template {
        public static void main(String[] args) {
             JFrame mainFrame =new JFrame("Template");
            mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            mainFrame.setContentPane(new TemplatePane());
            //Display the window.
            mainFrame.pack();
            mainFrame.setVisible(true);
    class TemplatePane extends JPanel
              implements ActionListener {
         JButton componentAry[] =new JButton[100];
         TemplatePane() {
              this.setLayout(new FlowLayout());
              for(int i=0; i<componentAry.length; i++) {
                   componentAry[i] =new JButton("Test#"+i);
                   componentAry.addActionListener(this);
                   this.add(componentAry[i]);
         public void actionPerformed(ActionEvent ae) {
              System.out.println(ae.getActionCommand());

    I did read the API doc:
    >>>>
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. Flow layouts are typically used to arrange buttons in a panel. It will arrange buttons left to right until no more buttons fit on the same line. Each line is centered.
    >>>>
    My question is why won't it adjust the pane size if the there is more than one line? It did draw the second line for things that won't fit in the first line... just not visible unless the whole window is resized to a bigger view. Can you please provide an explanation?

  • How can I adjust text size in ibooks dictionary?

    How can I adjust text size in ibooks dictionary?

    Hello Eoradec2012,
    It sounds like you are using the Define function in iBooks and you are wanting to increase the size of the font on the page showing the definition. The size of that text can be controlled in the Text Size section:
    To adjust the font size, follow these steps:
    Go to Settings > General > Text Size.
    Drag the slider to the preferred size. The text on the screen will adjust as you move the slider.
    iOS: Adjusting the font
    http://support.apple.com/kb/HT5956
    Thank you for using Apple Support Communities.
    Cheers,
    Sterling

  • How do I adjust the size of program fonts to accommodate low vision users?

    Is it possible to adjust the size of program text to accommodate low vision users, like an enlarge text button or CTRL + zoom text function like in my browser?
    I know I am not the first person to approach this issue.  Since PSE 5 the text sizes have been getting smaller each version and even harder to read, and now that screens are much larger, it makes the menu text even smaller. I predict that by v. 20, users will have to just memorize where to put their cursor to click on a menu item.
    I have already adjusted my system text sizes to 175% but it does no good for PSE, if I use the zoom entire screen, I can only view 1/4 of the workspace at a time. There really should be an easy way to personalize your workspace. I have to reduce my screen resolution to 800x600 and change back to 1920x1080 to view the item in it's intended location each time I edit or create images and cannot work on the document that I am creating or editing a graphic at the same time.  What a huge inconvenience. 
    I have resorted to keeping my binoculars next to my computer for just this reason.  Picture it... binoculars to select anything on a menu.  In a way I feel like a prisoner.  Who are the quality control people, anyone that suffers with low vision? The last major problem I had to live with, PSE 10's gray on black! Find the scroll button when your eyes are tired! LOL.
    There are major reasons why I stick to PSE too, so changing programs is not a viable option for me.

    popsierose
    I am assuming that you are on Windows 7, 8, or 8.1 64 bit.
    Not sure if there is another way, but the way that works for me
    a. right click the computer taskbar, and click on Cascade Windows
    b. in the Premiere Elements Expert workspace, go the the bottom right edge of the workspace view, place the mouse cursor at that point until its tip has a diagonal icon, and then drag upward right to left diagonally to give some view of the desktop where I have the file for the drag and drop into Premiere Elements....then drag and drop the supported file into the Timeline or Project Assets or a drag and drop location.
    Please let us know if that worked for you.
    Thank you.
    ATR

  • I have loaded windows 8.1 via bootcamp on my macbook air 11 inch how can i adjust font size etc

    I have loaded windows 8.1 via bootcamp on my macbook air 11 inch how can i adjust font size. I have to do a lot of work in office 2013 and it is very very difficult to see the screen.
    Thank you

    Microsoft store will provide a download manager (.exe) using your Product Key, which needs to be run on a PC. This manager will then let you download an ISO image to a USB and/or DVD.

  • Create pdf from html, how to adjust page size

    I have a large html file that I need to convert to a pdf. I am able to open the html in acrobat and save as pdf, but I cannot find where to adjust the page size. When I save the html in acrobat, the saved file is still a single page, but when I open the page in reader, then there are page breaks.
    How do I adjust the page size and create a single page document?
    There is also a header and footer line that I don't want. How do I get rid of those?
    LHH

    When you open the window for create PDF from web, select the settings. You can adjust the size and header/footer there.

  • How do you change/adjust border width for all the cells in a table created in Pages?

    How do you change/adjust border width for all the cells in a table created in Pages?
    Note- I am trying to figure out how to create and format tables in the latest version of the Pages app on an iPad air (iOS 8.1.1.1) . Creating tables, adding or removing borders for individual/all cells in a table seems straight forward. However the default border style seems to be a heavy black line. How do I change this?
    I found the option add or remove borders for all/ individual cells in a table, however I can't find any option within style/format dialogue screens for changing colour or line thickness for table cells. Likewise I can't find any clear instructions on how to do this in apple help pages or support website
    Btw- I'm assuming  it is possible to customize/adjust the colour & thickness of selected lines in a table created in this app (it's fairly easy to do this word processing apps like MS Word) please let me  know if this is not actually possible in Pages

    They know perfectly well what they took out of Pages '09.
    Well over 90 features.
    Do you think you posting feedback is going to remind them of what they did?
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    Pages '09 should still be in your Applications/iWork folder.
    Archive/trash Pages 5 and rate/review it in the App Store, then get back to work.
    Peter

  • How to adjust the size of a region?

    Hello, would anyone know how to adjust the size of a region size?
    Thanks for your replies!

    Checkout an interesting article called " Oracle9iAS Portal Best Practices: Regions" to understand resizing region.
    http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/OTN_CONTENT/MAINPAGE/PUBLISH_CONTMGMT/TECHNOTE_REGIONS_0.HTML

  • Scroll bar too narrow to handle- how do I adjust its size?

    Is there a way to adjust the size of the scroll bars WITHOUT effecting the dimensions of the arrange window?
    For some reason I have this one project where the scroll bars are smaller and impossible to grab and move around even though the dimensions of the arrange window are pretty average and in all the other projects the scroll bars are wide enough to grab and move. Is this a bug?? or is there somewhere where you can adjust their size in the preferences panel?
    Thanks!
    (using logic 9.1.7 on osx 10.6.8)

    popsierose
    I am assuming that you are on Windows 7, 8, or 8.1 64 bit.
    Not sure if there is another way, but the way that works for me
    a. right click the computer taskbar, and click on Cascade Windows
    b. in the Premiere Elements Expert workspace, go the the bottom right edge of the workspace view, place the mouse cursor at that point until its tip has a diagonal icon, and then drag upward right to left diagonally to give some view of the desktop where I have the file for the drag and drop into Premiere Elements....then drag and drop the supported file into the Timeline or Project Assets or a drag and drop location.
    Please let us know if that worked for you.
    Thank you.
    ATR

  • Is there a way to adjust the SIZE of artwork (movies, music, etc) there used to be a "slider"

    Is there a way to adjust the SIZE of artowrk (movies, albums, etc)?

    .02,
    See two views below.  Are we talking about the same thing:

  • How to adjust the size of the slide in keynote to 7.5 feet high x 3.1 feet wide?

    How to adjust the size of the slide in keynote to 7.5 feet high x 3.1 feet wide?

    Keynote is not designed to produce printed media, it is set up is for video. There are dozens of applications that are designed for printed output on the Mac, Pages, Word, In design, Quark, Open Office, Libra.
    Pages is the accompanying application in the iWork suite that is specifically designed to print to paper, you should look at that first as it May be on your Mac already.

  • How to increase border size in Illustrator CS3?

    Like the title says, how do you increase the border size in Illustrator CS3? I have a .svg that I've increased the size of, but I can't figure how to get the borders (the four "L" shaped lines) to expand as well.

    I just sent you the link for the Adobe Illustraor CS3 as well, just in case. It has some of the things we talked about in there. 
    help.adobe.com/.../illustrator/cs3/illustrator_cs3_help.pdf

  • Adjusting paper sizes

    I just bought a hp 510 plotter printer 42 inch I have 36inch paper the tech that installed the printer did not adjust paper size  !! I have tried to do this my self but I cant get it right!!therfore  I keep missing the last 2 inches on these blueprints can some one tell me how to do this Thanks current paper size is 36inch by 28 inch

    Hi Isis61,
    Try doing a Hard Reset as described in the following link.  Click Here  Also, shut your computer down.  Restart the computer after a minute.  Is there any difference?
    When you change the settings for A4 printing, is it done at the  Software  level or at the  Default  level?  Software settings will override default settings,
    What program are you using?  Does the A4 / A5 mix-up happen on other programs?
    What is the operating system for your computer?

Maybe you are looking for

  • Flash not showing up in DW Template

    I have a DW template page that contains a flash element at the top and when I apply it to my pages and upload the pages the flash is missing. I thought it was a problem with where the swf resided, but I've put the swf file in the images folder, I put

  • I want to store medical records on my iPad, how do I do this?

    I got my iPad in hope of having a better way of storing and taking with me my families medical records. It could be a lot easier then carrying my laptop. Dose anyone have an idea what app or program I might need to do this?

  • WL fails to install on RedHat 7.1 Linux with IBM JDK

    Attempting to install eval version for Linux. Issue command (as root): sh weblogic600sp1_linux.bin -i console And get this error consistently. [root@LinuxWeb src]# sh /home/curtisf/weblogic600sp1_linux.bin -i console Preparing to install... /tmp/inst

  • Photoshop into Illustrator

    Hi all, I have saved an image as a EPS file from Photoshop CS3, I open Illustrator with my background image I have made. I then load up the EPS file in Illustrator CS3 go to Edit>Copy. But when I paste it over the the background image I get the image

  • [SOLVED] Awesome WM - Mouse Doesn't Work on Client Objects

    I am new to Arch and awesome and I haven't tampered with the default rc.lua but my mouse doesn't do anything when used on windows(clients). It does in fact work everywhere else e.g. the root window, the menu-bar... Below is the relevant part of my rc