SpringLayout - resize

hi
I have JPanel that contains rows of JPanels.
Each row have her own components inside.
All the JPanels use SpringLayout (the main and the rows).
In run time one of the rows changes her height (heigher) and add more components.
My problem is that when I add new component to one of the rows and change the row's height in runn time nothing happend.....
Tanks, Yaniv

If I'm not mistaken, you can't change the width and height of a component unless the JPanel they are on, has a null-layout JPanel.setLayout(null). You can use component.setSize(x,y) or component.setBounds(x,y,width,height) to place them correctly on the JPanel.
Maybe you can accomplish something with getPreferredSize() as well, but I'm not that familiar with the function.

Similar Messages

  • BorderLayout vs SpringLayout : resizing application user interface

    I have an application that resized (i.e. maximized to fill monitor) readily when I used BorderLayout. After changing the layout to SpringLayout, I am happier with my user interface but it does not maximize.
    Actually it does maximize, but it leaves the rest of the larger screen blank. Any ideas on how to fix that? So that the entire user interface fills the window whether maximized or smaller?
    Thanks.

    Follow the link to the Swing tutorials from the topic listing page for this forum and go through the trail on Laying out Components in a Container. After that, if you have a specific issue with your layout, post a [SSCCE (Short, Self Contained, Compilable and Executable, Example Program)|http://mindprod.com/jgloss/sscce.html] that demonstrates the problem.
    When you do so, use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
    db

  • SpringLayout resizing problem

    when i use the springlayout and try and manually resize the applet some of the JTextFields dissapear and reappear. why is this?

    did you put in constraints? Look here

  • SpringLayout fails to resize

    re: Java Tutorial, How to Use SpringLayout
    http://java.sun.com/docs/books/tutorial/uiswing/layout/spring.html
    run SpringDemo3.java, given as an example on this page.
    resize (expand) the frame by grabbing a border.
    this works.
    now attempt to resize (contract) the frame the same way.
    this does not work.
    why?
    the code to create and lay out the frame is given below:
    private static void createAndShowGUI() {
        //Make sure we have nice window decorations.
        JFrame.setDefaultLookAndFeelDecorated(true);
        //Create and set up the window.
        JFrame frame = new JFrame("SpringDemo3");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Set up the content pane.
        Container contentPane = frame.getContentPane();
        SpringLayout layout = new SpringLayout();
        contentPane.setLayout(layout);
        //Create and add the components.
        JLabel label = new JLabel("Label: ");
        JTextField textField = new JTextField("Text field", 15);
        contentPane.add(label);
        contentPane.add(textField);
        //Adjust constraints for the label so it's at (5,5).
        layout.putConstraint(SpringLayout.WEST, label,
                             5,
                             SpringLayout.WEST, contentPane);
        layout.putConstraint(SpringLayout.NORTH, label,
                             5,
                             SpringLayout.NORTH, contentPane);
        //Adjust constraints for the text field so it's at
        //(<label's right edge> + 5, 5).
        layout.putConstraint(SpringLayout.WEST, textField,
                             5,
                             SpringLayout.EAST, label);
        layout.putConstraint(SpringLayout.NORTH, textField,
                             5,
                             SpringLayout.NORTH, contentPane);
        //Adjust constraints for the content pane: Its right
        //edge should be 5 pixels beyond the text field's right
        //edge, and its bottom edge should be 5 pixels beyond
        //the bottom edge of the tallest component (which we'll
        //assume is textField).
        layout.putConstraint(SpringLayout.EAST, contentPane,
                             5,
                             SpringLayout.EAST, textField);
        layout.putConstraint(SpringLayout.SOUTH, contentPane,
                             5,
                             SpringLayout.SOUTH, textField);
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }

    so no one has anything to add... anyone else having this issue?
    and what happened to the discussion forum for the past few/several month?!?  it was inaccessible...

  • Resizing windows and components

    Hi, i've been reading the swing tutorial on springLayout but i still haven't figured out how to do it.
    Basically I want a jTable in a jScrollPane to resize itself whenever i resize the window. The window would also have other buttons, which positions I want to stay relatively constant to the borders (ex: always in the middle, or always to the left, etc. etc.), however i do not want to resize them. any ideas?
    Thnx
    Rickszyr

    Don't use SpringLayout. Assuming what you stated is all you want in the window, my suggestion is to do the following:
    1. The main window's content pane uses BorderLayout. Stick the JScrollPane containing the JTable in BorderLayout.CENTER.
    2. Create a second JPanel that will contain your buttons. Add this JPanel to your content pane wherever you want (e.g. BorderLayout.RIGHT if you want it to the right of the JTable, BorderLayout.SOUTH if you want them below, etc.). The LayoutManager you use for this second JPanel depends on how you want the buttons arranged.
    Basically, don't be afraid to nest JPanels with different LayoutManagers to achieve the layout you want. You'd be amazed with how much you can accomplish with BorderLayout and GridLayout, and sometimes a little bit of BoxLayout.

  • Problem with springlayout

    I'm pretty new in java programming and just got a question.
    I used one of the spring layout exampels on java.sun.com and wanted to develop it a little. Just to put another JLabel into the JFrame.
    Here is my code
    import javax.swing.SpringLayout;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import java.awt.Container;
    public class SpringDemo2 {
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Make sure we have nice window decorations.
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            JFrame frame = new JFrame("SpringDemo2");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Set up the content pane.
            Container contentPane = frame.getContentPane();
            SpringLayout layout = new SpringLayout();
            contentPane.setLayout(layout);
            //Create and add the components.
            JLabel label = new JLabel("Label: ");
            JLabel test = new JLabel("hej! ");
            JTextField textField = new JTextField("Text field", 15);
            contentPane.add(label);
            contentPane.add(test);
            contentPane.add(textField);
            //Adjust constraints for the label so it's at (5,5).
            layout.putConstraint(SpringLayout.WEST, label, 5, SpringLayout.WEST, contentPane);
            layout.putConstraint(SpringLayout.NORTH, label, 5, SpringLayout.NORTH, contentPane);
            layout.putConstraint(SpringLayout.WEST, test, 5, SpringLayout.EAST, contentPane);
            layout.putConstraint(SpringLayout.NORTH, test, 5, SpringLayout.NORTH, label);  
            //Adjust constraints for the text field so it's at
            //(<label's right edge> + 5, 5).
            layout.putConstraint(SpringLayout.WEST, textField, 5, SpringLayout.EAST, label);
            layout.putConstraint(SpringLayout.NORTH, textField, 5, SpringLayout.NORTH, contentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }The problem is that the JLabel with the text "hej" doesn't get visible.
    someone who got a solution?
    thanks!

    you can do this if you want the components to be visible during startup, without manually resizing the JFrame:
    layout.putConstraint(SpringLayout.EAST, contentPane, 5, SpringLayout.EAST, textField);
    layout.putConstraint(SpringLayout.SOUTH, contentPane, 5, SpringLayout.SOUTH, textField);
    or
    frame.pack();
    frame.setSize(250, 100);
    frame.setVisible(true);
    hth.

  • Centring items using SpringLayout

    I'm writing a dictionary program that uses Spring Layout to position things in exactly the way I want them.
    However, some elements, such as the results table, or the masses of buttons to perform searches, don't stay centred and I don't know how to do this using Spring Layout.
    Snippets of my code below. Centred Dictionary Window just sets the size, background colour, etc. There are 5 of each element (eg "Not" ComboBoxes, etc) except Operator ComboBoxes, of which there are 4. and yeah I understand that I can use 'object arrays' to shorten my code and avoid duplication but I've not worked out exactly how to do that yet >.<
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.lang.*;
    import java.io.*;
    public class searchWindowFrame extends CentredDictionaryWindow {
    //Title image
              JLabel searchImage = new JLabel(new ImageIcon("resources/SearchImage.jpg"));
              boxFont = new Font("Tahoma", Font.PLAIN, 12);
              //First 'Not' ComboBox
              String[] notItems = { "", "NOT" };
              notCombo = new JComboBox(notItems);
              notCombo.setPreferredSize(new Dimension(95, 40));
              notCombo.setBackground(new Color(241, 239, 240));
              notCombo.setForeground(new Color(93, 58, 64));
              notCombo.setFont(boxFont);
              notCombo.setEnabled(true);
              //First 'Dictionary Type' ComboBox
              String[] dictTypeItems = { "<Dictionary Type>", "Orthography", "Pronunciation" };
              dictTypeCombo = new JComboBox(dictTypeItems);
              dictTypeCombo.setPreferredSize(new Dimension(135, 40));
              dictTypeCombo.setBackground(new Color(241, 239, 240));
              dictTypeCombo.setForeground(new Color(93, 58, 64));
              dictTypeCombo.setFont(boxFont);
              dictTypeCombo.setEnabled(true);
              //First 'Search Type' ComboBox
              String[] searchTypeItems = { "<Search Type>", "Contains", "Starts With",
                   "Ends With", "Minimal Pairs" };
              searchTypeCombo = new JComboBox(searchTypeItems);
              searchTypeCombo.setPreferredSize(new Dimension(125, 40));
              searchTypeCombo.setBackground(new Color(241, 239, 240));
              searchTypeCombo.setForeground(new Color(93, 58, 64));
              searchTypeCombo.setFont(boxFont);
              searchTypeCombo.setEnabled(true);
              //First 'Query' TextField
              searchTermField = new JTextField("<Query>", 10);
              searchTermField.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
              searchTermField.setPreferredSize(new Dimension(100, 40));
              searchTermField.setBackground(new Color(249, 249, 249));
              searchTermField.setForeground(new Color(93, 58, 64));
              searchTermField.setFont(boxFont);
              //First 'Operator' ComboBox
              String[] operatorItems = { "", "AND", "OR" };
              operatorCombo = new JComboBox(operatorItems);
              operatorCombo.setPreferredSize(new Dimension(95, 40));
              operatorCombo.setBackground(new Color(241, 239, 240));
              operatorCombo.setForeground(new Color(93, 58, 64));
              operatorCombo.setFont(boxFont);
              operatorCombo.setEnabled(true);
    //Panel containing Not Combo Boxes
              firstQueryPanel = new JPanel();
              firstQueryPanel.setLayout(new GridLayout(5, 0, 10, 10));
              firstQueryPanel.setBackground(new Color(241, 239, 240));
              firstQueryPanel.setBorder(new EmptyBorder(10, 10, 0, 0));
              firstQueryPanel.add(notCombo);
              firstQueryPanel.add(notComboTwo);
              firstQueryPanel.add(notComboThree);
              firstQueryPanel.add(notComboFour);
              firstQueryPanel.add(notComboFive);
              //Panel containing Dictionary Type Combo Boxes
              secondQueryPanel = new JPanel();
              secondQueryPanel.setLayout(new GridLayout(5, 0, 10, 10));
              secondQueryPanel.setBackground(new Color(241, 239, 240));
              secondQueryPanel.setBorder(new EmptyBorder(10, 0, 0, 0));
              secondQueryPanel.add(dictTypeCombo);
              secondQueryPanel.add(dictTypeComboTwo);
              secondQueryPanel.add(dictTypeComboThree);
              secondQueryPanel.add(dictTypeComboFour);
              secondQueryPanel.add(dictTypeComboFive);
              //Panel containing Search Type Combo Boxes
              thirdQueryPanel = new JPanel();
              thirdQueryPanel.setLayout(new GridLayout(5, 0, 10, 10));
              thirdQueryPanel.setBackground(new Color(241, 239, 240));
              thirdQueryPanel.setBorder(new EmptyBorder(10, 0, 0, 0));
              thirdQueryPanel.add(searchTypeCombo);
              thirdQueryPanel.add(searchTypeComboTwo);
              thirdQueryPanel.add(searchTypeComboThree);
              thirdQueryPanel.add(searchTypeComboFour);
              thirdQueryPanel.add(searchTypeComboFive);
              //Panel containing Query Text Fields
              fourthQueryPanel = new JPanel();
              fourthQueryPanel.setLayout(new GridLayout(5, 0, 10, 10));
              fourthQueryPanel.setBackground(new Color(241, 239, 240));
              fourthQueryPanel.setBorder(new EmptyBorder(10, 0, 0, 0));
              fourthQueryPanel.add(searchTermField);
              fourthQueryPanel.add(searchTermFieldTwo);
              fourthQueryPanel.add(searchTermFieldThree);
              fourthQueryPanel.add(searchTermFieldFour);
              fourthQueryPanel.add(searchTermFieldFive);
              //Panel containing Operator Combo Boxes
              fifthQueryPanel = new JPanel();
              fifthQueryPanel.setLayout(new GridLayout(4,0,10,10));
              fifthQueryPanel.setBackground(new Color(241, 239, 240));
              fifthQueryPanel.setBorder(new EmptyBorder(10, 0, 0, 10));
              fifthQueryPanel.add(operatorCombo);
              fifthQueryPanel.add(operatorComboTwo);
              fifthQueryPanel.add(operatorComboThree);
              fifthQueryPanel.add(operatorComboFour);
              //Search button
              searchButton = new JButton("Search");
              searchButton.setFont(boxFont);
              searchButton.setBackground(new Color(249, 249, 249));
              searchButton.setForeground(new Color(93, 58, 64));
              searchButton.setToolTipText("Search with the set parameters");
              searchButton.setPreferredSize(new Dimension(100, 40));
              searchButton.setFocusPainted(false);
              //Back button
              backButton = new JButton("< Back");
              backButton.setFont(boxFont);
              backButton.setBackground(new Color(249, 249, 249));
              backButton.setForeground(new Color(93, 58, 64));
              backButton.setPreferredSize(new Dimension(100, 40));
              backButton.setFocusPainted(false);
              //Exit button
              exitButton = new JButton("Exit");
              exitButton.setFont(boxFont);
              exitButton.setBackground(new Color(249, 249, 249));
              exitButton.setForeground(new Color(93, 58, 64));
              exitButton.setPreferredSize(new Dimension(100, 40));
              exitButton.setFocusPainted(false);
    layout = new SpringLayout();
              getContentPane().setLayout(layout);
              layout.putConstraint(SpringLayout.NORTH, searchImage, 10, SpringLayout.NORTH, getContentPane());
              layout.putConstraint(SpringLayout.EAST, searchImage, 0, SpringLayout.EAST, getContentPane());
              layout.putConstraint(SpringLayout.NORTH, firstQueryPanel, 10, SpringLayout.SOUTH, searchImage);
              layout.putConstraint(SpringLayout.WEST, secondQueryPanel, 10, SpringLayout.EAST, firstQueryPanel);
              layout.putConstraint(SpringLayout.NORTH, secondQueryPanel, 10, SpringLayout.SOUTH, searchImage);
              layout.putConstraint(SpringLayout.WEST, thirdQueryPanel, 10, SpringLayout.EAST, secondQueryPanel);
              layout.putConstraint(SpringLayout.NORTH, thirdQueryPanel, 10, SpringLayout.SOUTH, searchImage);
              layout.putConstraint(SpringLayout.WEST, fourthQueryPanel, 10, SpringLayout.EAST, thirdQueryPanel);
              layout.putConstraint(SpringLayout.NORTH, fourthQueryPanel, 10, SpringLayout.SOUTH, searchImage);
              layout.putConstraint(SpringLayout.WEST, fifthQueryPanel, 10, SpringLayout.EAST, fourthQueryPanel);
              layout.putConstraint(SpringLayout.NORTH, fifthQueryPanel, 10, SpringLayout.SOUTH, searchImage);
              layout.putConstraint(SpringLayout.SOUTH, backButton, -10, SpringLayout.SOUTH, getContentPane());
              layout.putConstraint(SpringLayout.WEST, backButton, 10, SpringLayout.WEST, getContentPane());
              layout.putConstraint(SpringLayout.WEST, exitButton, 10, SpringLayout.EAST, backButton);
              layout.putConstraint(SpringLayout.SOUTH, exitButton, -10, SpringLayout.SOUTH, getContentPane());
              layout.putConstraint(SpringLayout.EAST, helpButton, -10, SpringLayout.WEST, searchButton);
              layout.putConstraint(SpringLayout.SOUTH, helpButton, -10, SpringLayout.SOUTH, getContentPane());
              layout.putConstraint(SpringLayout.SOUTH, searchButton, -10, SpringLayout.SOUTH, getContentPane());
              layout.putConstraint(SpringLayout.EAST, searchButton, -10, SpringLayout.EAST, getContentPane());
              getContentPane().setBackground(new Color(241, 239, 240));
              getContentPane().add(searchImage);
              getContentPane().add(firstQueryPanel);
              getContentPane().add(secondQueryPanel);
              getContentPane().add(thirdQueryPanel);
              getContentPane().add(fourthQueryPanel);
              getContentPane().add(fifthQueryPanel);
              getContentPane().add(backButton);
              getContentPane().add(exitButton);
              getContentPane().add(searchButton);
    ...

    -__- On searchWindowFrame I want to centre all 24 input components. On resultsFrame I want to centre the scroll pane containing the JTable.
    To say I rewrote most of the program I had to completely redo this to get it to run, nor can I even use them all because that's 'too much', so that was fun.
    Like I said, I can centre things, just when the window resizes, it doesn't move with it.
    Originally the window is set to the right size, so everything is in its correct place.
    import javax.swing.*;
    import java.awt.*;
    import java.io.*;
    public class searchFrame extends JFrame
         public searchFrame()
              setTitle("Dictionary A'la Lewis");
              // Get the toolkit for reading System information
              Toolkit tk = Toolkit.getDefaultToolkit();
              // Get the dimensions of the screen
              Dimension screenDimension = tk.getScreenSize();
              // Set the size
              setSize(620, 535);
              // Centre window on screen
              setLocation(new Point((screenDimension.width - 600) / 2, (screenDimension.height - 535) / 2));
              JComboBox notCombo = new JComboBox();
              notCombo.setPreferredSize(new Dimension(95, 40));
              notCombo.setEnabled(true);
              JComboBox notCombo2 = new JComboBox();
              notCombo2.setPreferredSize(new Dimension(95, 40));
              notCombo2.setEnabled(true);
              JComboBox dictionaryType = new JComboBox();
              dictionaryType.setPreferredSize(new Dimension(95, 40));
              dictionaryType.setEnabled(true);
              JComboBox dictionaryType2 = new JComboBox();
              dictionaryType2.setPreferredSize(new Dimension(95, 40));
              dictionaryType2.setEnabled(true);
              JPanel notPanel = new JPanel();
              JPanel dictionaryPanel = new JPanel();
              notPanel.setLayout(new GridLayout(2, 0, 10, 10));
              notPanel.add(notCombo);
              notPanel.add(notCombo2);
              dictionaryPanel.setLayout(new GridLayout(2, 0, 10, 10));
              dictionaryPanel.add(dictionaryType);
              dictionaryPanel.add(dictionaryType2);
              //Search button
              JButton searchButton = new JButton("Search");
              //Back button
              JButton backButton = new JButton("< Back");
              //Exit button
              JButton exitButton = new JButton("Exit");
              SpringLayout layout = new SpringLayout();
              getContentPane().setLayout(layout);
              layout.putConstraint(SpringLayout.NORTH, notPanel, 10, SpringLayout.NORTH, getContentPane());
              layout.putConstraint(SpringLayout.WEST, notPanel, 10, SpringLayout.WEST, getContentPane());
              layout.putConstraint(SpringLayout.NORTH, dictionaryPanel, 10, SpringLayout.NORTH, getContentPane());
              layout.putConstraint(SpringLayout.WEST, dictionaryPanel, 10, SpringLayout.EAST, notPanel);
              layout.putConstraint(SpringLayout.SOUTH, backButton, -10, SpringLayout.SOUTH, getContentPane());
              layout.putConstraint(SpringLayout.WEST, backButton, 10, SpringLayout.WEST, getContentPane());
              layout.putConstraint(SpringLayout.WEST, exitButton, 10, SpringLayout.EAST, backButton);
              layout.putConstraint(SpringLayout.SOUTH, exitButton, -10, SpringLayout.SOUTH, getContentPane());
              layout.putConstraint(SpringLayout.SOUTH, searchButton, -10, SpringLayout.SOUTH, getContentPane());
              layout.putConstraint(SpringLayout.EAST, searchButton, -10, SpringLayout.EAST, getContentPane());
              getContentPane().add(notPanel);
              getContentPane().add(dictionaryPanel);
              getContentPane().add(searchButton);
              getContentPane().add(backButton);
              getContentPane().add(exitButton);
         public static void main(String[] args) throws IOException
              JFrame search = new searchFrame();
              search.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              search.show();
    }On this one I want to keep the scroll pane centred (which it won't be at the mo) and I also want to keep the label saying so many results found to the scroll pane's right edge (which it won't be at the moment if the table moves because of the screen resizing).
    import javax.swing.*;
    import java.awt.*;
    import java.io.*;
    public class resultsFrame extends JFrame
         public resultsFrame()
              setTitle("Dictionary A'la Lewis");
              // Get the toolkit for reading System information
              Toolkit tk = Toolkit.getDefaultToolkit();
              // Get the dimensions of the screen
              Dimension screenDimension = tk.getScreenSize();
              // Set the size
              setSize(620, 535);
              // Centre window on screen
              setLocation(new Point((screenDimension.width - 600) / 2, (screenDimension.height - 535) / 2));
              //Search button
              JButton refineButton = new JButton("Refine");
              //Back button
              JButton homeButton = new JButton("Home");
              //Exit button
              JButton exitButton = new JButton("Exit");
              //Results Table
              JTable resultsTable = new JTable();
              resultsTable.doLayout();
              //Table's Scroll Pane
              JScrollPane tableScrollPane = new JScrollPane(resultsTable);
              tableScrollPane.setPreferredSize(new Dimension(520, 290));
              //Number of Results
              JLabel numberOfResults = new JLabel("0 results found.");
              SpringLayout layout = new SpringLayout();
              getContentPane().setLayout(layout);
              layout.putConstraint(SpringLayout.SOUTH, homeButton, -10, SpringLayout.SOUTH, getContentPane());
              layout.putConstraint(SpringLayout.WEST, homeButton, 10, SpringLayout.WEST, getContentPane());
              layout.putConstraint(SpringLayout.WEST, exitButton, 10, SpringLayout.EAST, homeButton);
              layout.putConstraint(SpringLayout.SOUTH, exitButton, -10, SpringLayout.SOUTH, getContentPane());
              layout.putConstraint(SpringLayout.SOUTH, refineButton, -10, SpringLayout.SOUTH, getContentPane());
              layout.putConstraint(SpringLayout.EAST, refineButton, -10, SpringLayout.EAST, getContentPane());
              layout.putConstraint(SpringLayout.NORTH, tableScrollPane, 10, SpringLayout.NORTH, getContentPane());
              layout.putConstraint(SpringLayout.WEST, tableScrollPane, 50, SpringLayout.WEST, getContentPane());
              layout.putConstraint(SpringLayout.EAST, numberOfResults, 0, SpringLayout.EAST, tableScrollPane);
              layout.putConstraint(SpringLayout.NORTH, numberOfResults, 5, SpringLayout.SOUTH, tableScrollPane);
              getContentPane().add(tableScrollPane);
              getContentPane().add(refineButton);
              getContentPane().add(homeButton);
              getContentPane().add(exitButton);
              getContentPane().add(numberOfResults);
         public static void main(String[] args) throws IOException
              JFrame result = new resultsFrame();
              result.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              result.show();
    }

  • Resizing Probs........

    i have two probs both related to Resizing .
    I am using a SpringLayout to resize my application.....
    everything is working Fine.
    Prob no 1 is that i am not able to fix the minimum size of the screen , the user can resize the screen to anyextent which ruins the GUi of the screen. Though i know i can trap the window resize event and if the size of the window is less then the size desired then change the size to the min preffered size ...but what i want is to STOp the user from even reducing the size from the desired size...
    Second prob is the resize of the Controlls in side takes place when i stop resizing the window but i want resizing of the controll to take place with the resizing of the screen not when i am done with the resizing

    Some of the skins have a minimum width requirements (the ones
    with ALL components have a 270 pixels wide minimum setting). You
    have to select a skin with a smaller width requirement such as any
    using just the PlayMute controlls (min 96 pix wide).
    Otherwise you'll have to create your own controller using the
    components in the component library.

  • SpringLayout:  How to anchor fields to container

    I've discovered the SpringLayout manager and I like it very much. However, I'm trying to do something quite simple. I basically have a horizontal row of text fields and I'd like to anchor the SOUTH edges of each text field to the SOUTH edge of the container. This way, when the window is resized, all of the text fields will grow the same to fill the container. Everything works fine if I use putContraint to set the SOUTH edge of the container to be SOUTH of a text field (one text field). But, once I add a second text field and set the south edge of the continer to be to the SOUTH edge of the second text field, I loose the SOUTH edge tacking of the first text field.
    Basically, I want to put up several text fields in a horizontal row and I want to tack the NORTH and SOUTH edges of each to the NORTH and SOUTH edges of the container so that when the window is resized, the heights of the text fields grow the same.
    How can I do this?

    Why not use SpringUtilities.makeGrid, as referred to in the SpingLayout tutorial?

  • Why is this button resized

    in this testcase, why is the first button resized, i am trying to have the content pane be as wide as the widest component but not affect them.
    package gaillard;
    import java.awt.EventQueue;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JButton;
    import javax.swing.Spring;
    import javax.swing.SpringLayout;
    import javax.swing.SpringLayout.Constraints;
    * @author gaillard
    public class Test
         SpringLayout layout = new SpringLayout();
         JFrame frame = new JFrame("Test");
         JPanel contentPane = new JPanel();
         JButton button = new JButton("TEST");
         JButton button2 = new JButton("Test2Andsome more");
         /** Creates a new instance of Test */
         public Test()
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setContentPane(contentPane);
              contentPane.setLayout(layout);
              contentPane.add(button);
              contentPane.add(button2);
              Constraints buttonCon = layout.getConstraints(button);
              Constraints buttonCon2 = layout.getConstraints(button2);
              Constraints contentPaneCon = layout.getConstraints(contentPane);
              buttonCon.setConstraint(SpringLayout.NORTH,
                        Spring.sum(contentPaneCon.getConstraint(SpringLayout.NORTH),
                                       Spring.constant(5)));
              buttonCon.setConstraint(SpringLayout.WEST,
                        Spring.sum(contentPaneCon.getConstraint(SpringLayout.WEST),
                                            Spring.constant(5)));
              buttonCon2.setConstraint(SpringLayout.NORTH,
                        Spring.sum(buttonCon.getConstraint(SpringLayout.SOUTH),
                             Spring.constant(5)));
              buttonCon2.setConstraint(SpringLayout.WEST,
                        buttonCon.getConstraint(SpringLayout.WEST));
              contentPaneCon.setConstraint(SpringLayout.EAST,
                        Spring.sum(Spring.constant(5),
                             Spring.max(buttonCon.getConstraint(SpringLayout.EAST),
              buttonCon2.getConstraint(SpringLayout.EAST))));
              contentPaneCon.setConstraint(SpringLayout.SOUTH,
                        Spring.sum(Spring.constant(5),
                             buttonCon2.getConstraint(SpringLayout.SOUTH)));
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args)
              EventQueue.invokeLater(new Runnable()
                                       @Override
                                       public void run()
                                            new Test();
    }

    sorry here is the code formated
    package gaillard;
    import java.awt.EventQueue;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JButton;
    import javax.swing.Spring;
    import javax.swing.SpringLayout;
    import javax.swing.SpringLayout.Constraints;
    * @author gaillard
    public class Test
         SpringLayout layout = new SpringLayout();
         JFrame frame = new JFrame("Test");
         JPanel contentPane = new JPanel();
         JButton button = new JButton("TEST");
         JButton button2 = new JButton("Test2Andsome more");
         /** Creates a new instance of Test */
         public Test()
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setContentPane(contentPane);
              contentPane.setLayout(layout);
              contentPane.add(button);
              contentPane.add(button2);
              Constraints buttonCon = layout.getConstraints(button);
              Constraints buttonCon2 = layout.getConstraints(button2);
              Constraints contentPaneCon = layout.getConstraints(contentPane);
              buttonCon.setConstraint(SpringLayout.NORTH,
                                            Spring.sum(contentPaneCon.getConstraint(SpringLayout.NORTH),
                                                         Spring.constant(5)));
              buttonCon.setConstraint(SpringLayout.WEST,
                                            Spring.sum(contentPaneCon.getConstraint(SpringLayout.WEST),
                                                         Spring.constant(5)));
              buttonCon2.setConstraint(SpringLayout.NORTH,
                                             Spring.sum(buttonCon.getConstraint(SpringLayout.SOUTH),
                                                           Spring.constant(5)));
              buttonCon2.setConstraint(SpringLayout.WEST,
                                             buttonCon.getConstraint(SpringLayout.WEST));
              contentPaneCon.setConstraint(SpringLayout.EAST,
                                                  Spring.sum(Spring.constant(5),
                                                                Spring.max(buttonCon.getConstraint(SpringLayout.EAST),
                                                                             buttonCon2.getConstraint(SpringLayout.EAST))));
              contentPaneCon.setConstraint(SpringLayout.SOUTH,
                                                  Spring.sum(Spring.constant(5),
                                                                buttonCon2.getConstraint(SpringLayout.SOUTH)));
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args)
              EventQueue.invokeLater(new Runnable()
                                          @Override
                                          public void run()
                                               new Test();
    }

  • Label disappears in SpringLayout

    re: Java Tutorial, How to Use SpringLayout
    http://java.sun.com/docs/books/tutorial/uiswing/layout/spring.html
    in SpringDemo3.java, given as an example on this page, i have added code to prevent the JTextField from changing size when the frame resizes.
    running the modified example, the JTextField does keep one size when the frame is resized.
    however, when the frame is expanded, the JLabel item disappears upwards out of the frame.
    why?
    the code i added was the following:
    Dimension tfSize = new Dimension(40, 20);
    textField.setMaximumSize(tfSize);

    The template node is also suited for label printing
    Ex.: standard smartform BC470_FLOWD_LABELS
    SAP Scripts:
    http://sappoint.com/abap/
    http://www.henrikfrank.dk/abapuk.html
    Smart forms
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.ossincorp.com/Black_Box/Black_Box_2.htm
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    reward points if helpful....

  • Resized animated gif ImageIcon not working properly with JButton etc.

    The problem is that when I resize an ImageIcon representing an animated gif and place it on a Jbutton, JToggelButton or JLabel, in some cases the image does not show or does not animate. More precicely, depending on the specific image file, the image shows always, most of the time or sometimes. Images which are susceptible to not showing often do not animate when showing. Moving over or clicking with the mouse on the AbstractButton instance while the frame is supposed to updated causes the image to disappear (even when viewing the non-animating image that sometimes appears). No errors are thrown.
    Here some example code: (compiled with Java 6.0 compliance)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test
         public static void main(String[] args)
              new Test();
         static final int  IMAGES        = 3;
         JButton[]           buttons       = new JButton[IMAGES];
         JButton             toggleButton  = new JButton("Toggle scaling");
         boolean            doScale       = true;
         public Test()
              JFrame f = new JFrame();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JPanel p = new JPanel(new GridLayout(1, IMAGES));
              for (int i = 0; i < IMAGES; i++)
                   p.add(this.buttons[i] = new JButton());
              f.add(p, BorderLayout.CENTER);
              f.add(this.toggleButton, BorderLayout.SOUTH);
              this.toggleButton.addActionListener(new ActionListener() {
                   @Override
                   public void actionPerformed(ActionEvent e)
                        Test.this.refresh();
              f.setSize(600, 300);
              f.setVisible(true);
              this.refresh();
         public void refresh()
              this.doScale = !this.doScale;
              for (int i = 0; i < IMAGES; i++)
                   ImageIcon image = new ImageIcon(i + ".gif");
                   if (this.doScale)
                        image = new ImageIcon(image.getImage().getScaledInstance(180, 180, Image.SCALE_AREA_AVERAGING));
                   image.setImageObserver(this.buttons);
                   this.buttons[i].setIcon(image);
                   this.buttons[i].setSelectedIcon(image);
                   this.buttons[i].setDisabledIcon(image);
                   this.buttons[i].setDisabledSelectedIcon(image);
                   this.buttons[i].setRolloverIcon(image);
                   this.buttons[i].setRolloverSelectedIcon(image);
                   this.buttons[i].setPressedIcon(image);
    Download the gif images here:
    http://djmadz.com/zombie/0.gif
    http://djmadz.com/zombie/1.gif
    http://djmadz.com/zombie/2.gif
    When you press the "Toggle scaling"button it switches between unresized (properly working) and resized instances of three of my gif images. Notice that the left image almost never appears, the middle image always, and the right image most of the time. The right image seems to (almost) never animate. When you click on the left image (when visble) it disappears only when the backend is updating the animation (between those two frames with a long delay)
    Why are the original ImageIcon and the resized ImageIcon behaving differently? Are they differently organized internally?
    Is there any chance my way of resizing might be wrong?

    It does work, however I refuse to use SCALE_REPLICATE for my application because resizing images is butt ugly, whether scaling up or down. Could there be a clue in the rescaling implementations, which I can override?
    Maybe is there a way that I can check if an image is a multi-frame animation and set the scaling algorithm accordingly?
    Message was edited by:
    Zom-B

  • How can I get just the text to resize, rather than the entire web page?

    I used to be able to re-size just text on a webpage by typing Ctrl + +. Today, the entire webpage re-sizes, and when I move to another page it reverts. (I see this mostly in Facebook.). Why did this change, and can I go back to having just the text re-size?

    ''How can I get just the text to resize -- zoom text only''
    steps
    #"Alt" if no menu bar, then
    # View > Zoom > Zoom Text Only
    Zoom text of web pages - MozillaZine Knowledge Base
    :http://kb.mozillazine.org/Zoom_text_of_web_pages
    <br><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small>

  • How can I implement a status bar at the bottom of a resizable application?

    Hello all,
    I am a JavaFx newbie and I am implementing an application (a Sokoban game), with a menu at the top of the frame and a gaming area covering the rest of the frame. To support the game, I have to load images at certain positions in the gaming area.
    The game also includes a level editor with another menubar and where images are set to other positions.
    I implemented this in another view, swiching from the game mode to the level editor mode and vice versa is just done by setting the other view visible. Up to now this works, here the important statements building these details:
    Group root = new Group();
    gameView = new Group(); // for gaming mode
    le_view = new Group()   // for level editor mode
    MenuBar gameMenubar = new MenuBar();
    Menu menuGame = new Menu(bundle.getString("MenuGame"));
    ... building the menu items and menues ...
    gameView.getChildren().add(gameMenubar);
    ImageView buildingView[][] = new ImageView[22][22];
    for (nCol = 0; nCol < 22; nCol++) {
        for (nRow = 0; nRow < 22; nRow++) {
            buildingView[nCol][nRow] = new ImageView();
            buildingView[nCol][nRow].setX(nCol * 26 + 5);
            buildingView[nCol][nRow].setY(nRow * 26 + 40);
            gameView.getChildren().add(buildingView[nCol][nRow]);
    gameView.setVisible(true);
    root.getChildren().add(gameView);
    ... same stuff to build the le_view ...
    le_View.setVisible(false);
    root.getChildren().add(le_View);
    Scene scene = new Scene(root, 800, 600, Color.CORNSILK); Now I want to introduce a status bar at the bottom of the frame, which of course has to follow the bottom of the frame, if it is resized. And of course the menu and the status bar should not grow vertically, if the height of the frame is increased.
    The implementation seems to be easy with StackPane for the frame and one BorderPane for each mode.
    For the first step I only tried implementing the game mode with only one BorderPane (just setting the menu, the gaming area and the status bar each into a HBox and setting these three HBoxes at the top, into the center and at the bottom). I also tried this via GridPane and via VBox; I always get any erroneous behaviour:
    Either the menubar is visible, but the menus do not pop up the menu items, or the anchor point of the menu and of gaming area are set 100 pixels left of the left frame border and move into the frame when the frame width is increased, or the menu is set 20 pixels below the top of the frame, or HBox with the menu grows when the frame height is increased, so that the anchor point of the gaming area moves down.
    Can you describe me a correct construction of such a frame? Thanks in advance.
    Best regards
    Gerhard

    Hello Gerhard,
    Glad the code helped, thanks for a fun layout exercise.
    For the draft code I just pulled an icon off the internet over a http connection.
    If you haven't done so already place any icons and graphics you need local to your project, so that resource lookups like:
    Image img = new Image("http://www.julepstudios.com/images/close-icon.png");become
    Image img = new Image("close-icon.png");then performance may improve.
    Another possible reason for your performance problem could be that when you use a vbox, the vbox content can overflow the area of the borderpane center and might be sitting on top of the menu pane, making you unable to click the menu (which is what happens to me when I try that with the draft program with the vbox wrapping mod, then resize the scene to make it smaller). This was a trick which caught me and the reason that I used a Group originally rather than a vbox. I found a vbox still works but you need to tweak things a bit. The trick I saw was that the order in which you add stuff to the borderpane is important. The borderpane acts like a stack where the last thing added floats over the top of everything else if you size the scene small enough. For your project you want the menu on top always, so it always needs to be the last thing added to the borderpane, but when you swap in the level pane for the game pane, then back out again, the game pane can end up on top of the menu which makes the menu seem like you can't click it (only when the scene is sized small enough). It was quite a subtle bug which took me a little while to work out what was happening. For me the solution was to add just one vbox to the center of the border, and then swap the game pane and the level editor in and out of the vbox, that way the center of the layout always stayed behind the menu bar and the status bar.
    I added some revisions to reflect the comments above and placed some comments in the code to note what was changed and why.
    public class SampleGameLayoutRevised extends Application {
      public static void main(String[] args) { Application.launch(args); }
      public void start(Stage stage) throws Exception {
        final BorderPane gameLayout = new BorderPane();
        final Group gameView = new Group();
        final MenuBar gameMenubar = new MenuBar();
        final Menu gameMenu = new Menu("Mode");
        final VBox centerView = new VBox();
        centerView.setStyle("-fx-background-color: darkgreen");  // we set a background color on the center view to check if it overwrites the game menu.
        MenuItem playGameMenu = new MenuItem("Play Game");
        MenuItem levelEditMenu = new MenuItem("Edit Levels");
        gameMenu.getItems().add(playGameMenu);
        gameMenu.getItems().add(levelEditMenu);
        gameMenubar.getMenus().add(gameMenu);
        final StackPane levelEditView = new StackPane();
        levelEditView.getChildren().add(new Text("Level Editor"));
        ImageView buildingView[][] = new ImageView[22][22];
        Image img = new Image("http://www.julepstudios.com/images/close-icon.png");  // use of http here is just for example, instead use an image resource from your project files.
        for (int nCol = 0; nCol < 22; nCol++) {
          for (int nRow = 0; nRow < 22; nRow++) {
            ImageView imgView = new ImageView(img);
            imgView.setScaleX(0.5);
            imgView.setScaleY(0.5);
            buildingView[nCol][nRow] = imgView;
            buildingView[nCol][nRow].setX(nCol * 20 + 5);
            buildingView[nCol][nRow].setY(nRow * 20 + 40);
            gameView.getChildren().add(buildingView[nCol][nRow]);
        final VBox statusBar = new VBox();
        final Text statusText = new Text("Playing Game");
        statusBar.getChildren().add(statusText);
        statusBar.setStyle("-fx-background-color: cornsilk"); // we set a background color on the status bar,
                                                              // because we can't rely on the scene background color
                                                              // because, if the scene is sized small, the status bar will start to overlay the game view
                                                              // and if we don't explicitly set the statusBar background the center view will start
                                                              // to bleed through the transparent background of the statusBar.
        gameLayout.setCenter(centerView); // we add the centerview first and we never change it, instead we put it's changeable contents in a vbox and change out the vbox content.
        gameLayout.setBottom(statusBar);
        gameLayout.setTop(gameMenubar);   // note the game layout is the last thing added to the borderpane so it will always stay on top if the border pane is resized.
        playGameMenu.setOnAction(new EventHandler<ActionEvent>() {
          public void handle(ActionEvent event) {
            centerView.getChildren().clear();  // here we perform a centerview vbox content swap.
            centerView.getChildren().add(gameView);
            statusText.setText("Playing Game");
        levelEditMenu.setOnAction(new EventHandler<ActionEvent>() {
          public void handle(ActionEvent event) {
            centerView.getChildren().clear();  // here we perform a centerview vbox content swap.
            centerView.getChildren().add(levelEditView);
            statusText.setText("Editing Level");
        playGameMenu.fire();
        Scene scene = new Scene(gameLayout, 800, 600, Color.CORNSILK);
        stage.setScene(scene);
        stage.show();
    }Other than that I am not sure of a reason for the slowdown you are seeing. In my experience JavaFX has been quick and responsive for the tasks I have been using it for. Admittedly, I just use if for a bunch of small trial projects, but I've never seen it unresponsive for a minute.
    - John

  • In Windows 8.1, the Thunderbird window keeps resizing

    I have a new Transformer T100A laptop, running Windows 8.1 Pro. I run Thunderbird in desktop mode. The height of the Thunderbird window keeps getting small, while the width remains the same. I usually have my folder mails in the top pane, and the open message in the bottom pane. When I open Thunderbird, it often, but not always, comes up with such a short window that I can't see any of the open message at all, and only a few lines of the messages in the folder. This happens often even when I haven't closed Thunderbird, but the computer has gone into battery saving mode. This is not a huge problem, but it's annoying to have to resize the window almost every time I use Thunderbird.

    Hi,
    You can try the steps in following article:
    Using Pictures from Active Directory
    http://msitpros.com/?p=1036
    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore,
    Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you
    completely understand the risk before retrieving any software from the Internet.
    For your reference, here is the similar thread with different method:
    http://social.technet.microsoft.com/Forums/en-US/d6e7b2c3-c343-4900-a01d-24bfb30357b6/is-there-a-solution-to-set-user-account-picture-from-active-directory-thumbnailphoto-attribute-in?forum=w8itproinstall
    Hope these would be helpful.
    Kate Li
    TechNet Community Support

Maybe you are looking for

  • Why does iTunes Store stop working when I try to view a certain category?

    When I go to the iTunes store, I try to browse through the different apps. For example, I will click on "Entertainment" then on "Top Free Apps" then it will show a blank screen then my computer will say iTunes is not responding and shuts off. What ca

  • OIM Ldap Sync Problems

    I am having a problem with LDAP integration. I have been working through the oracle manuals and the guide posted at http://onlineappsdba.com/index.php/2010/12/29/part-viii-optional-configure-ldap-sync-with-oim-11g-oim-11g-integration-with-ovdoid/. I

  • How can I change the view size to make it my default?

    the view size is way too small with pages that I open on Firefox. I want to change the size and I want to make it my default so I don't have to click on zoom in everytime I open Firefox. Where can I change this? I have Windows Vista.

  • UDDI registry in WLS 7.0

    I've set up a UDDI registry using uddiexplorer in WLS 7.0. I want to be able to do inquiries aginst this registry from other development tools, such as the CapeClear Developer Studio. When I used this particular tool it couldn't find any of the servi

  • SQL database to output xml

    I have created a database using Java and now would like to output the queries in .xml. How do I go about it. Please help!