Programatically resize controls at runtime

I have a series of controls on a GUI and a GUI that I want to be able to resize according to the machine that is running the program.
Basically my logic is this. A GUI can fill most of the available display space, but not all, and must never be shown on a monitor that it is not designed for.
Currently my Laptop is having display issues and keeps chaning the resolution thus hiding parts  of my GUI.
I want to resize (and position all visible controls and indicators - I know which ones they are) so that my GUI fits in a know space on certain default screen resolutions. (800x600, 1024x768 and 1280x1024)
I can get the position and bounds of a control, but I can't change the bounds of a control (generic) with the property node. This is frustrating. as one of my controls is a large Multicolumn listbox which takes up most of the display and definitely needs resizing according to screen resolution.
Any ideas?
James
Solved!
Go to Solution.

unbundling from your cluster would be simplest, yes.
I think in general though you could be better served by keeping it simple and letting the user deal with the front panel.  Leave the scrollbars visible, let the user resize the panel.  Look at the bounding box of the pane and initially resize the window to fit the contents rather than the other way around.  I only like to lock down the window if it's to be a terminal type application (only thing running, I know the hardware at dev time, etc.)
There are some other ways to resize things, too.  I'm sure you've seen the "scale with pane" and "fit to pane" options.  I've always been unsatisfied with the former, but the latter is pretty nice when combined with splitters, especially if you camouflage the splitter and get the various splitter options right.
Check out the UI of VI Package Manager to see a nice MCL that resizes as you resize the window.  I think JKI even have a how-to-video that might show it....found it: http://forums.jkisoft.com/index.php?showtopic=988
and for an extra tidbit, check out these properties:
 the top one gives you the resolution of each monitor on the system (mine shows 1680x1050) the bottom one gives you the workspace rectangle of the main monitor (and mine shows (0,1680),(0,990) which shows that the last 60 pixels there at the bottom are taskbar)
These should be useful for checking what the available space is for dynamically sizing things. 
-Barrett
CLD

