JPanel Multipe Images are cutoff (layout problem I think)

I am adding images (custom JPanel: Entity class) to a JPanel but the images are getting cut off. I was originally trying BorderLayout but that only worked for one image and adding others added image cut-off the first or completely removed the original image all together. So I switched to other layouts and the closest I could get was BoxLayout however that adds a very large cut-off which is not acceptable either.
So basically; How can I add images (from a custom JComponent) to a custom JPanel without bad effects such as the one present in the code.
How do I go about adding images from Entity class to a JPanel without them getting cutoff or not showing at all?
Note: the images need to animate.
Entity Class:
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import javax.swing.JComponent;
public class Entity extends JComponent implements Runnable {
private BufferedImage bImg;
private int x = 20;
private int y = 20;
private int entityWidth, entityHeight;
public void run() {
bImg = loadBImage("test.png", bImg);
entityWidth = bImg.getWidth();
entityHeight = bImg.getHeight();
setPreferredSize(new Dimension(entityWidth, entityHeight));
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g.create();
g2d.drawImage(bImg, x, y, null);
g2d.dispose();
public BufferedImage loadBImage(String filename, BufferedImage tmpBI) {
try {
tmpBI = ImageIO.read(getClass().getResource(filename));
} catch (Exception e) { }
return tmpBI;
public int getEntityWidth() { return entityWidth; }
public int getEntityHeight() { return entityHeight; }
public int getX() { return x; }
public int getY() { return y; }
public void setX(int x) { this.x = x; }
public void setY(int y) { this.y = y; }
}Main:
import java.awt.EventQueue;
import javax.swing.JFrame;
public class MainWindow
public static void main(String[] args) {
new MainWindow();
private JFrame frame;
private GraphicsPanel gp = new GraphicsPanel();
MainWindow() {
EventQueue.invokeLater(new Runnable() {
public void run() {
frame = new JFrame("Graphics Practice");
frame.setSize(680, 420);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(gp);
}Graphics Panel: This is where the problem arrises.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JPanel;
import javax.swing.Timer;
public class GraphicsPanel extends JPanel implements MouseListener {
private Entity entity;
private Entity ent2;
private Timer timer;
private long startTime = 0;
private int numFrames = 0;
private float fps = 0.0f;
GraphicsPanel() {
entity = new Entity();
entity.setOpaque(false);
Thread t1 =  new Thread(entity);
t1.start();
ent2 = new Entity();
entity.setOpaque(false);
Thread t2 = new Thread(ent2);
ent2.setX(100);
ent2.setY(100);
t2.start();
//ESSENTIAL
setLayout(new BorderLayout());
//COMMENT OUT add(ent2) to see the problem. Any image will do.
add(entity);
add(ent2);
//GAMELOOP
timer = new Timer(30, new Gameloop(this));
timer.start();
addMouseListener(this);
@Override
public void paintComponent(Graphics g)
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g.create();
g2.setClip(0, 0, getWidth(), getHeight());
g2.setColor(Color.BLACK);
g2.drawString("FPS: " + fps, 1, 15);
public void getFPS()
++numFrames;
if (startTime == 0) {
startTime = System.currentTimeMillis();
} else {
long currentTime = System.currentTimeMillis();
long delta = (currentTime - startTime);
if (delta > 1000) {
fps = (numFrames * 1000) / delta;
numFrames = 0;
startTime = currentTime;             
public void mouseClicked(MouseEvent e) {}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
public void mouseEntered(MouseEvent e) { }
public void mouseExited(MouseEvent e) { }
class Gameloop implements ActionListener
private GraphicsPanel gp;
Gameloop(GraphicsPanel gp) {
this.gp = gp;
public void actionPerformed(ActionEvent e) {
try {
gp.getFPS();
gp.repaint();
} catch (Exception ez) { }

You got a bit of a concurrency time bomb on your hands with those Entity threads of yours. Your Entity class also inadvertently overrides Component#getX() and Component#getY() to return where the image is painted within the component. That can't be good. I'm also not sure how your Entity class is functionally different from a simple JLabel with an ImageIcon and a (20,20,20,20) empty border.
But as for your immediate problem: 1) Use FlowLayout for your Graphics panel, 2) Include a revalidate() call after you set the preferred size in the run() method of your Entity class 3) Don't override Component#getX() and Component#getY() in your Entity class and 4) Add the GraphicsPanel to the frame before, not after, you make the frame visible.

Similar Messages

  • JPanel Positiong with Gridbag Layout Problem

    Hi,
    I'm desingning an UI in which I made a JFrame and set it Layout as gridBag layout. Now I have added Three JPanel in this JFrame.
    The problem is that All the three JPanels are shown in center While I want to palce them in top left corner.
    I have done this through NetBeans 4.0 in the layout coustomize option I've set them in first in the left top most, second in below of the first and so on but when I run the application The JPanel are shown in the center in this Particular position i.e first at the top in center second below to the fist and so on.
    Kindly solve my this problem.
    Regards,
    Danish Kamran.

    To get better help sooner, post a SSCCE that clearly demonstrates your problem.
    Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
    db

  • When I have video clips on my timeline, they do not play in the monitor screen. I hear the sound track but can not see the image. To test if my new files are somehow the problem, I went back and used video files that I used successfully a year ago, and th

    When I have video clips on my timeline, they do not play in the monitor screen. I hear the sound track but can not see the image. To test if my new files are somehow the problem, I went back and used video files that I used successfully a year ago, and they no longer play in the monitor window. I hear the sound track, but do not see any video. Have I changed some setting that controls video playback in the monitor window?

    Randy Ruttger
    Thanks for the follow up.
    Missing in this equation were the version of Premiere Elements that you were using and the computer operating system on which it was running. But...
    The deed is done. But.....Until now and after you went ahead and moved to version 12, we now learn what version of Premiere Elements you were using. We still do not know the computer operating system involved.
    You just said Premiere Elements 10. Premiere Elements 10 is hit by a serious known display issue if the computer uses a NVIDIA GeForce video card/graphics card. In this issue, the only remedy is to roll back the driver version to about May 2013. The description of the problem and how to do the roll back are described in one of the Announcements at the top of this forum. What video card/graphics card does your computer use?
    On another front, Adobe will be releasing a new version of Premiere Elements any day now. No one but Adobe knows the feature set for the new version. That type of information is announced at the moment of release of the new version.
    So the remedy to the problem that you presented in this thread could have been...
    1. Rolling back the NVIDIA GeForce driver version to about May 2013 if possible (Windows 8 or 8.1 64 bit, may not be possible)
    2. Move to another version of Premiere Elements (which you did)
    I offer the above for consideration so that you can review your decisions. We are pleased to learn that Premiere Elements 12/12.1 works for you.
    Please do not hesitate to ask questions and ask for clarifications, but remember that the answers are in the details.
    Best wishes,
    ATR

  • Preview app problem, order of my images are messed up?

    I don't know if this can be solved, or I need to look for a new app.
    I have a lot of manga images, but they are neither "arranged" or "cleaned" by any order. I just continue to add to the folder (say "volume 1") whenever I download a new chapter. Sometimes the name of the images in the new chapter slightly differs from the previous one (usually due to change in scanlation group).
    So when I "select all", and open up preview to read the manga. Preview automatically alphabatize them?? So my images are no longer in order, and I can't read them anymore.
    For example, the CH1 start with "TNS_pg....", the CH2 is "TnSchp19......", and CH3 is "ShoujoCrusade_Tsuki....".
    When I add them into the folder, they are in order since I don't select any arrangements.
    However, PREVIEW automatically put the images from CH3 "ShoujoCrusade_Tsuki...." first when try to read it by "select all" and "open with preview"
    Is there a way to just read my images as the order I put them into the folder, but not by name??
    Also, if I choose "clean up by date added" etc. the newer chapters are in the front, I still can't read it.
    I don't always have this problem but when I do, it's really frustrating opening up 150 images one by one so I could read my manga.
    I hope I was being clear, this is my first post. THANK YOU! ~Ru

    Tony:
    Welcome to the Apple Discussions. Was the photo you put on the About Me page sized to the size you wanted before you added it? If so select the photo and go to the Inspector/Metrics pane and click on the Original Size button. That will resize the photo to its original size. You can preprocess the image in your image editor of choice to the exact dimensions you want and then use the Inspector/Metrics pane to get iWeb to use those original dimensions. Even if you size the photo exactly before adding to the page it will always be resized a ittle by iWeb. That's why you need to use the Graphics pane to get it back to the original size. That may clear it up for you.
    OT

  • Today my screen went all fuzzy and everything is a different shade of red, blue, etc and the images are distored.  Please tell me how to resolve this major problem????

    My screen is fuzzy and images are distorted.  How can I resolve this problem?

    If the Reset/Reboot doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    Finally, if the Restore doesn't work, let the battery drain completely.  Then recharge for at least an hour and Restore again.

  • We are having some problems viewing wide format drawings in safari on the ipad - The images view fine on the computer... Any ideas?

    We are having some problems viewing wide format drawings in safari on the ipad - The images view fine on the computer... Any ideas?

    No, the site isn't Flash-based; it's a site I've visited on the phone dozens of times. This problem only started occurring a few days ago.
    I'm embarrassed to admit that the site is Popsugar.com, a celeb gossip site that I visit whenever I'm bored.

  • Iphoto gives message "no images were selected" when hit print button.  Yet the the images are clearly selected in the print window.  I've printed hundreds of images without a problem before.  Iphoto 6.0.6, MAC 10.5.8

    Iphoto gives message "no images were selected" when hit print button.  Yet the the images are clearly selected in the print window.  I've printed hundreds of images without a problem before.  Iphoto 6.0.6, MAC 10.5.8, Suggestions?

    I have recently started having this problem in PSE8. The Adobe workaround
    did work, but I don't fancy having to re register each time I use it.
    What I have discovered is that it's nothing to do with the image metadata as it occurs before any image is opened.
    It SEEMS to only occur if you use file/open with to open an image in the editor - IE start PSE with that command.
    If you close elements down, and start it using programs/PSE/Elements (or your desktop shortcut) - the panorama feature magically works.
    Each time I've opened the editor 'automatically' using image/open with, it seems to create the problem.
    Hope this helps

  • Gridbag layout problem on a tabbedpane

    I am not sure whether we can do this or not but, I am trying to have a gridbag layout on a TabbedPane object.
    I have a JFrame on which I am adding a TabbedPane object called "t" and on this TabbedPane I am adding a tab called "Insert" which is an object of class "Insert Data". Then, I add the TabbedPane t on the Container cp, which is inside the JFrame.
    In the InsertData Class (a JPanel), I need to have the gridbag layout. With this gridbag layout object, I am trying to place different objects like buttons, at various places, on this JPanel. But nothing moves on this panel.
    In short, please let me know how can I have a gridbag layout on a Tabbedpane.
    The Main Class is as follows:
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import javax.swing.JFrame;
    import javax.swing.JTabbedPane;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class Main extends JFrame implements ActionListener, ChangeListener{
         Main(){
                   setPreferredSize(new Dimension(1200,600));
                   Container cp = getContentPane();
                   JTabbedPane t = new JTabbedPane();
                   // insert
                   InsertData insertOptions = new InsertData();
                   t.addTab("Insert",insertOptions);
                   cp.add(t);
                   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   pack();
                   setVisible(true);
              @Override
              public void actionPerformed(ActionEvent arg0) {
                   // TODO Auto-generated method stub
              @Override
              public void stateChanged(ChangeEvent arg0) {
                   // TODO Auto-generated method stub
              public static void main(String args[]){
                   new Main();
         }The InsertDataClass is:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class InsertData extends JPanel{
         InsertData(){
              setPreferredSize(new Dimension(1200,600));
              setBackground(Color.blue);
              //setLayout(new GridBagLayout());
              GridBagLayout gb = new GridBagLayout();
              setLayout(gb);
              GridBagConstraints c = new GridBagConstraints();
              //c.insets = new Insets(2, 2, 2, 2);
              //JPanel p1= new JPanel();
              //p1.setPreferredSize(new Dimension(200,200));
              JButton b1 = new JButton("here i am!!!");
              //p1.add(b1);
              //c.fill = GridBagConstraints.HORIZONTAL;
              //c.anchor = GridBagConstraints.WEST;
              c.gridx=0;
              c.gridy=1;
              add(b1,c);
    }

    how can I have a gridbag layout on a Tabbedpane.Huh? You post an example with just one JButton and no weightx / weighty set and you expect others here to be able to see a problem with your layout?
    Also, there's needless, unused code that is just clutter -- like the unimplemented ActionListener and ChaneListener. Recommended reading: [SSCCE (Short, Self Contained, Compilable and Executable, Example Program)|http://mindprod.com/jgloss/sscce.html].
    Finally, I don't see any need whatsoever to extend JFrame and JPanel as you are not introducing any new behavior of either. Always favor composition over inheritance.
    I plugged in some code I had used for someone else's GridBagLayout problems and this will show you that there's no difference in using GridBagLayout in a tabbed pane component or anywhere else.import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import javax.swing.*;
    public class GridBagInTabbedPane {
      public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            new GridBagInTabbedPane().makeUI();
      public void makeUI() {
        Font fontButton = new Font("Arial", Font.BOLD, 10);
        Font fontLabel = new Font("Arial", Font.BOLD, 15);
        JLabel labelEnter = new JLabel("Enter sentences in the text area ");
        labelEnter.setFont(fontLabel);
        JTextArea textArea = new JTextArea();
        textArea.setPreferredSize(new Dimension(630, 280));
        JScrollPane scrollPane = new JScrollPane(textArea);
        scrollPane.setMinimumSize(new Dimension(630, 280));
        JLabel labelDuplicates = new JLabel("Duplicates will appear here");
        labelDuplicates.setMinimumSize(new Dimension(650, 30));
        labelDuplicates.setFont(fontLabel);
        JButton buttonDisplay = new JButton("Display Map");
        buttonDisplay.setFont(fontButton);
        JButton buttonClear = new JButton("Clear");
        buttonClear.setFont(fontButton);
        JPanel panel = new JPanel(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.gridwidth = 2;
        gbc.fill = GridBagConstraints.NONE;
        gbc.anchor = GridBagConstraints.CENTER;
        gbc.insets = new Insets(5, 5, 5, 5);
        gbc.weightx = 0.5;
        panel.add(labelEnter, gbc);
        gbc.gridy = 1;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.weighty = 0.5;
        panel.add(scrollPane, gbc);
        gbc.gridy = 2;
        gbc.fill = GridBagConstraints.NONE;
        gbc.weighty = 0.0;
        panel.add(labelDuplicates, gbc);
        gbc.gridy = 3;
        gbc.gridwidth = 1;
        gbc.anchor = GridBagConstraints.EAST;
        panel.add(buttonDisplay, gbc);
        gbc.gridx = 1;
        gbc.anchor = GridBagConstraints.WEST;
        panel.add(buttonClear, gbc);
        JTabbedPane tabbedPane = new JTabbedPane();
        tabbedPane.add(panel);
        JFrame frame = new JFrame();
        frame.add(tabbedPane);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }db

  • Images and Flowgrid Layouts in DW CS6

    Hi All
    Im reasonably new to Fluid Grid Layouts, how ever i have been playing around with them for a couple of weeks and have done ok ....i think.
    The only problem i have is with my images, I have created a page with text and images however when i reduce the size of my browser window everything but the images work how i imagine,
    the text flows fine and the page changes when it reduces to a certain size however my images all be it reduce with the size of the browser it jumps, so when the page is reduced the images are squished out of ratio until the page reaches tablet size then springs back in to proportion, the browser when reduced again squeezes out of ratio until it hits mobile phone size then springs back into proportion.
    Is there anyway of making the pictures when the browser window is reduced to resize smoothly?
    many Thanks

    As I said above, remove the width="143" height="143" attributes from all of your images.  It will re-scale better.
    Nancy O.

  • Dreamweaver website layout problems

    Hello new here
    an someone pls tell me why my website is perfect on my computer where as on other computer the layout is all over the place
    pls help
    thank you

    hans-g. wrote:
    Hi SnakEyez02,
    to explain my suggest (I quote killer): "the problem is i have tried the webpages on other computers and they are out of place where as on my pc its pefect images are out of place and the layout doe not fit to screen which prompted me to take this action because ..."
    I think it would be a good interim solution if killer could search for the error first in offline way, as long as he does not have access to the server.
    Hans-G.
    Ok. But how does downloading the Typo3 CMS help view it offline?  Wouldn't this person be better downloading:
    WAMP -http://www.wampserver.com/en/
    MAMP - http://www.mamp.info/en/index.html
    XAMPP - http://www.apachefriends.org/en/xampp.html

  • Dreamweaver: can i insert a background image in a layout table?

    i'm using a layout table and i can't figure out how to put a
    non-repeating image into the background of my layout table. is this
    possible? i need to center it too.

    Before anything else, I would say DON'T USE LAYOUT MODE.
    In my opinion, there are three serious problems with Layout
    Mode -
    1. Perhaps most importantly, it sits between you and *real*
    HTML tables,
    and fools you into believing that concepts like "layout cell"
    and
    "autostretch" really mean something. They do not. As long as
    you use
    Layout Mode, you'll never learn one of the most important
    things for new web
    developers - how to build solid and reliable tables.
    2. Actually, #1 wouldn't be *so* bad, except that the code
    that is written
    by Layout Mode is really poor code. For example, a layout
    table contains
    MANY empty rows of cells. This can contribute to a table's
    instability.
    In addition, if your initial positioning of the table's cells
    is a bit
    complex,
    Layout Mode will throw in col- and rowspans aplenty as it
    merges and splits
    cells willy-nillly to achieve the pixel-perfect layout you
    have specified.
    Again,
    this is an extremely poor method for building stable tables,
    because it
    allows
    changes in one tiny cell's shape (i.e, dimensions) to ripple
    through the
    rest
    of the table, usually with unexpected and sometimes
    disastrous consequences.
    This is one of the primary reasons for the final result's
    fragility - read
    this -
    http://apptools.com/rants/spans.php
    3. The UI for Layout Mode is beyond confusing - many options
    that you might
    want to use are inaccessible, e.g., inserting another table,
    or layer onto
    the page.
    I can understand the new user's desire to use this tool to
    make their life
    easier,
    but the cost is just too heavy in my opinion.
    To make good tables, keep it simple. Put a table on the page,
    and begin to
    load your content. If you would want a different table
    layout, instead of
    merging or splitting cells, consider stacking tables or
    nesting simple
    tables instead, respectively.
    And above all, do not try to build the whole page with a
    single table!
    Luckily, Adobe understands the problems created for the
    unsuspecting user
    who falls into this trap, and has elected to remove this
    feature altogether
    from the next version of DW. The time is right for you to
    begin working
    with tables properly!
    To read more about this approach, visit the DW FAQ link in my
    sig, and run
    through the table tutorials.
    Adobe agrees with this analysis - Layout mode is being
    removed from the next
    version of DW.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "dfgsdrsdr" <[email protected]> wrote in
    message
    news:[email protected]...
    > i'm using a layout table and i can't figure out how to
    put a non-repeating
    > image into the background of my layout table. is this
    possible? i need to
    > center it too.

  • Convert a catalog form PSE 7 to PSE 13 : Conversion works, but images are not related to the catalog anymore so you have to connect each single picture !!! How can I get the right relation automatically ?

    My images are not related to the converted catalog, only preview works, tags and other information is given, but the (network) path to the original images is missing and is substituted by a local path with c:\. How can I solve the problem automatically ?

    I actually need to apply this to at least a couple different layouts. Two exampled below (The outlined boxes are text areas, the black boxes where the product images will go.)
    I prefer InDesign5, but I have 6 too.

  • Why can I select text but not an image in my layout?

    Illustrator 5.5 question (working on a mac lion system) - Trying to create a file for my screen printer with 2 colors separated to create his screens.
    Problem - I am new to Illustrator. I created a 2 color layout with text and image in Photoshop and I saved it as an eps file. I opened it in Illustrator and I created 2 layers for each color. I can select the text but I cannot select the image to separate the colors? I used the select and direct select tool, but I still cannot select the image?
    What am I doing wrong?
    Keitodd29
    [email protected]

    Hi Jet,
    The artwork is 100% RGB. The art, text and image, are presently red with blue outline. Should I rasterize the image and convert it to 1-bit gray scale?
    Where do I determine the number of bits in gray scale?
    Concerning layers, I was following the tutorial Preparing Artwork for Screen Printing in Adobe Illustrator at this link. 
    http://www.smashingmagazine.com/2010/12/07/preparing-artwork-for-screen-printing-in-adobe- illustrator/ 
    Thanks!
    Keitodd29

  • Please help ! LAYOUT - PROBLEMS

    Hi !
    I have a big problem with using the rigth layoutmanager for my GUI.
    I have a JScrollPane and want to add several JPanels to it. These Panels should have to same width, but different height. So I used a GridBagLayout and it works good.
    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(10,2,5,2);
    JPanel inputPanel = new JPanel(layout);
    c.gridwidth = GridBagConstraints.REMAINDER;
    // add several lines to inputPanel
    JPanel line;
    line = new JPanel(new GridLayout(1,2));
    layout.setConstraints(line,c);
    inputPanel.add(line);
    line = new JPanel(new GridLayout(1,2));
    layout.setConstraints(line,c);
    inputPanel.add(line);
    line = new JPanel(new GridLayout(1,2));
    layout.setConstraints(line,c);
    inputPanel.add(line);
    scroll = new JScrollPane(inputPanel);
    But another property should be that the width should be tried on at the current size of the JScollPane. So I used a GridLayout and the width of my JPanel's were good, but of course they all had the same height.
    GridLayout layout = new GridLayout(0,1);
    JPanel inputPanel = new JPanel(layout);
    // add several lines to inputPanel
    JPanel line;
    line = new JPanel(new GridLayout(1,2));
    layout.setConstraints(line,c);
    inputPanel.add(line);
    line = new JPanel(new GridLayout(1,2));
    layout.setConstraints(line,c);
    inputPanel.add(line);
    line = new JPanel(new GridLayout(1,2));
    layout.setConstraints(line,c);
    inputPanel.add(line);
    scroll = new JScrollPane(inputPanel);
    Is there a possibility to have both properties ( different height and conformed width) ?
    Thanks very much for help !

    hi,
    Yes it's possible. keep working with the gridbaglayout.
    There are constraints where you can set X and Y behaviour like : every component must have the same width but own height. I don't know the constraint's name because I work with a visual gridbaglayout editor.
    Xavier

  • Help! My 300 dpi images are printing low quality!

    I've purchased print-ready images (300 dpi) from an extremely well-known stockphoto website to use in a brochure I'm creating.  On the brochure cover (which is 8.5" x 5.5"), I have placed 14 of these print-ready images.  (FYI-all of these print-ready images are pictures of people smiling while doing various activities.) 
    As you can imagine, I have had to reduce the scale of each of these print-ready images to approximately 1" x 0.7" to fit on the page.  The layout itself looks really nice, but when I attempt to create a .pdf using the "Print Booklet" option, all of my images look horrible!  I've also attempted to create a .pdf using the "Export" function and selecting "Press Quality" and my images are slightly better, but still look horrible!
    I have also re-scaled the images in Photoshop (leaving them at 300 dpi) and created a .tiff file, but no matter what I do (and I've been wrestling with this single problem for DAYS), I can't get these images to actually appear clearly on a printed page.  When I forwarded my brochure (in .indd, .pdf, and .eps formats) to a professional printing company, they came back to me telling me to use print-ready images.
    I've been working with print-ready images for well over a year and have sent multiple jobs to professional printers and this is the first time I've ever had a problem with images looking like they aren't print-ready.  Could it be that you can only reduce the size of an image so much?  Has anybody had this problem before???
    Thanks in advance for your input!

    Thanks for the comments thus far! I forgot to mention that all of my images are .jpegs (300dpi).
    I've reviewed my "Print Booklet" settings and under my "Images- Send Data,"  I have "All" selected as opposed to "Optimized Subsampling."  My Effective Resolution is also set at 300 dpi.
    I'm still working, and am open to more suggestions.
    Thanks!

Maybe you are looking for

  • "SYSTEM_FAILURE" error message when running BEX query

    Hello, I often encounter this error when I run BEX queries (take note that I encounter this error after I have already entered the query values). But when I run the same query in a later time, the query becomes successful, which makes the problem int

  • How do i get my contacts back without syncing it with itunes?

    How do i get my contacts back without syncing iphone to itunes

  • How can I make the pen lines invisible?

    I have made lots of edits with the pen tool, and I am noticing that the lines from the pen are a different color than what the shape is I made. Is there a way to make these lines from the pen invisible? Thanks so much for any help!

  • WEBI Capabilities

    I have an Excel Report that I need to create in WEBI.  I do not know how to recreat my days of supply function in WEBI: The report looks like this in Excel and below that is my function for Days of Supply.  Any help is appreciated. SNP PLAN        M

  • Backup error -30

    I try to update my Ipad to the new Os version 2.4 but it fails with the followings messages: 2010-11-27 14:00:52.301 [2904:c90]: iTunes: iTunes 10.1.0.56 2010-11-27 14:00:52.504 [2904:c90]: iTunes: Current software version: 7B500 2010-11-27 14:00:52.