User-resizable JPanel within my frame?

Hi all,
I've got a JFrame which contains a bunch of content in FlowLayout. One of the components in my frame is a JPanel that has the potential to display a lot of content -- it's reading a webpage obtained from the user. The panel has a scroll-bar, of course, but if there is a lot of content the user would prefer to see a bigger panel.
Does anyone know of anyway to have an embedded JPanel use draggable borders so that they can re-size the panel at will? Naturally, everything in the panel and out of the panel should respect the new dimensions, and so components surrounding the panel in flowlayout, for example, should react accordingly.
Is this possible?
Thanks!
Tim

I could do that if I made my entire content pane a series of split panes, but I don't think that wouldn't really be a reusable solution (if I misunderstand what you meant, apologies).
What I'm hoping for is something that's a property of the JPanel component itself. That way I can insert this expandable JPanel anywhere and everything else ought to respect its resizing. If such a thing is impossible, then some solution that mimics that would be fine.
Any thoughts?

Similar Messages

  • Text wrap for a paragraph: How to define the width of a Text box /  active text area? I simply need a longish text to wrap within the frame!

    Hello, I've been searching for a good while in the forums now, but have found no solution or real mention of the problem – I hope some of you can help.
    I want to very simply layout a text between scenes, a slightly longer text that wraps within the frame margins. Here's an example of how I want it to look:
    Now, I couldn't for the life of me get the Custom Text to behave like that, as there are no parameters to set for the width of the text area. The Text Size, yes, along with the Tracking, Baseline and all that, but the width of the text box, no. The above was created by customizing one of the other Text Generator presets that happened to be left aligned.
    However, this preset has a fade in/fade out transition, which I do not want. There's no way to remove this transition as it seems integrated into the Text Generator (meaning they are not really presets, but separate kinds of Text objects? Very silly.)
    So I am asking you: Is there any way to get the Custom Text generator to behave like that? Just a text paragraph as above. Below you'll see all I can manage with the diffferent Custom Text parameters. Any kind of repositioning and resizing of the text just changes the position and size of the frame – but the actual text items are just cropped off where they extend out of that frame. Apparently the bounding box for the text is just some default length, and I can't find any way to adjust the width. See below my different attempts.
    The same text pasted into a Custom Text generator clearly extends outside the frame:
    Here Transform just moves – or resizes – the video frame that the Text Box exists inside:
    The Crop gives similar results, and of course Distort doesn't get me closer to what I need, either. There should be simply a Text Box Width parameter to set somewhere, but if it exists they have hidden it very well. How do you do it?
    Thanks for any help, this is a silly problem, but one of now many trivial problems that amount to me growing quite dissatisfied with FCPX. Hopefully I've just overlooked something.
    All the best,
    Thomas

    Thomas...same kind of crap here.
    I used Custom Text - entered a sentence, hit return, entered another.
    Set to 72 pt.
    The default alignment is centred - I want left aligned text...the text start point stays at the centre of frame and the sentence runs off the edge of the bounding box.
    There is no settings in the Text or Title inspector dialog to correct that!
    Using Transform will not sort it!

  • How to dynamically resize JPanel at runtime??

    Hello Sir:
    I met a problem, I need to resize a small JPanel called panel within a main Control JPanel (with null Layout) if I click the mouse then I can Drag and Resize this small JPanel Border to the size I need at runtime, I know I can use panel.setSize() or panel.setPreferredSize() methods at design time,
    But I have no idea how to do it even I search this famous fourm,
    How to dynamically resize JPanel at runtime??
    Can any guru throw some light or good example??
    Thanks

    Why are you using a null layout? Wouldn't having a layout manager help you in this situation?

  • How to resize JPanel at Runtime ??

    Hi,
    Our Project me t a problem as below, we hope to resize JPanel at Runtime , not at design time, ie, when we first click the button called "Move JPanel" , then we click the JPanel, then we can drag it around within main panel, but we hope to resize the size of this JPanel when we point to the border of this JPanel then drag its border to zoom in or zoom out this JPanel.
    Please advice how to do that??
    Thanks in advance.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.util.Vector;
    import javax.swing.*;
    import javax.swing.border.LineBorder;
    import javax.swing.event.*;
    public class ResizeJPanels extends JPanel
        protected JLabel label1, label2, label3, label4, labeltmp;
        protected JLabel[] labels;
        protected JPanel[] panels;
        protected JPanel selectedJPanel;
        protected JButton btn  = new JButton("Move JPanel");
        int cx, cy;
        protected Vector order = new Vector();      
         public static void main(String[] args)
            JFrame f = new JFrame("Test");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new ResizeJPanels().GroupJLabels());
            f.setSize(600,700);
            f.setLocation(200,200);
            f.setVisible(true);
         private MouseListener ml = new MouseAdapter() {  
              public void mousePressed(MouseEvent e) {   
                   Point p = e.getPoint();      
                   JPanel jp = new JPanel();
                   jp.setLayout(null);
                   Component[] c = ((JPanel)e.getSource()).getComponents();
                   System.out.println("c.length = " + c.length);      
                   for(int j = 0; j < c.length; j++) {        
                        if(c[j].getBounds().contains(p)) {     
                             if(selectedJPanel != null && selectedJPanel != (JPanel)c[j])
                                  selectedJPanel.setBorder(BorderFactory.createEtchedBorder());
                             selectedJPanel = (JPanel)c[j];            
                             selectedJPanel.setBorder(BorderFactory.createLineBorder(Color.green));
                             break;             
                        add(jp);
                        revalidate();
    public JPanel GroupJLabels ()
              setLayout(null);
            addLabels();
            label1.setBounds( 125,  150, 125, 25);
            label2.setBounds(425,  150, 125, 25);
            label3.setBounds( 125, 575, 125, 25);
            label4.setBounds(425, 575, 125, 25);
            //add(btn);
            btn.setBounds(10, 5, 205, 25);
                add(btn);
           determineCenterOfComponents();
            ComponentMover mover = new ComponentMover();
             ActionListener lst = new ActionListener() {
                 public void actionPerformed(ActionEvent e) {
                     ComponentMover mover = new ComponentMover();
                           addMouseListener(mover);
                           addMouseMotionListener(mover);
              btn.addActionListener(lst);
              addMouseListener(ml); 
              return this;
        public void paintComponent(final Graphics g)
             super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
             Point[] p;
            g2.setStroke(new BasicStroke(4f));
           for(int i = 0 ; i < order.size()-1; i++) {
                JPanel l1 = (JPanel)order.elementAt(i);
                JPanel l2 = (JPanel)order.elementAt(i+1);
                p = getCenterPoints(l1, l2);
                g2.setColor(Color.black);
               // g2.draw(new Line2D.Double(p[0], p[1]));            
        private Point[] getCenterPoints(Component c1, Component c2)
            Point
                p1 = new Point(),
                p2 = new Point();
            Rectangle
                r1 = c1.getBounds(),
                r2 = c2.getBounds();
                 p1.x = r1.x + r1.width/2;
                 p1.y = r1.y + r1.height/2;
                 p2.x = r2.x + r2.width/2;
                 p2.y = r2.y + r2.height/2;
            return new Point[] {p1, p2};
        private void determineCenterOfComponents()
            int
                xMin = Integer.MAX_VALUE,
                yMin = Integer.MAX_VALUE,
                xMax = 0,
                yMax = 0;
            for(int i = 0; i < labels.length; i++)
                Rectangle r = labels.getBounds();
    if(r.x < xMin)
    xMin = r.x;
    if(r.y < yMin)
    yMin = r.y;
    if(r.x + r.width > xMax)
    xMax = r.x + r.width;
    if(r.y + r.height > yMax)
    yMax = r.y + r.height;
    cx = xMin + (xMax - xMin)/2;
    cy = yMin + (yMax - yMin)/2;
    private class ComponentMover extends MouseInputAdapter
    Point offsetP = new Point();
    boolean dragging;
    public void mousePressed(MouseEvent e)
    Point p = e.getPoint();
    for(int i = 0; i < panels.length; i++)
    Rectangle r = panels[i].getBounds();
    if(r.contains(p))
    selectedJPanel = panels[i];
    order.addElement(panels[i]);
    offsetP.x = p.x - r.x;
    offsetP.y = p.y - r.y;
    dragging = true;
    repaint(); //added
    break;
    public void mouseReleased(MouseEvent e)
    dragging = false;
    public void mouseDragged(MouseEvent e)
    if(dragging)
    Rectangle r = selectedJPanel.getBounds();
    r.x = e.getX() - offsetP.x;
    r.y = e.getY() - offsetP.y;
    selectedJPanel.setBounds(r.x, r.y, r.width, r.height);
    //determineCenterOfComponents();
    repaint();
    private void addLabels()
    label1 = new JLabel("Label 1");
    label2 = new JLabel("Label 2");
    label3 = new JLabel("Label 3");
    label4 = new JLabel("Label 4");
    labels = new JLabel[] {
    label1, label2, label3, label4
    JLabel jl = new JLabel("This is resizeable JPanel at Runtime");
    jl.setBackground(Color.green);
    jl.setOpaque(true);
              jl.setFont(new Font("Helvetica", Font.BOLD, 18));
    JPanel jp = new JPanel();
    jp.setLayout(new BorderLayout());
    panels = new JPanel[]{jp};
              jp.setBorder(new LineBorder(Color.black, 3, false));
    jp.setPreferredSize(new Dimension(400,200));
    jp.add(jl, BorderLayout.NORTH);
    for(int i = 0; i < labels.length; i++)
    labels[i].setHorizontalAlignment(SwingConstants.CENTER);
    labels[i].setBorder(BorderFactory.createEtchedBorder());
    jp.add(labels[i], BorderLayout.CENTER);
    jp.setBounds(100, 100, 400,200);
    add(jp);

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.MouseInputAdapter;
    public class Resizing extends JPanel {
        public Resizing() {
            super(null);
            addPanel();
            PanelControlAdapter control = new PanelControlAdapter(this);
            addMouseListener(control);
            addMouseMotionListener(control);
        private void addPanel() {
            JLabel jl = new JLabel("This is resizeable JPanel at Runtime");
            jl.setBackground(Color.green);
            jl.setOpaque(true);
            jl.setFont(new Font("Helvetica", Font.BOLD, 18));
            JPanel jp = new JPanel();
            jp.setLayout(new BorderLayout());
            jp.setBorder(new LineBorder(Color.black, 3, false));
            jp.add(jl, BorderLayout.NORTH);
            jp.setBounds(50,50,400,200);
            add(jp);
        public static void main(String[] args) {
            JFrame f = new JFrame("Test");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new Resizing());
            f.setSize(500,400);
            f.setLocation(100,100);
            f.setVisible(true);
    class PanelControlAdapter extends MouseInputAdapter {
        Resizing host;
        Component selectedComponent;
        LineBorder black;
        LineBorder green;
        Point offset = new Point();
        Point start = new Point();
        boolean dragging = false;
        boolean resizing = false;
        public PanelControlAdapter(Resizing r) {
            host = r;
            black = new LineBorder(Color.black, 3, false);
            green = new LineBorder(Color.green, 3, false);
        public void mouseMoved(MouseEvent e) {
            Point p = e.getPoint();
            boolean hovering = false;
            Component c = host.getComponent(0);
            Rectangle r = c.getBounds();
            if(r.contains(p)) {
                hovering = true;
                if(selectedComponent != c) {
                    if(selectedComponent != null)  // reset
                        ((JComponent)selectedComponent).setBorder(black);
                    selectedComponent = c;
                    ((JComponent)selectedComponent).setBorder(green);
                if(overBorder(p))
                    setCursor(p);
                else if(selectedComponent.getCursor() != Cursor.getDefaultCursor())
                    selectedComponent.setCursor(Cursor.getDefaultCursor());
            if(!hovering && selectedComponent != null) {
                ((JComponent)selectedComponent).setBorder(black);
                selectedComponent = null;
        private boolean overBorder(Point p) {
            Rectangle r = selectedComponent.getBounds();
            JComponent target = (JComponent)selectedComponent;
            Insets insets = target.getBorder().getBorderInsets(target);
            // Assume uniform border insets.
            r.grow(-insets.left, -insets.top);
            return !r.contains(p);
        private void setCursor(Point p) {
            JComponent target = (JComponent)selectedComponent;
            AbstractBorder border = (AbstractBorder)target.getBorder();
            Rectangle r = target.getBounds();
            Rectangle ir = border.getInteriorRectangle(target, r.x, r.y, r.width, r.height);
            int outcode = ir.outcode(p.x, p.y);
            Cursor cursor;
            switch(outcode) {
                case Rectangle.OUT_TOP:
                    cursor = Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);
                    break;
                case Rectangle.OUT_TOP + Rectangle.OUT_LEFT:
                    cursor = Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR);
                    break;
                case Rectangle.OUT_LEFT:
                    cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
                    break;
                case Rectangle.OUT_LEFT + Rectangle.OUT_BOTTOM:
                    cursor = Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR);
                    break;
                case Rectangle.OUT_BOTTOM:
                    cursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
                    break;
                case Rectangle.OUT_BOTTOM + Rectangle.OUT_RIGHT:
                    cursor = Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR);
                    break;
                case Rectangle.OUT_RIGHT:
                    cursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
                    break;
                case Rectangle.OUT_RIGHT + Rectangle.OUT_TOP:
                    cursor = Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR);
                    break;
                default:
                    cursor = Cursor.getDefaultCursor();
            selectedComponent.setCursor(cursor);
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            if(selectedComponent != null) {
                Rectangle r = selectedComponent.getBounds();
                if(selectedComponent.getCursor() == Cursor.getDefaultCursor()) {
                    offset.x = p.x - r.x;
                    offset.y = p.y - r.y;
                    dragging = true;
                } else {
                    start = p;
                    resizing = true;
        public void mouseReleased(MouseEvent e) {
            dragging = false;
            resizing = false;
        public void mouseDragged(MouseEvent e) {
            Point p = e.getPoint();
            if(dragging || resizing) {
                Rectangle r = selectedComponent.getBounds();
                if(dragging) {
                    r.x = p.x - offset.x;
                    r.y = p.y - offset.y;
                    selectedComponent.setLocation(r.x, r.y);
                } else if(resizing) {
                    int type = selectedComponent.getCursor().getType();
                    switch(type) {
                        case Cursor.N_RESIZE_CURSOR:
                            r.height -= p.y - start.y;
                            r.y = p.y;
                            break;
                        case Cursor.NW_RESIZE_CURSOR:
                            r.width -= p.x - start.x;
                            r.x = p.x;
                            r.height -= p.y - start.y;
                            r.y = p.y;
                            break;
                        case Cursor.W_RESIZE_CURSOR:
                            r.width -= p.x - start.x;
                            r.x = p.x;
                            break;
                        case Cursor.SW_RESIZE_CURSOR:
                            r.width -= p.x - start.x;
                            r.x = p.x;
                            r.height += p.y - start.y;
                            break;
                        case Cursor.S_RESIZE_CURSOR:
                            r.height += p.y - start.y;
                            break;
                        case Cursor.SE_RESIZE_CURSOR:
                            r.width += p.x - start.x;
                            r.height += p.y - start.y;
                            break;
                        case Cursor.E_RESIZE_CURSOR:
                            r.width += p.x - start.x;
                            break;
                        case Cursor.NE_RESIZE_CURSOR:
                            r.width += p.x - start.x;
                            r.height -= p.y - start.y;
                            r.y = p.y;
                            break;
                        default:
                            System.out.println("Unexpected resize type: " + type);
                    selectedComponent.setBounds(r.x, r.y, r.width, r.height);
                    start = p;
    }

  • Editing timelapses in Lightroom- looks very different if there´s a small change within the frame

    Hi
    We´re having some serious issues with editing timelapses in Lightroom (5.6). What seems to happen over and over again, is that if there´s a small change within the frame (such as a bird flying past, people walking), the editing result varies greatly compared to the previoius frame. It´s easiest to understand what I mean by viewing the examples below.
    Here there´s one picture without a boat in the frame, and a few seconds later there´s a boat in a small part of the frame. The camera is set to full manual, and the two JPGs which show the unedited pictures shows that the background and sky in both pictures look exactly the same. However, after pasting the same editing setting on both pictures, the picture with the boat looks vastly different (shadow areas are much darker). It´s the same result weather it is a white boat, a black bird or a person walking in/out of the frame. The picture gets much darker, and leads to some serious flicker in the timelapse which can be impossible to get rid of.
    I assume that as there´s a small change in the histogram when the boat enters the frame, this change affects what Lightroom thinks of as shadows/highlights on so on? The example below has some heavy editing applied (shadows up, highlights down, clarity). You can see the settings that have been adjusted in the screenshots below. Does LR change what it considers shadows/highlights based on the histogram, or are there standard settings? If this is the case, it would be much better for timelapsers if Lightroom had standard values for what is considered shadows/highlights, so that two pictures where the only difference is a person walking on the street or not, would look the same with the same editing settings applied. What I find strange if LR works like I´m asking here, why does the picture get darker whether it is a white boat or a black bird changing the histogram slightly. Shouldn´t they then have the opposite effect of each other?
    Any ideas what is causing the difference, and what I can do about it? Thanks!

    In these forums you are only talking to other users like yourself, not Apple. Be sure to repost your info in the channel Apple has set up for it:
    http://www.apple.com/feedback/imovie_iOS.html

  • Making a customable resizable JPanel, but it only works in certain L&F

    Hi,
    I have created the following resizable JPanel (so that I can set a minimum size it can be dragged to).
    However, I need it to work under the system L&F, which is XP, but it wont work.
    The code is below. if you run it the first time, and try to resize the dialog to a small value, you will see it shrinks in size, to a certain point.
    then if you comment out the 2 lines i specified, and run it again, it wont. Anyone have any ideas? is this a known bug?
    import javax.swing.*;
    import java.awt.event.ComponentListener;
    import java.awt.event.ComponentEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.*;
    public class ResizeTest extends JDialog {
         public ResizeTest(JFrame owner) {
              super(owner);
              this.addComponentListener(resizeListener);
              /* comment out the following 2 lines */
              setUndecorated(true);                  
            getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
         private ComponentListener resizeListener = new ComponentListener() {
              public void componentHidden( ComponentEvent i_e ) { }
              public void componentMoved( ComponentEvent i_e ) { }
              public void componentResized( ComponentEvent i_e ) {
                   int width = ResizeTest.this.getWidth();
                   int height = ResizeTest.this.getHeight();   
                  if( width < 50 ) { width = 50; }
                   if( height < 50 ) { height = 50; }
                   ResizeTest.this.setSize( width, height );
             public void componentShown( ComponentEvent i_e ) { }
         private static void test() {
              final JFrame frame = new JFrame();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JButton launchButton = new JButton("showDialog");
              frame.setContentPane(launchButton);
              final ResizeTest testDialog = new ResizeTest(frame);
              testDialog.setMinimumSize(new Dimension(300, 300));
              testDialog.setSize(500, 500);
              testDialog.setPreferredSize(new Dimension(500, 500));
              launchButton.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        testDialog.pack();
                        testDialog.setVisible(true);
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        frame.pack();
                        frame.setVisible(true);
         public static void main(String[] args) {
              test();
    }

    okay... I see what the problem is.
    1) With those lines uncommented: The L&F is handling the window decorations. Because of this, it's basically a JWindow with custom painting and mouse handling. When you resize, it's constantly calling setSize, which constantly firing events, so your minimum sizing works as you expect.
    2) With those lines commented: The OS is handling the window decorations. Because of this, there are 2 caveats:
    a) There is a minimum width of the window of what looks like about 120-130 pixels. So you can't go any smaller then that for width. And for height, no smaller then the titlebar and lower border.
    b) It only fires the component events when the mouse is released, cuz that's how the undelying native windows deal with it... or at least with Java.
    For #1 above, there's still a minimum size for the L&F decorated windows. But this is related to what content is showing in the titlebar. Which in the case of the decorations showing, is smaller then what your were defining as a minimum.
    So, basically, it's not a bug. It's just the way it is. It's always been like this.

  • Crop and Resize photo within the COD service in ESS

    Anyway to crop and resize photo within the COD webdynpro java component in ESS?

    No what i mean is how to allow the user to upload a photo using the COD service but also allow them to crop and resize the image as documented here:
    [How to Add Image Crop and Resize Capabilities in Web-Based Applications|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10ab79a4-1fc2-2b10-29bb-ef9ff6771e72]
    The solution above does not use the webdynpro COD service in ESS, it is a portal component with embedded JavaScript which also only stores the photo on portal only (not the infotype in ECC).  I guess I need to figure out how to add these javascript files to the webdynpro COD service in ESS.  Although I don't think Webdynpro Java allows you to add javascript.

  • Duplicate spread causes some text to shift within its frame

    Hi,
    Indesign CS5 problem:
    When I duplicate the first page of my working document some text shifts vertically within its frame on the duplicate page.
    The same thing happens if I copy the text box and paste in place, the shift also occurs.
    This is a small grab of the file with the 1st page on the left and the duplicate page (or paste in place) on the right.
    Its driving me nuts, any help much appreciated.
    Cheers
    Dave

    Aha, you have got somewhere then!  Something is causing that type to shift, why it isn't in your original doesn't matter, the idml one is "cleaner" and now the behaviour makes sense in that both frames are bahaving the same.  There must be something somewhere, I assume you've checked the baseline shift in the control panel?
    If you are sure it's nothing like that it's time to replace your preferences, see the link here.

  • How do I fit a picture within a frame layer?

    How do I fit a picture within a frame layer?

    If your images are an aspect that does not fit easily into
    a standard video frame, you might need to scale up
    (or preferably down) and reposition your images to fit.
    What are your image dimensions?
    What are your Sequence settings?
    What is the intended destination for your finished video?
    Premiere Pro / Motion: position, scale, and rotate a clip
    http://help.adobe.com/en_US/premierepro/cs/using/WSC7A162B6-6EF1-49e1-8622-8127366710BB.ht ml
    How do I choose the right sequence settings?
    http://www.video2brain.com/en/lessons/how-do-i-choose-the-right-sequence-settings
    Also, make sure you're running the most current update (CS6.0.5).
    Within Premiere:  Help > Updates...

  • Cannot attach User property set within a Rule set

    Hi,
    I cannot attach a user property set within a rule set. When i create a new
    rule set in the tools it doesnt give me a field to attach a User property
    set to a rule set. I dont get this.
    I am using WLCS 3.2, cloudscape, WL 5.1 SP 6, Win2000.
    Any help wud be greatly appreciated.

    Hello Kapil,
    This is a good thing. Allow me to convince you. Prior to WLCS 2.0.1 sp1,
    each rule set required that a property set be associated with it. Rules in
    that rule set could only use properties from that property set. You could not
    write a rule that used properties from multiple property sets. Therefore, it
    was impossible to combine user/group, session, and request properties in
    rules. It is a good thing that you don't have to associate a property set
    with the rule set anymore.
    kapil wrote:
    Hi,
    I cannot attach a user property set within a rule set. When i create a new
    rule set in the tools it doesnt give me a field to attach a User property
    set to a rule set. I dont get this.
    I am using WLCS 3.2, cloudscape, WL 5.1 SP 6, Win2000.
    Any help wud be greatly appreciated.--
    Ture Hoefner
    BEA Systems, Inc.
    2590 Pearl St.
    Suite 110
    Boulder, CO 80302
    www.bea.com

  • Wait for resizing JPanel

    nice day,
    during rezize JFrame simultaneously changing the size of JFrame Childs, how to stop, pause or wait for that and resize JFrame Childs just one time
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    import javax.swing.border.EmptyBorder;
    public class PaintPanels extends JFrame {
        private static final long serialVersionUID = 1L;
        private final JPanel fatherPanel = new JPanel();
        private SomePanel centerPanel;
        private SomePanel northPanel;
        private SomePanel southPanel;
        public void makeUI() {
            centerPanel = new SomePanel();
            northPanel = new SomePanel();
            southPanel = new SomePanel();
            centerPanel.setName("centerPanel");
            northPanel.setName("northPanel");
            southPanel.setName("southPanel");
            northPanel.setPreferredSize(new Dimension(1020, 170));
            centerPanel.setPreferredSize(new Dimension(1020, 300));
            southPanel.setPreferredSize(new Dimension(1020, 170));
            fatherPanel.setLayout(new BorderLayout(5, 5));
            fatherPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
            fatherPanel.add(northPanel, BorderLayout.NORTH);
            fatherPanel.add(centerPanel, BorderLayout.CENTER);
            fatherPanel.add(southPanel, BorderLayout.SOUTH);
            setLayout(new BorderLayout(5, 5));
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            add(fatherPanel, BorderLayout.CENTER);
            pack();
            setVisible(true);
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    new PaintPanels().makeUI();
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.BorderFactory;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class SomePanel extends JPanel {
        private static final long serialVersionUID = 1L;
        private GradientPanel titlePanel;
        protected JLabel titleLabel;
        int borderOffset = 2;
        public SomePanel() {
            setLayout(new BorderLayout(5,5));
            setBorder(BorderFactory.createLineBorder(Color.gray, 1));
            addMouseListener(new MouseListener() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    Component comp = e.getComponent();
                    String compName = comp.getName();
                    System.out.print("Mouse click from " + compName + "\n");
                @Override
                public void mousePressed(MouseEvent e) {
                @Override
                public void mouseReleased(MouseEvent e) {
                @Override
                public void mouseEntered(MouseEvent e) {
                @Override
                public void mouseExited(MouseEvent e) {
            titleLabel = new JLabel("  Welcome World  ", JLabel.LEADING);
            titleLabel.setForeground(Color.darkGray);
            titlePanel = new GradientPanel(Color.black);
            titlePanel.setLayout(new BorderLayout());
            titlePanel.add(titleLabel, BorderLayout.WEST);
            titlePanel.setBorder(BorderFactory.createEmptyBorder(borderOffset, 4, borderOffset, 1));
            titlePanel.setBorder(BorderFactory.createLineBorder(Color.lightGray));
            titlePanel.setMinimumSize(new Dimension(300, 25));
            titlePanel.setPreferredSize(new Dimension(800, 25));
            titlePanel.setMaximumSize(new Dimension(1200, 25));
            add(titlePanel, BorderLayout.NORTH);
    import java.awt.Color;
    import java.awt.GradientPaint;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Paint;
    import javax.swing.JPanel;
    class GradientPanel extends JPanel {
        private static final long serialVersionUID = 1L;
        public GradientPanel(Color background) {
            setBackground(background);
        @Override
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            if (isOpaque()) {// Color controlColor = UIManager.getColor("control");
                //Color background = new Color(44, 61, 146);
                //Color controlColor = new Color(168, 204, 241);
                Color background = new Color(168, 210, 241);
                Color controlColor = new Color(230, 240, 230);
                int width = getWidth();
                int height = getHeight();
                Graphics2D g2 = (Graphics2D) g;
                Paint oldPaint = g2.getPaint();
                g2.setPaint(new GradientPaint(0, 0, background, width, 0, controlColor));
                //g2.setPaint(new GradientPaint(0, 0, getBackground(), width, 0, controlColor));
                g2.fillRect(0, 0, width, height);
                g2.setPaint(oldPaint);
    }

    nice day,
    could you hepl me with some definitions, still I can't to define gap for first and last of JLabel (matrix), is there some hack for GridBagLayout,
    hmmm, interesting that if I replace South JPanel and put there JPanet that contains only JButtons, then that's/just only this one (JPanel) doesn't any problems with synchronizations for repaint with JFrame,
    result is: resize isn't smooth, Border jump, resize breaking,
    already at a fraction of JComponents that I would like to display,
    I certainly know that the reason is the LCD display, where its native resolution makes a huge problem with the edge of Border and FontSize, 'glass screen' doesn't suffering from similar diseases,
    so there my question is how to stop the refresh, resize JPanels with its parents, therefore wait until the resize event ends on JFrame
    import java.awt.*;
    import javax.swing.*;
    public class ChildPanel extends JPanel {
        private static final long serialVersionUID = 1L;
        public ChildPanel() {
            JLabel hidelLabel;
            JLabel firstLabel;
            JTextField firstText;
            setLayout(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
            for (int k = 0; k < 50; k++) {
                hidelLabel = new JLabel("     ");
                //hidelLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
                gbc.fill = GridBagConstraints.HORIZONTAL;
                gbc.weightx = 0.5;
                gbc.weighty = 0.5;
                gbc.gridx = k;
                gbc.gridy = 0;
                add(hidelLabel, gbc);
            for (int k = 0; k < 5; k++) {
                firstLabel = new JLabel("Testing Label : ", SwingConstants.RIGHT);
                firstLabel.setFont(new Font("Serif", Font.BOLD, 20));
                firstLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
                gbc.fill = GridBagConstraints.HORIZONTAL;
                //gbc.ipady = 0;       //reset to default
                //gbc.weighty = 1.0;   //request any extra vertical space
                //gbc.anchor = GridBagConstraints.PAGE_END; //bottom of space
                gbc.insets = new Insets(0, 0, 5, 0);  //top padding
                gbc.gridx = 0;       //aligned with JLabel 0
                gbc.gridwidth = 8;   //8 columns wide
                gbc.gridy = k + 1;
                add(firstLabel, gbc);
            for (int k = 0; k < 5; k++) {
                firstText = new JTextField("Testing TextField");
                firstText.setFont(new Font("Serif", Font.BOLD, 20));
                firstText.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
                gbc.fill = GridBagConstraints.HORIZONTAL;
                gbc.insets = new Insets(0, 0, 5, 0);
                gbc.gridx = 9;
                gbc.gridwidth = k + 8;
                gbc.gridy = k + 1;
                add(firstText, gbc);
            for (int k = 0; k < 5; k++) {
                firstLabel = new JLabel("Testing Label : ", SwingConstants.RIGHT);
                firstLabel.setFont(new Font("Serif", Font.BOLD, 20));
                firstLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
                gbc.fill = GridBagConstraints.HORIZONTAL;
                gbc.insets = new Insets(0, 0, 5, 0);
                gbc.gridx = 20 + k;
                gbc.gridwidth = 8;
                gbc.gridy = k + 1;
                add(firstLabel, gbc);
            for (int k = 0; k < 5; k++) {
                firstText = new JTextField("Testing TextField");
                firstText.setFont(new Font("Serif", Font.BOLD, 20));
                firstText.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
                gbc.fill = GridBagConstraints.HORIZONTAL;
                gbc.insets = new Insets(0, 0, 5, 0);
                gbc.gridx = 29 + k;
                gbc.gridwidth = 21 - k;
                gbc.gridy = k + 1;
                add(firstText, gbc);
    import java.awt.*;
    import javax.swing.JPanel;
    class GradientPanel extends JPanel {
        private static final long serialVersionUID = 1L;
        public GradientPanel(Color background) {
            setBackground(background);
        @Override
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            if (isOpaque()) {
                Color background = new Color(168, 210, 241);
                Color controlColor = new Color(230, 240, 230);
                int width = getWidth();
                int height = getHeight();
                Graphics2D g2 = (Graphics2D) g;
                Paint oldPaint = g2.getPaint();
                g2.setPaint(new GradientPaint(0, 0, background, width, 0, controlColor));
                g2.fillRect(0, 0, width, height);
                g2.setPaint(oldPaint);
    }

  • I need to insert a fade to black within a frame of footage.

    I need to insert a fade to black effect within a frame of footage. The raw footage simply cuts to black, and I want to edit it so that it fades out within the same frame. Thanks for helping!

    cass516 wrote:
    this method sounds like a PAIN but of course i have no choice but to try it.  Why would Pages make such a simple thing so troublesome?  in other programs, you simply click 'insert file'.
    The only thing odd about Pages' Insert file is that it doesn't do its own format.
    You obviously think that MsWord is "The Norm" but I found really odd things that it won't do. To the point I, like others here, can't be bothered trying to drive the Word square peg into the Mac round hole.
    Mostly Pages works by drag and drop, I'm puzzled why that doesn't work with the thumbnails. But then there are quite a few oddities in every program. Pages is far from an exception.
    Peter

  • Targeting Webhelp within a frame set

    Our Webhelp runs within a frame set. The lower frame displays
    a copyright note and the upper frame (named, say, abc) displays the
    actual webhelp - no problem so far.
    The problems arise when I try to reference the webhelp in toc
    entries. When I include target="_top" then all is fine, except of
    course that the lower frame dissappears and the webhelp is displayd
    on top level which I dont want. But when I include target ="abc"
    (or whatever the frame name is) then the target attribute is simply
    ignored by the webhelp script. BUT, if I include target ="def" - an
    undefined frame name - then a new browser window is opened
    correctly. The target attribute is only ignored when is addresses
    an EXISTING frame name.
    Any ideas on this or is it simply though luck?

    Hello Robert -
    Why not include the copyright note into the top-right frame
    of RoboHelp by the "Powered By" - or try what we do and have the
    copyright info as part of the "Powered By" pop-up (we changed the
    name to "About IRIS" where IRIS is the project name).
    Regards,
    GEWB

  • [JS] CS4 How to position a graphic within a Frame

    I have a JS script that I am converting from CS3 to CS4 and I am finding that the behaviour for positioning a graphic within a frame has changed.  I have code that sets the geometric bounds of a graphic to a negitave value within the frame, within CS3 this works great.  However using the same code on CS4 to set the geometric bounds does not produce the same result.  The graphic is always placed at 0,0 and it ignores the negitive top and left values supplied.
    Does anyone know what has changed with the geometric bounds of a graphic within a recrangle frame?  How would I set the position of the graphic within the frame since setting the geometric bounds does not seem to work any longer.
    Thanks,
    Sheldon

    I have yet to determine why the behavior is different from CS3 to CS4 and how to correct the positioning within CS4.  To help explain the problem further I have included a sample script which demonstrates the problem.  I have run the script on both CS3 and CS4 and included screen shots of the results when the resulting INDD file is opened.  Could someone help explain why the position of the image is wrong in CS4 and what I can do to correct the problem?
    Here is the sample script ...
    for(i=app.documents.count()-1;i>=0;i--){app.documents.item(i).close();}
    app.textPreferences.useOpticalSize = false;
    app.textPreferences.typographersQuotes = false;
    app.textImportPreferences.useTypographersQuotes = false;
    app.taggedTextImportPreferences.useTypographersQuotes = false;
    app.pasteboardPreferences.minimumSpaceAboveAndBelow = "300p";
    app.textFramePreferences.firstBaselineOffset = FirstBaseline.ascentOffset;
    app.colorSettings.cmsSettingsPath = File("C:\\etc\\Friesens_Yearbook_Custom_Color_Settings.csf");
    app.marginPreferences.top = '24pt';
    app.marginPreferences.bottom = '48pt';
    app.marginPreferences.left = '36pt';
    app.marginPreferences.right = '36pt';
    var doc = app.documents.add();
    doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
    doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
    doc.documentPreferences.pageHeight = 792;
    doc.documentPreferences.pageWidth = 612;
    doc.documentPreferences.pageOrientation = PageOrientation.portrait;
    doc.documentPreferences.pagesPerDocument = 2;
    doc.documentPreferences.facingPages = true;
    doc.sections.firstItem().continueNumbering = false;
    doc.sections.firstItem().pageNumberStart = 2;
    var pg = doc.pages.item(0);
    var frm = pg.rectangles.add();
    frm.geometricBounds = ['200.5pt','200.2pt','447.8551pt','415.5206pt'];
    try{frm.place (File('c:\\test.jpg'), false);}catch(err){};
    if(frm.graphics.count() > 0) {frm.graphics.firstItem().geometricBounds = [frm.geometricBounds[0]-147, frm.geometricBounds[1]-49, 407.04+frm.geometricBounds[0]-147, 271.68+frm.geometricBounds[1]-49];};
    var objStyle = doc.objectStyles.add();
    objStyle.enableStroke= false;
    objStyle.transparencySettings.blendingSettings.opacity = 100;
    frm.applyObjectStyle(objStyle, true, true);
    frm.rotationAngle = 59;
    doc.label = '824203.indd';
    doc.packageForPrint('c:\\test\\824203\\', true, true, true, true, true, false, '', false, false);
    for(i=app.documents.count()-1;i>=0;i--){app.documents.item(i).close();}
    The line that I highlighted is the one that adjusts the images position within its frame.  It uses a formula to determine the exact position relative to the containing frames position.  This is why you will see the calculations to determine the geometric bounds.
    Here is the result of the script using InDesign Server CS3, notice the position of the image based on the 'Direct Selection Tool' highlight area (this is the desired result):
    And, here is the result after running the script against InDesign Server CS4:
    As you can see the Image is placed at the lot left corrner of the frame which is wrong.  Any insight into the diffrences in the behavior would be appreciated.
    Thanks

  • How to resize a JPanel within another JPanel

    I have a JApplet that contains contains a JPanel which has several other components on the JPanel.
    The JApplet is an image query front-end which can be used to find images based on a single geographic point, a geographic rectangle or a geographic point and a radius (in meters). I have a JComboBox that the user uses to select which type of query they would like to perform. To enter the query information, I have a separate JPanel that contains the query parameters.
    For the single geographic point, it is just a simple row with JLabels and JTextFields for the latitude and longitude.
    For the rectangle, it is essentially a 3x3 grid to handle the JLabels and JTextFileds for the latitude and longitude of the upper left and lower right corners.
    For the geographic point and radius, I reuse the JPanel for the single geographic point and add a new row for the radius.
    In my ChangeListener for the JComboBox, I first call parentPanel.remove (queryPanel) then call a method to create the specific queryPanel and call parentPanel.add (queryPanel). The only thing that happens when I change the JComboBox to a different query type is the portion of the queryPanel that was covered by the selection of the JComboBox never gets repainted and doesn't change to the new queryPanel.
    I wish I could provide code examples, but the computer that I am developing on is not on the Internet and it is extremely difficult to get anything off of it to put out on the Internet.
    Hopefully, someone can help me figure out what is going on and why my parentPanel is not updating to reflect the new queryPanel.

    GoDonkeys wrote:
    Sorry, but what is the EDT?Please start here: [Concurrency in Swing|http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html]

Maybe you are looking for