Similar Messages

  • 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;
    }

  • How to dynamically enable or disable a control's runtime shortcut menu?

    Is there a way to do it?  
    I need to disable a control's runtime menu while my VI is running and then enable it at other point of time.  All the way, I can make use of the default menu items (Reinitialize to default values, Copy data etc..,) for the control and I don't have any customized menu items.

    GerdW wrote:
    Hi Ajay,
    as a quick & dirty way you could use a filter event for mouse clicks. When you want to disable the right-click menu you filter the right-click mouse events…
     Thats nice dirty idea.  But it might give my end-user an impression that my application doesn't respond to the given options.  I specifically want to greyout the right-click menu.
    Thanks,
    Ajay.

  • Bottom right corner resize controls trump vertical scroll button if set to appear in the bottom corner

    My bottom right corner square of the Firefox window normally sits below the bottom of the vertical scroll bar and right of the horizontal scroll bar if one exists. The square is used to click and drag to resize the window's right and bottom boundaries.
    At issue is when a web site places its vertical scroll down-arrow button in the bottom right corner. I cannot access the down-arrow button with my mouse to cause the page to scroll down a few lines at a time because when I point the mouse there, I get the resize controls instead. Even though the down-arrow button is plainly visible on the screen, the resize controls take charge and I cannot use the scroll control.
    Two example web sites display their down-arrow control at the very bottom of the window; TIME.com and GMAIL.com. I have also viewed two PDF documents in the browser, and they too, have a vertical scroll bar all the way to the bottom, and I cannot use that down-arrow button because instead I get the northwest-southeast click-to-resize cursor instead of the mouse pointer when I attempt to use that button for scrolling.
    Someone on the Google Help forum was not able to replicate that issue, showing me screenshots of his lower right corner mouse behavior. He does not have the resize control covering access to the scroll bar.
    I am using the latest Firefox, I have reset Firefox, thus dumping all of my add-ons and custom settings, and have only put back AdBlock Plus and Cookie Monster. And Troubleshooter, when I asked a similar question.
    I am running Windows XP, on its last days of support. This computer is not capable of running anything newer, unless I run with Linux.
    Going to TIME.com, its vertical scroll is in the bottom corner and I get the resize control arrows instead of the mouse pointer when I point to the down-button. If I disable page styles in the View menu, I get a useful output that sets the end of the vertical scroll above the bottom corner. So somebody's idea of styling the page (CSS) creates this issue for me.
    Going to Gmail, turning off the styles gives me a useless output of nonsense, so I must use page styling enabled.
    Can someone please give me some guidance? This forum page has vertical and horizontal scroll above and left of the bottom corner square. I have access to all the parts of both scroll bars, as is the case on most well-designed pages.
    My window-resize controls are in charge always of the bottom corner square even if the vertical scroll is supposed to be there.
    See also my first wording of this question: https://support.mozilla.org/en-US/questions/993519

    Those layout.css prefs are about enabling some CSS feature, in this case vertical writing, so have nothing to do with scroll bars.
    *Bug 772321 - implement CSS parsing of writing-mode property
    *resource://gre/greprefs.js
    <pre><nowiki>// Is support for CSS vertical text enabled?
    pref("layout.css.vertical-text.enabled", false); </nowiki></pre>
    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    Use a compressed image type like PNG or JPG to save the screenshot.

  • Programatically calling control flows from java code

    Hi all,
    I have a bounded taskFlow that uses pageFragments. This flow is a region in a page(.jspx).
    In my page fragment, I have a inputComboboxListOfValues with a ValueChangeListener code in a java bean.
    I want when a value is changed, to programatically call "controll flow" (this one has: "From Activity Id" -the page fragment with that inputComboboxListOfValues, and "To Activity Id" - the default Activity on this task Flow).
    So when the value change, practically I want to restart the flow programatically and pass the selected value as input parameter.
    Since the inputComboboxListOfValues is not like a button where in the "Action" property you can set the Control Flow and navigate somewhere, the only option I have is to programatically cause navigation from java code (example: the value change listener code).
    Can this be achieved?
    Any advice is helpfull.

    Hi,
    Absolutely, you can do it using the NavigationHandler. Try the following in you value change listener:
    FacesContext context = FacesContext.getcurrentInstance();
    NavigationHandler handler = context.getApplication().getNavigationHandler();
    handler.handleNavigation(context, null, outcome);
    // Render the response after that phase, the button actions should not be called
    context.renderResponse();
    // Add the following line if you want to prevent further value change listeners to be called
    // throw new AbortProcessingException();Regards,
    ~ Simon

  • Can I add controls at runtime in JApplet

    Please also tell me what good is JApplet for. As I cannot interact with database and there are several other limitations. Should I go and use JApplet in my application or avoid using them.
    My basic question remains the same "Can I add controls at runtime in JApplet"

    Yes, you can add controls to an applet at runtime.
    Applets are run on remote computers, in browsers for instance.
    Since they are run remotely, connecting to a database can be difficult. In most cases you'll need a server that makes the connection with the database. The applet speaks with the server via a socket.
    If you're writing a standard desktop application, then you should use JFrame.

  • Labview resizing control.....

    Hello All,
    I am in the middle of developing an application that will be bundled with our product.  I have developed many such applications using visual studio, however this is my first adventure using Labview.
    As many of you know, one of the most common variables in distributing an application is the und-user screen resolution.  With the relatively recent explosion of differing screen resolutions and aspect ratios, making applications resolution independent is even more important than ever.  Along with this, giving the customer the ability to resize the appliction at will is a huge benefit.  On many occasions I have walked into a customer's site to see my application shrunk down to a corner of the window, where the use can still see it, almost like an indicator.
    For visual studio, I had purchased a third party control.  Plunk the control onto the window (it became invisible at run time) and all of the controls, fonts, etc resized as the screen was resized.  When visual studio went to .Net, this particular control no longer worked.  I had to evaluate 5 different controls to get one that even came close to working properly, and even then I had to work with support and beta test many versions of that control to get the bugs out. 
    Now I know that Labview has the panel resize options, etc and I have played around with them.  However, as most of you know, many problems still exist, such as the fonts not resizing, and multiple window changes cause control distortion, even when brought back to the same panel size.
    So, what I am wondering is this:  A) Does anyone make a control that I can purchase that does a good job in this regard, or B) if not, how about opening a discussion on how to implement a control to do just this?
    If I need to, as I forsee doing more applications with Labview, I could tackle this on my own, but as I am new to LV my learning curve may be steep so I'd like to draw on the abundance of talent and experience I've read on this board.
    I was thinking of a control that would enumerate all of the controls, labels, etc on the panel.  During the development cycle it would store all of the control / font sizes (internally? to a file?) as the developer intended the panel to appear.  At execution time (after it is built) each time the panel is resized, the control would set the height/widths and font sizes as needed.  Why store the development time sizes?  To eliminate the errors that creep up when sizing the panel up and down multiple times.  I assume this occurs in LV since original size is not tracked and pixel displacement is non-uniform across the pane, and the moving / scaling is non-integer in nature but gets applied to integer properties.  For example, when resizing from the lower right corner, to say half the width / height, controls in that corner move ALOT while controls in the Upper-left only move slightly, yet all controls are scaled in size the same amount.
    I would love it if someone could dope-slap me upside the head and say "just do this".  If not, what are some of the methods I should be looking at, and pitfalls to avoid?
    Thanks for your input!  

    tartan5 wrote:
    Wouldn't life be grand if every control included a set of read-only properties, say XOrigin, YOrigin, XSize, and YSize that were updated as you move the component around during development, but was fixed as you run the compiled program.  This would at least give you an absolute reference to use as you resize the panel, and eliminate the truncation errors we now see.
    You could do that using tags if that is what is needed.
    One interesting control I tested actually increased performance by grabbing an image of the window when the resize handle was moved, placing the image over the window, resizing the image as the corner was dragged.  Then when the corner was released, updated all of the controls / fonts as required, then hid the image.  It actually worked amazing well vs resizing the controls in real-time.......That might be very do-able in labview, show a picturebox, have it size to the window, etc....
    It probably would not be needed. You can just defer the panel updates until after you're done with your resizing. I was thinking the performance issue would be in going over all the controls and changing their size, but there is probably not going to be one.
    On another note, is it possible to recurse through an xcontrol and get all of the components at run time?  I have just finished developing my first xcontrol (so it's fresh on my mind) but I'm not sure how the xcontrol is viewed by the environment (ie if all the sub-components can be reference / obtained)?
    No idea. I use LV 7.0, which does not have them. My guess would be that you can't, at least in the earlier versions. Maybe the newer ones allow this, but I would doubt that. You might need to write a resize method (or ability or whatever they're called) for the control. That is one example of how writing a generic framework would be complicated.
    On your first point, are you suggesting that the resizer control would add the tags to each enumerated control itself?  That's almost as good as my wish above (LOL)....
    Well, I wouldn't call it a control. It would be a special resize handling (TM) process, but yes, that is exactly what I'm suggesting. See attached for a simple example.
    P.S. No, I don't know how to access these in LV 8.x.
    Try to take over the world!
    Attachments:
    Pos Tags.vi ‏36 KB

  • Mouse Resizing Control

    Hi there coders.
    I need to create image resizing control where when you insert a picture into a JTextPane, that picture has mouse resizable handles on every corner of that image and on every side of it. I should be able to click on that handle and drag it, and that would resize my image. I need same for JTextPane, so I could resize it the same way as image. Its similar to whats shown on image here: http://www.codeguru.com/cpp/controls/controls/resizing/article.php/c2151/
    Does anybody know how to do this in java? Or maybe point me in a right direction about this? Im realy stuck and I NEED this feature.
    Thanx a lot.

    You might be interested in [url http://forum.java.sun.com/thread.jspa?forumID=57&threadID=638151&start=2]this.

  • Resizing Control

    Hi there,
    C'ld anyone point out the meaning and the purpose of "anti-alias & details control" from the collume of Resizing Control in the Frame Control tab?
    Thanks!!

    From page 259 Compressor User Manual:
    Anti-alias: Use this slider to set a softness level from 0 to 100. This parameter
    improves the quality of conversions when you’re scaling media up. For example,
    when transcoding standard definition video to high definition, Anti-alias smooths
    out jagged edges that might appear in the image.
    Details Level: Use this slider to set a level (from 0 to 100) to preserve sharp edges.
    This is a sharpening control that lets you add detail back to an image being enlarged.
    Unlike other sharpening operations, the Details Level setting is able to distinguish
    between noise and feature details, and generally doesn’t increase unwanted grain.
    Increasing this parameter may introduce jagged edges, however, which can be
    eliminated by increasing the Anti-alias level.
    Note: Adaptive Details, Anti-alias, and Details Level pertain only to frame resizing
    (scaling), not deinterlacing.

  • Resize controls VI - control references

    Within the Full OI - Resize Controls.vi, I recently added a container reference used to display the comment associated with the selected sequence file.  Anyway, the way I did this was to copy one of the existing container references and modify it.  I could not figure out how to create a new container reference with the desired properties.
    I see the icon in the .Net and ActiveX pallette.  When I select the ActiveX Container, I get an empty box.  I tried a right-click and selected 'Insert ActiveX Object', but then I didn't see anything applicable in the list of available servers.
    So instead I right-clicked the copy of the container reference I made and selected Select VI Server Class -> Generic -> GObject -> Control ActiveX Container.  The "Select Ctrl Type" is set to ActiveX Container.  Then I just changed the label in the properties.
    How would I create an ActiveX Container otherwise?

    Hey  mrbean,
    There are two methods that I was able to find to create a reference to an ActiveX container.  The first one is the one that you discovered by changing the VI Server class.  The easier method in my opinion is to start with a refnum control such as an application refnum or VI refnum, and then drag and drop an ActiveX container into the Refnum control.  This should automatically change it to the correct class.
    Pat P.
    Software Engineer
    National Instruments

  • Resizing controls in top level VI

    In the LabVIEW8 version of the TestStand3.5 OI, in the Top-Level VI, there is a call to FULL OI - Resize Controls.vi.  If I (at the top-level VI) set the VI properties in Window Appearance::customize:: and uncheck the show vertical/horizontal scrollbars, thus disallowing the user to resizer the OI, do I need the Resize Controls.VI?

    Hi MrBean,
    I would recommend to leave the Resize Controls.VI there because even though you have disabled the scrollbars there are other things that can affect the control sizes such as Windows themes, using large fonts, etc.
    Pat P.
    Software Engineer
    National Instruments

  • Resizing controls with custom skin

    Hi,
    Can someone tell me how to make a spark control with a custom skin made in Catalyst to behave like a standard unskinned control when resized in design view of Flash Builder or during runtime? In other words I want it to behave like it's 9-sliced. For example, I've made a simple and ugly rounded skin for TextInput in Catalyst like this:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Skin xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fx="http://ns.adobe.com/mxml/2009">
         <fx:Metadata>[HostComponent("spark.components.TextInput")]</fx:Metadata>
         <s:states>
              <s:State name="normal"/>
              <s:State name="disabled"/>
         </s:states>
         <s:Group x="0" y="0">
              <s:Rect height="31" radiusX="5" width="182" x="0.5" y="0.5">
                   <s:stroke>
                        <s:SolidColorStroke caps="none" color="#000000" joints="miter" miterLimit="4" weight="1"/>
                   </s:stroke>
                   <s:fill>
                        <s:SolidColor color="#FF90CD"/>
                   </s:fill>
              </s:Rect>
              <s:RichEditableText color="#2B4381" fontFamily="Arial" fontSize="12" tabStops="S0 S50 S100" x="11" y="11" width="161" heightInLines="1" id="textDisplay"/>
         </s:Group>
    </s:Skin>
    How to do that in this example?
    I have searched everywhere on the net, and in a 1000 page book I have about Flash Builder and Flex and couldn't find even a single example. And I need this if I want to make something like resizable web form with a resize grip or resizable options panel.
    Thanks in advance,
    Petar

    I've got an answer but on other forum. Here is link if someone finds answer to this question useful: http://stackoverflow.com/questions/3299385/resizing-flex-spark-control-with-a-custom-skin

  • How to change properties for some controls in runtime ?

    hi,
    I would like to change some of the properties for some controls in front panel in runtime. Number of control properties I want to change is depending of a log file user opens in final application.
    I attach an example where I'm trying to change the visibility of numeric controls. Problem I have I don't know which reference to connect to property node in case the control in for loop is not a numeric control. The example relies to label.text property but I could use the more generic classname property as well.  
    regards,
    petri
    Solved!
    Go to Solution.
    Attachments:
    dynamic reference.vi ‏11 KB

    pcardinale wrote:
    Initially, a control has no caption.  It's not just that the caption string is empty and the caption not visible, but the caption object does not exist.
    I think this should probably be changed in future versions, because even if each control had a caption, it would still be a negligible small part of the VI. The current behavior made sense many years ago where HD and memory space was very precious. Not any more!
    This issue comes up often enough that it warrants addressing the root of the problem.
    It is hard to convince the casual that the caption does not exist if he can simply do a "show caption" at edit time and it will show in all glory, even with the default set to the current label. It is confusing!
    There is even an idea about this that seems worth supporting (also read the link in the discussion).
    What do you think?
    LabVIEW Champion . Do more with less code and in less time .

  • Multiline textbox appears with a resize handle at runtime.

    Hi,
    I have a text area in a form, at runtime, i seem to get a resize handle which can be resized by the user. I would like to have
    the text area appear without this re-size handle.
    Anyone faced these kinds of issues? Any solutions ?
    Jdev version
    Oracle JDeveloper 11g (11.1.1.6.0)
    tks in advance,

    hi,
    <af:inputText value="#{bindings.CoreReq.inputValue}"
    simple="false"
    required="#{bindings.CoreReq.hints.mandatory}"
    columns="#{bindings.CoreReq.hints.displayWidth}"
    maximumLength="#{bindings.YVWCoreReq.hints.precision}"
    shortDesc="#{bindings.CoreReq.hints.tooltip}" id="it8" readOnly="true"
    rows="3" contentStyle="resize: none;">
    <f:validator binding="#{bindings.YVWCoreReq.validator}"/>
    i get red cross marks at the top right corner of each of these boxes.
    using 11.1.1.6.0. I am not sure if i am doing any thing wrong here.
    Thank you,

Maybe you are looking for

  • XSLT Help Required

    Hi, I am doing XSLT Mapping. Scenario is file to file. From input file depending on some condition I need to place records in Target file. Target File structure is: Header_Record (1) Data_Record (1..*) Trailer_Record (1) In Trailer I need to place re

  • General Steps in Creating User Exits

    Can someone give me outline of the Steps involved in Userexits...

  • Starbucks iTunes broken

    I noticed yesterday Starbucks is now on iTunes wifi. Problem is it refreshes every 1 second. Anybody else have this issue. Starbucks store at Cheshire Station, Woodbridge, VA 22193

  • How do I modify custom step type that is part of a sequence?

    I have an example sequence that has a custom step type called "LabView Reentrant Action". My interest is to modify this step type to my needs. Because this custom step type is part of the sequence there is no definition in global type palette. I was

  • Need to pull ranked item from one query into new query

    Hi, I have a parent query in which I assign a rank to characteristic values based on a key figure, in dollars. I need to pull the top 4 items from that parent query into 4 seperate child queries (i.e. child query 1 is written based on ranked item 1,