Re: Setting the size of a display

Hi Tiago,

>  I created a  "DisplayImpl display = new DisplayImplJ3D("satdisplay");"
> and then i attached it to a panel in my application,
> "jpanel.add(satdisplay.getComponent());" now my problem is that the
> jpanel has a size of 800,600 and the display is only a small part of it
> but i want it to occupy the whole panel.
>  Anyone knows how i do this or how do i set a set a specified size for
> the display?

This is the usual Swing layout problems, rather than anything
specific to VisAD. I *think* you can solve your problem with
code like:

    JFrame frame = new JFrame("VisAD HSV Color Coordinates");
    frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {System.exit(0);}
    });

    // create JPanel in frame
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setAlignmentY(JPanel.TOP_ALIGNMENT);
    panel.setAlignmentX(JPanel.LEFT_ALIGNMENT);
    frame.getContentPane().add(panel);
    panel.add(display1.getComponent());

However, others know more than I do about Swing.

Good luck,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: