LayoutManager « Layout « Java Swing Q&A





1. Java GUI LayoutManagers    stackoverflow.com

I'm busy with an asignment where i have to make a graphical interface for a simple program. But i'm strugling with the layout. This is the idea:
Layout Example<?xml version="1.0" encoding="Windows-1251"?> <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo"> <xsl:output ...

5. Swing: Problem distinguishing between user-induced and automatic components resizing (Writing a custom LayoutManager)    stackoverflow.com

I'm trying to write an own layout manager. Components must be placed and sized relative to each other.
This means: when the user drags or resizes an component, some other components (but not ...

6. Searching for a Java layoutmanager which hides elements if space is getting short    stackoverflow.com

I'm searching for a Java layoutmanager which is able to automatically hide (less important) elements, defined by me, if the user scales down the window size. For example an icon in a ...

7. How to build a custom draw2d layoutmanager?    stackoverflow.com

I would like to have a layout manager that can arrange two elements as follows:

  • one main element ABCDEF centered
  • one "postscript" element XYZ, positioned on the top right corner of the encapsulating ...

8. Saving LayoutManager    stackoverflow.com

import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class LayoutTest extends JFrame {

    public LayoutTest() {
        initComponents();
    }

  ...

9. Which layoutmanager to use?    stackoverflow.com

I'd like to create a JPanel in java with a layout similar to the one below. Any ideas? enter image description here





10. Java LayoutManager: Looking for a LayoutManager similar to GTK's horizontal and vertical boxes    stackoverflow.com

Okay, I spoiled myself by playing around with GTK layouts, and now I've started thinking about windows layouts in GTK's terms and can't find an appropriate LayoutManager to use. I'm specifically looking ...

11. Java Swing: Choosing the correct LayoutManager    stackoverflow.com

I'm building a PropertyPanel. Currently I'm using a GridLayout to manage the JLabels and their corresponding fields where I can specify the value. But the problem is that the GridLayout automatically ...

12. JPanel doesn't call addLayoutComponent() of custom LayoutManager    stackoverflow.com

I need to create a custom LayoutManager to be used by a JPanel. However, when I add a Component to the JPanel, the JPanel doesn't call the addLayoutComponent() method of my custom ...

13. How can I prevent a LayoutManager from shrinking my components too much?    stackoverflow.com

How can I prevent GUI components from shrinking on resizing in a BorderLayout Manager? Is it possible to set a minimum size so that components do not shrink beyond it? It ...

14. YUI Resize within LayoutManager    stackoverflow.com

When I place YUI resizeables with knobhandles inside one of the panels of a LayoutManager, the knobs are incorrectly positioned, most noticeably, the knobs that should be in the middle of ...

15. suitable LayoutManager for resizable components    stackoverflow.com

sometime ago I read this article that shows a way to implement mouse resizable components in Swing. The author uses a null LayoutManager in order to allow absolute component positioning. I ...

16. Which LayoutManager should I use for my Java GUI?    stackoverflow.com

I want to make a GUI and do it through code rather than dragging everything around like in Netbeans. I would like to, if possible, set the coordinates for each thing ...





17. [platform-dev] Problems with FixAspectRatio Layoutmanager in Topcomponent    forums.netbeans.org

Oliver Rettig Posted via mailing list. Posted: Tue Aug 31, 2010 8:37 am Post subject: [platform-dev] Problems with FixAspectRatio Layoutmanager in Topcomponent Hallo, I have problems with an Layoutmanager which I have set into a TopComponent. The attached layoutmanager works fine in JFrame but it is ignored in a Topcomponent if I set it directly as layoutmanager of ...

18. change panel added to a layoutManager...    coderanch.com

Hi, You mean to say you want to change the contents of Edit Panel?! If, so before removing existing components or adding new components call the method invalidate() then after everything has been modified call the method validate(). in some case you may need to call repaint() also after validate(). But, I suggest you use a new panel and use the ...

19. need help: formated text + background image + JScrollPane + Swing + LayoutManager    coderanch.com

Hi I want to display a help window with Swing, this window should display a formated text with an image in the background and an "OK" Button down under to close the window, furthermore I need a Scrollbar to scrolldown the text. At the moment I use an JEditorPane to load an HTML formated file which includes the background image in ...

21. LayoutManagers and containers    coderanch.com

23. GridBagLayout as Layoutmanager for JFrame    coderanch.com

import java.awt.*; import javax.swing.*; public class GridBagLayoutTest { public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container cp = f.getContentPane(); cp.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0; gbc.weighty = 1.0; int[] gws = { 1, GridBagConstraints.RELATIVE, GridBagConstraints.REMAINDER }; for(int j = 0; j < 9; j++) { gbc.gridwidth = gws[j % 3]; cp.add(new JButton("button ...

24. Which LayoutManager To Use ?    coderanch.com

25. JPanel and LayoutManager    coderanch.com

Hey My program fills a panel with checkboxes dynamically and I want the panel to stretch accordingly to the amount of content, this works fine as long as I keep the window at the same size at runtime as I do when I'm working in NetBeans. However, if I try to maximize the window, the panel suddenly gets greedy and takes ...

26. Liquid LayoutManager    coderanch.com

Hi, I want to implement a LayoutManager which places contained elements one after the others in a row (horizontal, then I will write also a vertical version of the same LayoutManager). I use widgets which resizes themselves, and I need when an element is resized to move the widgets after it so that they do not overlap or there is no ...

27. Layout problem - somebody knows which LayoutManager to use?    coderanch.com

Hello everyone! I have a little layout problem. The general layout I use is BorderLayout. I have components on top, bottom and in the center. The centered component consists of four components. There is a graph, the y and x axis and an empty box, as you can see in the picture attached. Now the y axis shouldn't stretch horizontally, the ...

28. What layoutmanager is suitable for forms.    java-forums.org

I need to use java to create a form. Unfortunately I'm not allowed to use some graphic builder. I think this is a very hard assignment and I keep having problems using layoutmanagers. There is a null-layout which doesn't work when resizing the frame and is hard when you want to extend the frame/panel. You also need to create a helpvariable ...

29. Changing buttonsizes in layoutmanager    java-forums.org

Here I have a code to make a game board. My problem is that I want to change the buttonsize in the grid. Im working with a gridbaglayout so i cant simply use the button.setSize() method.. I tried a lot but nothing seems to work. Here is the code: Java Code: import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; ...

30. LayoutManager Best Choice    java-forums.org

For instance, this simple GUI has a JPanel that uses GridBagLayout for the JLabels and JTextFields in the upper left corner, a JPanel that uses FlowLayout for the buttons below this, a JPanel that uses BoxLayout to hold the GridBagLayout JPanel and the FlowLayout JButton panel, and a JPanel that uses BorderLayout to hold the BoxLayout JPanel on the left and ...

31. question about LayoutManager    java-forums.org

32. What is calling LayoutManager.layoutContainer?    java-forums.org

Hi, so I have some code that calls setVisible for some JComponent instances. Inside the setVisible function, the layoutContainer function of the layout manager associated to the parent of the components is called, which is as expected, but then it is called another time after all the calls to setVisible exit and I don't understand where this call can come from. ...

33. Swing and LayoutManagers    java-forums.org

34. Help with LayoutManagers    java-forums.org

Hi, I would like to create a JFrame with the following setup: A contentPane with 3 panels added called topPnl, middlePnl and lowerPnl aranged from top to bottom. There is an array of smaller panels called slotPanels[] that each hold a single JComboBox called slots[]. There is a loop that adds a certain number of these panels in a gridLayout to ...

35. Different LayoutManagers, ChartPanels, and JPanels    jfree.org

Is there any problem with adding a ChartPanel to a GUI and using one layout manager when the JPanel into which the ChartPanel is added uses a different layout manager? For example, if I use NetBean's GUI builder (NetBeans 6.0.1) to initially build an application, javax.swing.GroupLayout is used to layout all of the panels and buttons, etc. in the generated code. ...

36. Best practise layoutmanager    forums.oracle.com

I use layoutmanager and have two layer : gridlayer with 16 JButtons and one consoll-layer with "end" "try again" "start" now i want to change both layer....what is best practise should i make new layer above layer or should i make new ones... if i make new, my problem is to make the gridlayer as big as it was before(not change ...

37. LayoutManager vs Null LayoutManager    forums.oracle.com

38. Using LayoutManagers    forums.oracle.com

I am having trouble laying out an applet. I am trying to get two buttons to sit next to each other in the bottom-right of an applet at the same size as each other. I have tried GridBagLayout, BoxLayout, GridLayout and am now experimenting with JPanels but I'm not getting very far at all. If someone could recommend a method for ...

39. ..do not understand the LayoutManager behaviour...    forums.oracle.com

Hi! I have some difficulties whith layout managers, please see the picture (it took hours to draw it .... ): In my application JPanel1 should get as much height as possible, and JScrollPane and JPanel4 only as much height as needed to paint the buttons and so on... Actually, JScrollPane receives not enough height, and only the lower half of the ...

40. Simple LayoutManager issue    forums.oracle.com