JSplitPane JTabbedPane Canvas resize problem

I am using a JSplitPane to separate a tree and a JTabbedPane containing java.awt.Canvas based objects.
I have not been able to find a way to resize the split plane over the tabbed pane. I pretty sure this
is because the Canvas is heavyweight and the split pane lightweight, but I cannot swap out the canvas
for a JPanel (or other swing equivalent) due to performance requirements. Is there a way to allow the
split pane to resize over the heavyweight object?
Below is a code snippet which illustrates what I'm trying to do. Any help would be greatly appreciated.
Thanks!
import javax.swing.*;
import java.awt.*;
public class TabTest
public static void main(String args[])
JFrame f = new JFrame("TabTest");
f.setSize(800,800);
JTree left = new JTree();
JTabbedPane right = new JTabbedPane();
Canvas canvas = new Canvas();
right.add("Canvas", canvas);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
f.getContentPane().add(splitPane);
f.show();
}

I am using gl4java's GLAnimCanvas as the canvas based object in my application. Since
the Swing based gl4java object is not hardware accellerated, it is way to too slow for my application
(a 3D gui ).

Similar Messages

  • Image resize problem

    For the life of me I can't figure out why this isn't working properly. I've been resizing images this way for months now and I must have changed some setting or whatever cause it simply doesn't work. Please be kind if I'm posting improperly as this is my first time posting here.
    Here's the situation. I have an image below at resolution 5000x2048.
    When I trim the canvas everything works properly as seen below.
    Due to the Trim canvas, the image is now 2071x1252. I want to resize the entire image to 1680 & keep proportions as shown below.
    Here's where I run into problems. I've never had it do this before, and I can't figure out how to fix it. When I resize the image, I get the following.
    As you can see, the canvas resized properly, but the vectors resized a whole lot smaller. Any help would be greatly appreciated.
    Message was edited by: A. Buskov

    That's perplexing. Just out of curiousity: Is everything a vector, or is it a mix of vectors and bitmaps? It appears that some of the components resized properly, where others did not.
    Since you know what dimensions you're shooting for, you could try reversing the order of things: resize, then trim. First figure out the percentage by which you were reducing the trimmed image size: 1680 / 2071 = 81.12%. Now apply that percentage to your initial image size: 5000 x 2048 becomes 4056 x 1661. Do the same sizing discrepancies occur? If not, then apply the Trim Canvas command, and you should be good to go.
    Alternatively, if you're resizing this graphic for output, you could simply use the Image Preview dialog instead (after trimming).
    Another troubleshooting idea: Have you tried saving the graphic immediately after applying the Trim command, and then resizing?
    Finally, how about using Modify > Transform > Numeric Transform... and then choosing either Resize or Scale?

  • Canvas resize stretches pixels of image content slightly when used :(

    Hi,
    I've a document that measures 3000 x 3000 pixels and I want to put an extra 600 pixels in height on it. I tried using canvas resize tool and it puts the extra pixels in height where I want them but it actually stretches the content very slightly. I noticed this because my artwork contains an image of planet earth from space and the globe gets stretched higher (only very slightly) in the direction of the new pixels. I've viewed it in various zooms including 50% and 100% and no success there either. Could it be a bug? best
    Paul

    Hi guys,
    Here are the screenshots...not sure I'm allowed to upload full size copies...I'll try
    I've also just been working on another piece of work and photoshop said there was a problem saving the file...I had to close it and lose all my work...could it be a bug with the download?
    I don't think I previously cropped the image with delete cropped pixels unchecked and when I did use the crop tool I only ever expanded the top section too. The only layer that extends beyond the canvas is the lightning layer at the top.
    Cheers
    Paul

  • [SOLVED] GNOME 3.8 annoying window resize problem

    Hello all fellow early-adopters :-)
    A very annoying quirk I've noticed, moving from GNOME 3.6 to 3.8, is that it no longer remembers, nor retains, the size/positions I set for many of my application windows. For example, my mail client (Evolution) is sized to fill most of my screen (centrally), with Empathy and Skype as long narrow windows on both sides - giving me a nice, broad "communications" overview on that particular desktop (with dev tools etc open on others).
    On 3.6, this layout was retained during my session, as well as next time I started these apps up.
    In GNOME 3.8, not only does it insist that these windows are always started as small little bunched-up windows that I need to resize, but every time a window displays a notification/warning (message in internal yellow bar inside the window - such as loss of internet connection, mail retrieval failure etc) it resizes the windows spontaneously to a stupid, small size that overlays the other windows. This is driving me crazy!
    Where can I learn a bit more about how window sizing / positioning works in GNOME 3.8, or is it finally time to switch to awesome wm? I want to love GNOME 3.8, I really do. It's so slick, but so... unpolished.
    I want to dig in an assist with problems like these, but I need some pointers to some background material first to understand the problem. Is it the window manager? Is it the app?
    ** UPDATE: Doing a full system upgrade, as of May 18, 2013, has resolved this annoying problem. My windows now stay where they belong, and start with the same size they were closed with. GNOME is now pleasant to use again :-)
    Last edited by dawid.loubser (2013-05-21 13:37:25)

    dawid.loubser wrote:Thanks for the suggestion drtebi - I'll give it a try.
    I really like GNOME 3.x though (and would like to understand the windowing behaviour), but if the annoying quirks are insurmountable, I will happily switch.
    Man I love GNOME 3.x. I admire the courage they had to change, basically, everything, and I find myself more productive with my GNOME 3 Arch box than with my good ol' Slackware KDE 4 box. I just hate those bugs - for example I filed a task in their bugtracker for this window resize problem I have with gedit. If it's a love/hate relationship, I think it's marriage ^_^
    With the 3.8 upgrade, deadbeef was having a similar problem with window size/position. I just recompiled it against the latest GTK+3 package upgrade (that came after the 'big upgrade' here on Arch) and it was fixed. But not with gedit
    bwat47 wrote:
    Man I really hope this gets fixed soon, because aside from this one incredibly annoying issue I am loving gnome 3.8.
    I get the feeling gnome badly needs more beta testers, sizable regressions like this in "stable" releases happen way too often sad.
    I get the exact same feeling. Well bugs exist everywhere, there's no denying. But I think it would be wiser to 'alternate' the nature of each major stable release - one focusing on new features and one focusing on fixing bugs. For example if the only new features in GNOME 3.10 were the AppsFolder full implementation and the introduction of gnome-calendar, and the rest of the development cicle being devoted to fix bugs, I'd be more than happy.
    Like Fedora and Ubuntu, the fixed 6-month release cycle colaborates with the bugs. They don't do like Debian or Slackware which are released 'when they are ready'.
    EDIT: fout (yet) another bug. At least with facebook chat (haven't tested with other telepathy plugins) the buddy tray icon appear duplicate. Anybody with the same issue?
    Last edited by lmello (2013-05-02 14:06:06)

  • Preview Application Resizing Problem

    Preview Application Resizing Problem
    Microsoft platforms have two significant advantages. The first is the concept of an operating system that can function with hardware that ranges from cellular phones to desktop computers. The second is that Microsoft has excellent software development tools
    for creating and testing computer programs.
    Software compatibility across hardware platforms requires not only meeting CPU and memory requirements. Application programs must be able to automatically adjust Window and control sizes to meet the needs of available window sizes, video display unit sizes
    and screen resolutions, switching between vertical and horizontal viewing, vertical and horizontal scrolling, changes in font sizes , and variations in the available screen space due to usage of vertical and horizontal toolbars.
     Software developers must be careful that resizing doesn’t squeeze controls too close together or make them so small that they cannot be finger or stylus selected when used with touch screens.
    Some of the required automatic resizing options are provided by the Microsoft software compilers and the Windows operating system.  Softgroup Component’s “.NET  Forms Resize” is an example of one of the third party applications that provide advanced
    resizing functionality.
    Many of the resizing functions are programmer options and, if not properly enabled, an application may not have the required resizing functionality. At the current state of the art, application programs are highly variable in their capability to do the “intelligent
    resizing” that is required to handle different display environments.
    A case in point is the Microsoft Preview Application for Windows 10. When entering lengthy comments, the send button becomes positioned off the end of the program window. It is possible to scroll to the button, but the display automatically resets when scroll
    is released. The result is that the text cannot be sent. You can try a "blind" TAB to the SEND button. This appeared to work after several tries, but the comment was apparently not received,
    RERThird

    Hi,
    What do you see when you open the same PDF file in Acrobat Reader? Are the words still squeezed than?
    Dimaxum

  • Illustrator Resizing Problems

    I am having reduction resizing problems in Illustrator CS6.  E.G. Straws & lemon wedge rinds become significantly proportionately wider when reduced.   Also, numerical text does not skew with everything else.  I have a CC membership w/PS & Ai installed.  There are no other Adobe items on my 8 month old imac, Lion 10.7.4 except Flash player & the Adobe Applications Manager.  Additionally, I have no 3rd party plug-ins & deleting the prefs file does not fix the problem.  Any help on this matter would be greatly appreciated. 

    sgem,
    And untick Align to Pixel Grid if ticked (you can do it in the Transform panel, or search for it in the Helpfile).
    Hi Steve. Still summer?

  • DV resize problem with QuickTime's iPod 320 x 240 export

    Just a heads up for those with new 5th generation iPods who plan on converting their DV movies for display on the iPod. It seems that the iPod 320 x 240 export does not resize DV correctly. Here is a link concerning this problem:
    Waymen, "Possible resize problem with iPod 320 x 240 Export?" #1, 03:02am Oct 13, 2005 CDT

    This article show a workaround to have DV export correctly in QuickTime Pro
    http://docs.info.apple.com/article.html?artnum=302955

  • JTabbedPane resize problem

    I have a JTabbedPane in a JPanel (BorderLayout.CENTER).
    That JPanel is the content component of a JOptionPane.
    The JOptionPane is in a JScrollPane which is in a JDialog.
    When the JDialog is resized (larger), the JTabbedPane enlarges too as desired.
    However, when the JDialog is resized (smaller), the JTabbedPane does not reduce in size consistently as one would wish.
    Any one know why, have a solution, etc.
    Any ideas appreciated.
    Thanks.

    I am using gl4java's GLAnimCanvas as the canvas based object in my application. Since
    the Swing based gl4java object is not hardware accellerated, it is way to too slow for my application
    (a 3D gui ).

  • Problem with image resize after canvas resize in CS6

    In previous versions I have been able to resize the canvas and then resize the image.  For example resize the canvas to 250px x 250 px.  Then resize the image to the same.
    Here is the process I am using:
    Duplicate the layer and then hide it. 
    Resize the canvas (Image > Canvas Size) to 250px x 250 px. 
    Un-hide the layer and then resize the image (Image > Image Size).  When I go into Image>Image Size it says that the image is already 250px x 250px.  However if I try to transform the scale the image is the original size and not 250px x 250px
    The reason for needing this is I resize image size (in bulk) and the canvas size using the batch process (file>automate>batch) and actions.   I loaded the actions file I used in previous versions, but that did not work correctly.  I then went in to do this manually and got the same results.
    Any ideas??

    Please post the Action set *.atn file and name of the action in the set. 
    What you wrote seems like normal operation.
    Duplicate the layer and then hide it. 
    Resize the canvas (Image > Canvas Size) to 250px x 250 px. 
    Un-hide the layer and then resize the image (Image > Image Size).  When I go into Image>Image Size it says that the image is already 250px x 250px.  However if I try to transform the scale the image is the original size and not 250px x 250px
    There is no reason to hide and unhide the layer.
    When you change Canvas Size the only layer the may actually get changed is the "Background Layer" for the bankground layer does not suppoty tranparency so Pixels of some color will be added to the background layer if your increasing canvas size or Pixels will be cropped off the background layer if you decreasing canvas size.  Canvas Size = Document Size = Image size.  Canvas size change does not change the size of other layer.  Only their position over the canvas may change.  Layers other then the background layer can be any size. They can be the same size as the canvas size or they may be larger or smaler then the canvas size and they can have any aspect ratio and any shape.  As you saw when you ise free transform on your layer.

  • JSplitPane resize problem (not a minimum size problem though)

    I created a JSplitPane and put a JPanel in both the top and bottom sides. This JSplitPane is in the center section of a BorderLayout of a JFrame. The minimum sizes are set and I can move the divider bar all I want. Instead, I am having trouble resizing the window and having the divider bar becoming shorter. When I resize the window, the width of the images dont become smaller even though they have a minimum size set to a minimal size and there is space in the panels that can be reduced.
    Here is the code that I am playing with to get this to work. Any ideas how to get this to work? It works in the SwingSet2 Demo, but there is so much extra junk in there that I cant determine the differences with what I'm doing.
    Thanks,
    J.R.
    import java.awt.*;
    import javax.swing.*;
    public class SplitPaneJFrame extends JFrame {
    JPanel statsPanel = new JPanel();
    JPanel northPanel = new JPanel();
    JPanel southPanel = new JPanel();
    JSplitPane splitPane;
    public SplitPaneJFrame () {
    setupGUI();
    private void setupGUI() {
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setSize(screenSize.width, screenSize.height - 64);
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    JPanel p1 = new JPanel();
    p1.setMinimumSize(new Dimension(100,100));
    p1.setPreferredSize(new Dimension(500,250));
    p1.setBackground(Color.yellow);
    p1.add(new Button("This is a button for the top area"));
    JPanel p2 = new JPanel();
    p2.setMinimumSize(new Dimension(100,100));
    p2.setPreferredSize(new Dimension(500,250));
    p2.setBackground(Color.red);
    p2.add(new Button("This is a button for the bottom area"));
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, northPanel, southPanel);
    splitPane.setOneTouchExpandable(true);
    northPanel.setLayout(new BorderLayout());
    northPanel.setMinimumSize(new Dimension(100,100));
    JPanel panel = new JPanel();
    panel.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
    panel.setPreferredSize(new Dimension((int)Math.min(1012, getSize().width * .75), (int)(getSize().height * 0.75)));
    panel.setMinimumSize(new Dimension(100,100));
    panel.add(p1);
    northPanel.add(panel);
    southPanel.setLayout(new BorderLayout());
    southPanel.setMinimumSize(new Dimension(100,100));
    southPanel.add(p2);
    splitPane.setDividerLocation(0.75);
    c.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
    c.setBackground(Color.white);
    JPanel jp = new JPanel();
    jp.add(splitPane);
    c.add(BorderLayout.CENTER, jp);
    setVisible(true);
    public static void main(String args []) {
    new SplitPaneJFrame();

    Hmm. Ok, that was dumb on my part :-) Sometimes you just need a second set of eyes.
    Any Idea why, after I make the fix, the top panel does not resize at all? The bottom one does, but the inner panels of the top do not. I added a second panel to the top and it flowed under the first one panel (p1) as the outter panel (northPanel) resized, but the inner panel stays the same size regardless of how much I narrow the window.
    J.R.

  • JSplitPane Resizing Problem

    Hi,
    I want to set divider location permanently to JSplipane.I dont want set minimum and maximum size to my top and bottom component.They can change size dynamically.Please help how to avoid resizing

    splitPane.setEnabled( false );Misread the question. The above prevents the user from dragging the divider. What you want is:
    splitPane.setResizeWeight(...);Message was edited by:
    camickr

  • JScrollPane resizing problem, I think...

    The Task
    I want to build a dialog that holds different option panels.
    Instead of using a JTabbedPane, I want to use a JTree to select among the different panels.
    I put the tree in a nice scroll pane, place the whole thing in the left side of
    the dialog. I think I have the logic down except for one thing...
    The Problem
    Whenever I click a node when the JTree is expanded, it resizes itself. It does this so that words that go off to the right can be seen.
    I don't want this to happen, but I do have to revalidate the main panel for it to change.
    Apparently, just revalidating the main panel revalidates everything.
    The Question
    Is there a setting in the JTree or the JScrollPane that stops this from happening?
    I have tried to change the LayoutManager, but the same thing happens with GridBagLayout.
    I'll put example code in the following post so you can see my issue. I put the most pertinent code to the front, so that you don't have to read too deeply.
    Can anyone advise me?
    Thanks.

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    import java.util.*;
    public class ScrollPaneProblem extends JDialog
       implements TreeSelectionListener
       private JButton jbClose;
       private JTree optionsTree;
       private MainPanel jpMain;
       private ActionListener terminator;
       public ScrollPaneProblem()
          // I would prefer that it stay this size.
          setSize( 535, 375 );
          setResizable( false );
          setTitle( "Preferences" );
          setupGui();
          setDefaultCloseOperation( DO_NOTHING_ON_CLOSE );
       protected void setupGui()
          Container contentPane = getContentPane();
             The left side of dialog will hold the option tree.
          optionsTree = buildTheTree();
          JScrollPane scrollPane = new JScrollPane( optionsTree );
          contentPane.add( scrollPane, BorderLayout.WEST );
             The center panel will hold another panel
             that changes according to what has been selected
             in the JTree.
          JPanel centerPanel = new JPanel( new BorderLayout() );
          Box bxButtons = buildTheButtonBox();
          centerPanel.add( bxButtons, BorderLayout.SOUTH );
          jpMain = new MainPanel();
          centerPanel.add( jpMain, BorderLayout.CENTER );
          contentPane.add( centerPanel, BorderLayout.CENTER );
       } // end setupGui()
          Changes the text on the main panel, according to what
          has been clicked in the JTree.
       public void valueChanged( TreeSelectionEvent evt )
          TreePath path = evt.getPath();
          Object obj = path.getLastPathComponent();
          if ( obj instanceof DefaultMutableTreeNode )
             DefaultMutableTreeNode node =
             (DefaultMutableTreeNode)obj;
             obj = node.getUserObject();
             // The problem happens when I do the following...
             jpMain.setText( obj.toString() );
             jpMain.revalidate();
             jpMain.repaint();
          } // end if ( a DefaultMutableTreeNode )
       } // end valueChanged( TreeSelectionEvent )
       private JTree buildTheTree()
          // First, build the parent nodes
          Object [] smurfNodes =
             "Smurfette", "Vanity", "Papa Smurf",
             "Greedy Smurf", "Lazy Smurf",
             "O.J., the ostracized orange smurf"
          ParentNode theSmurfs = new ParentNode(
                                  "The Smurfs", smurfNodes );
          Object [] dwarfNodes =
             "Doc", "Happy", "Dopey", "Sneezy",
             "Scratchy", "Sniffy", "Stuffy Head",
             "Fever", "So you can rest medicine"
          ParentNode theDwarfs = new ParentNode(
                                  "The Seven Plus Dwarfs", dwarfNodes );
          // These are all the nodes that go on the tree.
          Object [] theNodes =
             "Scooby Doo",
             "Inspector Gadget",
             "Mighty Mouse",
             "Captain Caveman",
             theSmurfs,
             theDwarfs
          JTree theTree = new JTree( theNodes );
          theTree.addTreeSelectionListener( this );
          return theTree;
       } // end buildTheTree()
       public Box buildTheButtonBox()
          Box box = Box.createHorizontalBox();
          box.add( Box.createHorizontalGlue() );
          // Make it so that we can close this JDialog.
          jbClose = new JButton( "Exit" );
          jbClose.addActionListener( terminator );
          box.add( jbClose );
          box.add( Box.createHorizontalGlue() );
          // help button that does absolutely nothing.
          JButton jbHelp = new JButton( "Help" );
          box.add( jbHelp );
          box.add( Box.createHorizontalGlue() );
          return box;
       } // end buildTheButtonBox()
       // Main entry point.
       public static void main( String [] args )
          JDialog dialog = new ScrollPaneProblem();
          dialog.setVisible( true );
       // So we can shut the dialog off
       static
          terminator =
          new ActionListener()
             public void actionPerformed( ActionEvent evt )
                System.exit( 0 );
    } // end ScrollPaneProblem class
       This MainPanel class goes in the middle of the dialog.
       My other program switches panels instead of using
       the same panel, but that's too much code to put here.
    class MainPanel extends JPanel
       String theText = "Tell me what to draw";
       Font theFont = new Font( "Sans Serif", Font.PLAIN, 12 );
       Dimension theSize;
       // Draws the selected text
       public void paintComponent( Graphics g )
          super.paintComponent( g );
          theSize = getSize( theSize );
          Font oldFont = g.getFont();
          g.setFont( theFont );
          g.drawString( theText, theSize.width / 10, theSize.height / 2 );
          g.setFont( oldFont );
       public void setText( String text )
          theText = text;
    } // end class MainPanel
       This helps with the JTree parent nodes.
    class ParentNode extends Vector
       String theName;
       public ParentNode( String name )
          this( name, null );
       public ParentNode( String name, Object [] values )
          theName = name;
          if ( values != null )
             addAll( Arrays.asList(values) );
       public String toString()
          return theName;
    } // end ParentNode class

  • Graph canvas size problem - missing rows

    Hi all,
    we have a simple horizontal bar graph based on a view, with just one total value pr. company showing.
    Problem is, if we set the canvas size too a small value, e.g. 400x400, then instead of resizing bars down so that all rows are shown, the graph starts to omit rows at the end!
    Even when enabling "Zoom and Scroll", we're still missing those rows.
    Only way to make sure all rows are displayed is to increase canvas size to a large enough value. Problem is, the number of rows is dynamic - so "big enough" might change over time....
    Is this a bug in the OBIEE graph component, or are we missing something here?
    Regards,
    -Haakon-

    hi,
    can anybody give me a hand.i'm in urgent!
    my request is how to display line graph according to the table rows.
    for example:in the table,i have 100 records(values),then the table range size is 10,so,each time when i scroll down the table,then graph will oso change to the another 10 records(values).
    while,i m adding the graph using jheadstart(10g).
    thank you very much.

  • A resize problem I have

    Hi all,
    I have a JTabbedPane with the first tab designed with Intellij's GUI designer. The JTabbedPane, the JPanel that fills the first tab and the JFrame containig the above components are all instantiated from the main class.
    I have a nother panel also designed in the GUI designer that I add as a new tab to my tabbedpane when the program starts runing.
    My problem is:
    The first tab (created and instantiated automaticaly) maintains proportions when the JFrame is resized.
    However, the add tab's content has a fixed size which I can't get to fill the tab.
    I tried the setSize method, I tried using GridBagLayout with GridBagConstraints and nothing, it won't resize.
    Can anyone help please?
    Thanks.

    This is why using a VE before you know how to do it yourself is usually a bad idea. Without code, we can't help you, but what is almost certainly the problem is the LayoutManager for that tab's contents and it's constraints are not setup to fill the available area.
    If you used GridBagLayout you'd have to at the very least set GridBagConstraints fill to BOTH.

  • Canvas3D within JSplitPane - can't resize

    I am trying to put a Canvas3D (which is first placed into a JPanel) within a JSplitPane to create some CAD-style editor. The problem is, that you can only make the Canvas3D bigger using the JSplitPane's separator, there seems to be no way to reduce its size again.
    I have searched the forum and found some people having the same problem, but no one found a solution yet.
    Does anyone know a way how to fix this?

    Hi,
    I seem to have the same problem. I tried overriding these methods in the extended Canvas3D class but still the Canvas3D resizes on its own during rendering and flickers. Is there any way to completely constrain the resizing of the Canvas3D?
    Thanks,
    Raghav
    Okay, it seems to be a known problem, and I found a
    simple rework. Overriding the getPreferredSize and
    getMinimumSize methods to return (0,0) will do the
    job.
    Still looking for sideeffects, though.

Maybe you are looking for