How to resize window when stage style is undecorated ?

Hi,
I have one undecorated window and I want to make it resizable by using mouse.
How can I do it ?
If I use decorated window then it allows me to resize it.
Thanks.

Just make a draggable shape and resize the stage depending on the drag action.
Here is a simple stage illustrating that and moving the window too.
Note an old bug already seen in 1.1 at least: when dragging such window, on WinXP, sometime it seems to "jump" to one bound of the screen, then it goes back (in a flicker) to current position. Strange and annoying.
def resizeHandle: Path = Path
    var origX = bind scene.width
    var origY = bind scene.height
    var startW: Number; var startH: Number;
    elements:
        MoveTo { x: bind origX, y: bind origY }
        LineTo { x: bind origX - 50, y: bind origY - 30 }
        LineTo { x: bind origX - 30, y: bind origY - 50 }
    fill: Color.CORAL
    stroke: null
    blocksMouse: true
    // Resize with the arrow
    onMousePressed: function (evt: MouseEvent): Void
        startW = stage.width;
        startH = stage.height;
    onMouseDragged: function (evt: MouseEvent): Void
        stage.width = startW + evt.dragX;
        stage.height = startH + evt.dragY;
var keyHandler: Rectangle;
def titleBar: Stack = Stack
    var title: Text;
    content:
        keyHandler = Rectangle
            width: bind title.layoutBounds.width * 1.2
            height: bind title.layoutBounds.height * 1.3
            fill: Color.web('#33FF55')
            blocksMouse: true
            // We can drag the stage by dragging the title bar
            onMouseDragged: function (evt: MouseEvent): Void
                stage.x += evt.dragX;
                stage.y += evt.dragY;
            onKeyReleased: function (evt: KeyEvent): Void
                if (evt.code == KeyCode.VK_ESCAPE)
                    FX.exit();
                println(evt);
        title = Text
            content: "Resizable and Draggable Window"
            font: Font { name: "Arial Bold", size: 24 }
            fill: Color.web('#331122')
var scene: Scene;
def stage: Stage = Stage
    title: "Undecorated Stage"
    style: StageStyle.UNDECORATED
    scene: scene = Scene
        width: 500
        height: 500
        fill: Color.GOLD
        content:
            Ellipse
                centerX: bind scene.width / 2
                centerY: bind scene.height / 2
                radiusX: bind 0.45 * scene.width
                radiusY: bind 0.45 * scene.height
                fill: Color.AQUA
            Circle
                centerX: bind scene.width - 55
                centerY: bind scene.height - 55
                radius: 50
                fill: Color.PURPLE
            titleBar,
            resizeHandle
keyHandler.requestFocus();

