NetBeans 6 Feature Highlight: Centering Of Swing Components

Prior to NetBeans 6 it was really hard to align two or more Swing components on center with Matisse. There's a new feature in NetBeans 6 for this operation.

In the following form I have a JTextArea and a JButton. I'd like to put the JButton into the center position, relative to the JTextArea:


I choose both components using the left mouse button while holding the Shift key. Now I can use the Align menu and choose Align Center to column:

The JButton becomes centered with the JTextArea: 

Moreover when I resize the form, the button still stays centered as it would be expected!


i need help, tutorials (videos and \*.pdf documents) explaining to me how to use netbeans to develop Java applications i.e. JEE apps, JSE apps and JME apps my email address - urgent

Posted by yaw boakye on červen 07, 2007 at 06:08 odp. CEST #

I've sent the links to videos and pdfs to your e-mail address.

Posted by Roumen on červen 08, 2007 at 01:14 dop. CEST #

Great stuff. Any plans of backporting this to 5.5 and 5.5.1?

Posted by Eugene on červen 08, 2007 at 01:39 dop. CEST #

No plans to backport it. Unless someone buys a NetBeans support package and requests the backport (and pays for it this way :). We could spend lots of time backporting various features but we prefer to move forward.

Posted by Roumen on červen 08, 2007 at 02:35 dop. CEST #

Backporting features is a bad idea Lets go forward and get more stuff into Netbeans6!! By the way... I like the RoR work but i am missing more PHP project suport like in Eclipse PDT as JavaScript like in Aptana I know that you have language files for it based on languages framework but i think PHP and JavaScript deserve more So PDT is good for PHP and Aptana is good with JavaScript but many times i need suport for both, but i have to drop one of the features Edit PHP or edit JS not both, and also obvious i perfer Netbeans as platform!! I know this features arent planed to NB6 ( Sad :( ) and i also know that the features i am talking are not developed by Eclipse core Team... I hope more people and companies start working on top of Netbeans Plataform, QtJambi for Netbeans would be nice too but Trolltech used Eclipse :(, it sucks! Why it makes things so hard :p

Posted by Porfirio on červen 08, 2007 at 01:04 odp. CEST #

Finally. Any possibility of using this with more than one thing or is this just too hard. As in this pattern: leftalignedthing <-> centered thing or leftalignedthing <-> centered thing <-> rigth aligned thing with someting above? I know i can use Borderlayout for something MOSTLY equivalent to the latter case, but it looses the platform default spacing that flowlayout and the mattisse layout use, and i don't think it works with the upper case anyway (or its inverse). A way to solve this btw is this little dance with swingx: pane.setLayout(new StackLayout()); final JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); panel.add(new JButton("a")); panel.add(new JButton("b")); panel.add(new JButton("c")); final JPanel panel2 = new JPanel(new FlowLayout(FlowLayout.TRAILING)); panel2.add(new JButton("d")); panel.setOpaque(false); pane.add(panel2, StackLayout.BOTTOM); pane.add(panel, StackLayout.TOP); //frame add add(pane, BorderLayout.SOUTH);

Posted by paulo on červen 08, 2007 at 04:47 odp. CEST #

Porfirio: we are working on Javascript support, so more will come in 6.0. PHP is also planned, but the support will be very basic.

Paulo: not sure what exactly you mean but I think the centering works properly on more components, too.

Posted by Roumen on červen 09, 2007 at 04:26 dop. CEST #

Will Matisse provide a snapshot function which is provided in ItelliJ IDEA. It is so cool and create GUI quickly.

Posted by hantsy on červen 09, 2007 at 11:07 odp. CEST #

Can you explain me what the snapshot function is? I can't find it using google... thanks.

Posted by Roumen on červen 10, 2007 at 01:39 dop. CEST #

There is a flash demo: This function is introduced in the 6th section.

Posted by hantsy on červen 10, 2007 at 07:55 dop. CEST #

Interesting feature, indeed. It would be nice to support it. I have not heard of concrete plans to do something like this, although there were some discussions about importing of swing forms.

Posted by Roumen on červen 10, 2007 at 07:59 dop. CEST #

Does this need any update to GroupLayout for this to work, or will it just work with the one included in Java SE 6? I'm hoping I wont have to bundle an extra JAR with my application, but I cant see how Matisse could continue to add layout features without requiring updates to GroupLayout in the JDK.

Posted by Ben Loud on červen 11, 2007 at 09:18 odp. CEST #

As far as I know it should work with the default GroupLayout from the JDK. If you have any problems with it please let me know.

Posted by Roumen on červen 12, 2007 at 02:27 dop. CEST #

Post a Comment:
Comments are closed for this entry.

Roman Strobl


« červenec 2016