Similar Messages

  • How to resize windows by pulling edges (like in Windows)

    Hi, is there a way to pull windows wider (resize them) by pulling on the window edges rather than the lower-right corner? I tend to have a lot of Terminal windows, as well as Photoshop windows.
      Windows XP Pro  

    Your profile says Windows XP pro, and doesn't say what Mac operating system you are running. Now most Mac operating systems do not let you pull the window edges to resize the windows. The only controls you'll get are in the corners.
    There have been some hacks on certain operating systems to make the edges work, but like I say they are hacks, and may not work through an operating system update. The last time I saw such a hack work was way back in System 7.6 with Church Windows. There may be additional ones on Mac OS X that work that have been mentioned on:
    http://www.resexcellence.com/
    Of course if you run Windows in emulation, or virtualization environment, Windows applications themselves will still have their usual interface behavior:
    http://www.macmaps.com/macosxnative.html#WINTEL
    tells of several such options.
    I'd add, I prefer the controls to remain on the corners, because otherwise you get confused how to move windows using their edges, or you might misdirect your cursor to the scrollbar and instead end up resizing the window when you don't want to.

  • How can I stop Yosemite resizing windows when I turn off my screen?

    I have a 2012 mac mini running Yosemite. It's hooked up to an LG TV via the thunderbolt port and an adapter.
    When I turn off the TV and the turn it back on again, all of my windows get moved over to the leftmost 2/3rds of the screen (approx). It's super annoying constantly moving windows back to where I left them.
    Can someone explain why this is happening and suggest how I can fix it?

    Windows stuck in top left hand corner of screen

  • Auto resize window when opening image.

    How do you make the whole window automatically resize to fit your screen without covering the palletts?  Everythime I open an image the window is hidden by the pallets. I then have to move the pallets out of the way, resize the window to fit my monitor, move the pallets back and Im ready to go. This is such a pain. I want the tools pallet to be on the left, the action and history, etc. on the right, and I want the window with all my image tabs to fit between those from top to bottom and from side to side automatically. I never had this problem in earlier versions. I have cs5.
    Thank you!

    I don't need the image to be full screen, just the window. And the window is not technically full screen, because you can still see the window borders and the panels. I want the image window with the different image tabs to open as big as my screen. I want the edges to come right up next to my panels and the bottom to go down to the bottom of my screen. For example: I use Mac and when you close a finder window and open a new one, it will open at the same size that you closed it. If you resize it, lets say, to fill your entire screen, close it and then reopen it, it will open the same size as you closed it. I don't want photoshop to open new image windows to the same dimension as the image. I want a grey screen to cover my entire monitor just like in CS3 and before. I really like the tabs, but I want the window to open bigger with grey space arround the image.

  • How to resize window?

    I sometimes have a problem of window becoming so large, that it's bottom right corner is off-screen (when I disconnect a large external monitor)...how can I resize this window?

    Here is a third party app that will help out:
    http://www.atomicbird.com/mondomouse/
    Kj

  • HT4818 how to resize windows partition

    How do you resize the windows partition in boot camp?

    iF you have already created the Windows partition, you can't resize it. To do it, you have to use an app like Paragon Camptune, that will allow you to resize your Windows volume > http://www.paragon-software.com/downloads/camptune.html
    The other option is to delete Windows and create the new partition with the size you want in Windows. Make a backup of your data before doing this

  • How to resize window (JFrame) on event

    I've got a swing application that uses tabs (JTabbedPane). It's default size is 200,200, and I need to resize the window to different sizes depending on what tab is selected. I can set the default size, but I can't seem to get access to the window to resize it (setBounds/setSize) at runtime.
    If anybody can tell me how I can go about this, I would greatly appreciate it.
    Matt
    Here's the code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    public class TimeTrack_Example extends JFrame {
         Container cp = getContentPane();
      public static void main(String args[]) {
              TimeTrack_Example TT = new TimeTrack_Example();
              TT.setSize(200,200);
      public TimeTrack_Example() {
              JTabbedPane JTPane = new JTabbedPane();
              JTPane.addChangeListener(cl);
                   //Jobs Tab
              JPanel jpJobs = new JPanel();
              JTPane.addTab("Jobs", jpJobs);
                   //Timer Tab
              JPanel jpTimer = new JPanel();
              JTPane.addTab("Timers", jpTimer);
                   //Report Tab
              JPanel jpReport = new JPanel();
              JTPane.addTab("Report", jpReport);
        cp.add(JTPane);
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
        pack();
        show();
              //Tab ChangeListener
         ChangeListener cl = new ChangeListener() { 
              public void stateChanged(ChangeEvent e) {
                   int tabID = ((JTabbedPane)e.getSource()).getSelectedIndex();
                   if (tabID == 2) {
                        //???               //here's where I need to change the size
    }

    This is one way:
    create a method, lets call it resizeWindow(). Call this method from inside your ChangeListener.
    public void resizeWindow() {
    this.setSize(300, 400); //whatever values you want
    public void stateChange(ChangeEvent e) {
    if (tabID == 2) {
    resizeWindow();
    }

  • How to resize window smoothly?

    I need to screen record a resizing a window but need it to happen in a very smooth manner.  I'd could manually drag the window but it won't be completely smooth or fluid.  I thought to use Automator but I don't see anything under resize. 
    I'd like to set starting and ending points.  If it could pause in the middle that would be great.
    Any ideas how this can be accomplished?

    Try the following:
    repeat 20 times
              set boundBox to bounds of window "Downloads" of application "Finder"
              set tFrame to (item 1 of boundBox)
              set lFrame to (item 2 of boundBox)
              set rFrame to (item 3 of boundBox) - 2
              set bFrame to (item 4 of boundBox)
              set bounds of window "Downloads" of application "Finder" to {tFrame, lFrame, rFrame, bFrame}
              delay 0.05
    end repeat
    In this script, change the "- 2" value to adjust the amount the window will change at each loop. The repetition count of 20 can be changed to also adjust the amount the window will change. Both of these will set the extent of the window change, and then you can adjust the delay value (in seconds) to change the rate once the other two values have been set.
    It will take some experimenting to figure

  • How to resize JTextArea when frame has been resized

    Hi!
    At first, I have to complain, that these Layout Managers drive me crazy. Even as an experienced developer, very often, I am frustrated and I am never 100% sure which layout manager I should choose (according to the Sun How Tos) and once I have decided, the never do what I'd expect them to do. I'm not sure if I am just too dumb or if there might be an unreasonable API architecture/design...
    OK, here again is a problem with layouts. And it's basically like this (See code for details):
    Row one: Text Area 1, Button 1; Row two: Text Area 2, Button 2.
    I just want to have the buttons aligned, the text areas should be same sized. Moreover, I want to disable vertical resizing and on horizontal resizing, I want the TextArea to be resized as well.
    But it doesn't. I could partly solve the vertical resizing by setting the minimum size, but the maximum size dosen't seem to work. I can still enlarge the window. The horizontal resizing doesn't work at all. I tried border layout before and set the Text area as center, but it also doesn't work. I read that some layout managers use only preferred size, some also use min and max size and this is very confusing.
    And I saw that component resizing should work for box layout as well (see Sun box layout how to). If this problem is easy to solve, please excuse my question, but I couldn't find it in the forum.
    OK, here is an SSCCE:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package com.ettex.componentresizetest;
    import java.awt.ComponentOrientation;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import javax.swing.BoxLayout;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    * @author Jan Wedel
    public class ComponentResizeTest extends JFrame{
         static ComponentResizeTest frame;
         JPanel mainPanel;
         JPanel firstPanel;
         JPanel secondPanel;
         JPanel statusPanel;
         JButton firstButton;
         JButton secondButton;
         JTextField firstField;
         JTextField secondField;
         JLabel statusText;
         public ComponentResizeTest(String name) {
              super(name);
         public void addComponentsToPane() {
              Container pane = this.getContentPane();
              mainPanel = new JPanel();
              firstPanel = new JPanel();
              secondPanel = new JPanel();
              statusPanel = new JPanel();
              pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
              firstField = new JTextField();
              secondField = new JTextField();
              statusText = new JLabel("Status Bar");
              firstField.setPreferredSize(new Dimension(500, 25));
              secondField.setPreferredSize(new Dimension(500, 25));
              secondButton = new JButton("A Button");
              firstButton = new JButton("Another Button");
              firstPanel.add(firstField);
              firstPanel.add(secondButton);
              firstPanel.setLayout(new BoxLayout(firstPanel, BoxLayout.X_AXIS));
              secondPanel.add(secondField);
              secondPanel.add(firstButton);
              secondPanel.setLayout(new BoxLayout(secondPanel, BoxLayout.X_AXIS));
              mainPanel.add(firstPanel);
              mainPanel.add(secondPanel);
              mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
              statusPanel.add(statusText);
              FlowLayout tabLayout = new FlowLayout();
              tabLayout.setAlignment(FlowLayout.LEFT);
              firstPanel.setLayout(tabLayout);
              firstPanel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
              secondPanel.setLayout(tabLayout);
              secondPanel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
              statusPanel.setLayout(tabLayout);
              statusPanel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
              pane.add(mainPanel);
              pane.add(statusPanel);
          * Create the GUI and show it.  For thread safety,
          * this method should be invoked from the
          * event dispatch thread.
         private static void createAndShowGUI() {
              //Create and set up the window.
              frame = new ComponentResizeTest("Component Resize Test");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              //Set up the content pane.
              frame.addComponentsToPane();
              /* Layout componets */
              frame.pack();
              /* Prevent vertical resize */
              Dimension cur = frame.getSize();
              Dimension max = frame.getMaximumSize();
              frame.setMinimumSize(new Dimension(cur.width, cur.height));
              frame.setMaximumSize(new Dimension(max.width, cur.height));
              frame.invalidate();
              /* show frame */
              frame.setVisible(true);
          * @param args the command line arguments
         public static void main(String[] args) {
              //Schedule a job for the event dispatchi thread:
              //creating and showing this application's GUI.
              javax.swing.SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        createAndShowGUI();
    }Thanks, Jan
    Edited by: stelzbock on Nov 9, 2009 6:54 AM

    This is what I get using TableLayout:
    The maximum horizontal size of the text area is achieved by specifying the columns in the constructor,
    although I think it's bad since resizing smaller does reduce the text area. I would use FILL constraint for the text area column and remove the 'filler' column at the end.
    import info.clearthought.layout.TableLayout;
    import java.awt.EventQueue;
    import javax.swing.*;
    public class TestLayout {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    TableLayout layout = new TableLayout(new double[][] {
                            // columns
                            { TableLayout.PREFERRED, TableLayout.PREFERRED,
                               TableLayout.FILL },
                            // rows
                            { TableLayout.PREFERRED, TableLayout.FILL,
                              TableLayout.PREFERRED, TableLayout.FILL },
                    JPanel panel = new JPanel(layout);
                    panel.add(new JScrollPane(new JTextArea(3, 30)), "0,0,0,1");
                    panel.add(new JButton("One"), "1,0");
                    panel.add(new JScrollPane(new JTextArea(3, 30)), "0,2,0,3");
                    panel.add(new JButton("Two"), "1,2");
                    JFrame frame = new JFrame("Test");
                    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    frame.getContentPane().add(panel);
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.setVisible(true);
    }Ah, in your code you have text fields, not area and want to restrict vertical resize. Then I get this:
    TableLayout layout = new TableLayout(new double[][] {
                            // columns
                            { TableLayout.FILL, TableLayout.PREFERRED },
                            // rows
                            { TableLayout.PREFERRED, TableLayout.PREFERRED,
                                TableLayout.FILL, TableLayout.PREFERRED },
                    layout.setVGap(5);
                    layout.setHGap(5);
                    JPanel panel = new JPanel(layout);
                    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
                    panel.add(new JTextField(30), "0,0");
                    panel.add(new JButton("One"), "1,0");
                    panel.add(new JTextField(30), "0,1");
                    panel.add(new JButton("Two"), "1,1");
                    panel.add(new JLabel("Status"), "0,3,1,3");Another more advanced layout to look at is MigLayout.
    Edited by: WalterLaan on Nov 9, 2009 8:23 AM

  • How to "grab" window when it's off screen

    Since I often use a second monitor, the screen geometry varies (compared to when the MacBook is running solo).
    I cannot use iTunes, since it's upper menu bar is north of the visible desktop. Even when I can see the whole window as a thumbnail-- highlighted in blue in "Expose'" -- I cannot reposition it so that I can use it.
    What's the trick? (Stupid, eh?) Thanks!

    Wow. Thank you, Niel.
    Very cool. Window still resizable too.
    I have been able to solve this in past using Expose, but this was stubborn.
    GB

  • How to resize window keeping relative width and hieght

    Ok as usual I do not want this done for me but I could use a pointer. Simply put I wish to set a JFrame so that when it is resized by the user it holds its relative width and height.
    Could somebody point me to where it is at in the API or a generic sample of code that I can rework? I have read for it but am not finding it so far. Thank you for your patience and any help offered. If it matters I'm doing a fairly simple app in NetBeans not an applet or anything.
    Edited by: Donalds on Apr 8, 2010 5:10 PM

    This was the best I could think of off the top of my head.
    You may want to request this thread be moved to the swing forums for better contributions.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ComponentEvent;
    import java.awt.event.ComponentListener;
    public class SampleFrame {
        public Dimension lastSize = new Dimension(400,300);
        public JFrame frame;
        public SampleFrame() {
            frame = new JFrame("Sample Frame");
            frame.setSize(lastSize);
            frame.setLocationRelativeTo(null);
            frame.addComponentListener(new ComponentListener() {
                public void componentResized(ComponentEvent e) {
                    Dimension currentFrameSize = frame.getSize();
                    int widthDelta = Math.abs(lastSize.width - currentFrameSize.width);
                    int heightDelta = Math.abs(lastSize.height - currentFrameSize.height);
                    if(heightDelta > widthDelta) {
                        double scaleRatio = currentFrameSize.getHeight() / lastSize.height;
                        currentFrameSize.width = (int) (lastSize.width * scaleRatio);
                    } else {
                        double scaleRatio = currentFrameSize.getWidth() / lastSize.width;
                        currentFrameSize.height = (int) (lastSize.height * scaleRatio);
                    frame.setSize(currentFrameSize);
                    lastSize = currentFrameSize;
                    frame.setLocationRelativeTo(null);
                public void componentMoved(ComponentEvent e) {
                public void componentShown(ComponentEvent e) {
                public void componentHidden(ComponentEvent e) {
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
        public static void main(String[] args) {
            new SampleFrame();
    }

  • How to resize the Director stage

    I need my programme to adjust the size of the Director stage
    to one of 3 dimensions at startup 1024x768, 768x432 or 1280x720
    acording to a variable it reads in from a ini file. How can this
    best be achieved within a single Director movie (I don't want to
    just have a stub movie that loads a relevantly pre-sized movie
    file)?
    Many thanks
    Kevin

    Ok, (the stage).rect and (the stage).drawRect work fine but
    if what you want to do is a monitor resolution change, i recomend
    to use the Enhancer Xtra is excellent about change monitors
    resolutions and others things.

  • How to uninstall Windows when the remove box is greyed out??

    Dear all
    I want to uninstall windows 7 from my Macbook Pro via Bootcanp but i couldn't. The remove checkbox is greyed out!!
    I want to uninstall it to download other vergion of Windows
    Can you please help , it will be appreciated

    Windows partition is not showing on Disck Utilitiess as well, but i still can open windows on my mac

  • How do i drag icons and how do i resize windows

    this is my first laptop having been used to emacs before. I can't figure out how to drag items or resize windows when not using a mouse and can't find such simple instructions in the manual.
    thanks.

    In addition to the method described by Jim, you can set options in the Keyboard & Mouse preference panel (in System Preferences) that allow you to get mouse clicks and click lock using the trackpad. Check out those options, many people find they make the trackpad a lot more useful.
    Randall Schulz
    iMac 20" Core Duo; MacBook Pro   Mac OS X (10.4.6)  

  • Resize windows and manage files in save/open dialogs?

    1. How to resize windows by dragging any border or corner?
    2. How to manage files via a Save/SaveAs or Open dialog (rename, delete, copy other files, etc...)?
    My search on these two things only comes up with comparisons and debates about Win vs Mac. Not relevant to the questions! I already run Win XP in Fusion when I have to for work. I don't want to run Windows; I just want to eliminate a couple Mac shortcomings since Apple hasn't. Yet. Maybe it has to do with patents...
    Anyway, does anybody know of a utility or other way to enable these functions in Mac OS 10? (I've tried Pathfinder; it doesn't quite do the trick.)

    I believe you will find a couple of third-party utilities that provide some enhancements for windows. As for file dialogs I can only recommend Default Folder X. You will find these at VersionTracker or MacUpdate.

Maybe you are looking for

  • How to get 2 return values from a single SelectInputText?

    Hi, I am using the std Search form, The table I am using has fields like ID,Name,Status, and a few more I use a SelectInputText(pop up the ID and Name list) and populate the result back on the Search page What I am looking for is to have another outp

  • Please help me stop the broadcast of my calls...

    My curve defaults to speakerphone when i answer any incoming call and so the identity of the caller is made clear to anyone in earshot - embarrassing. After a second or two it reverts to the normal speaker which can only be heard by holding the phone

  • Don't want new tiff files saved in my catologue if I'm only using the image for a composite.

    When editing in Photoshop CS4 from LR3, the new tif will not appear in the catalogue unless I save it in PS. In LR4 it saves a new tiff in my catalogue regardless if I save the edited image in PS or not. I have a cloud library I use often and do not

  • Mail error message in console log - "deleted count greater than total count

    since installing Gmail IMAP instead of POP I get the following error message in the console log. Any ideas or solutions? 28/10/2009 14:19:04 Mail[1629] * Assertion failure in -[MessageViewer _countStringForType:isDrafts:omitUnread:totalCount:], /Sour

  • Formula node conditional

    Hi Guys I wrote a simple conditional code in formula node and there is no error but it doesn't calculate. It works wrong and when I check the code I can't find any mistake.Please read my code and Let me know what is wrong with my code. Thanks so much