• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

netbeans layouts or other layouts not possible to use in the SCJD Examination

 
conny pemfors
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Wonder whether it is possible to use a developed GUI in netbeans with consisting layouts, (absolutelayout), I guess not so I redesigned the gui with GridBagLayout and still had some problems with the package org.jdesktop.layout.GroupLayout when compiling from command line.
anybody who knows if it is acceptable to use these layouts during SCJD examination.

best regards.
Conny

suncertify\gui\RecordHandlePanel.java:313: package org.jdesktop.layout does not exist
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
^
suncertify\gui\RecordHandlePanel.java:313: package org.jdesktop.layout does not exist
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
^
suncertify\gui\RecordHandlePanel.java:318: package org.jdesktop.layout does not exist
.add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE)
^
suncertify\gui\RecordHandlePanel.java:317: package org.jdesktop.layout does not exist
.add(buttonPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE)
^
suncertify\gui\RecordHandlePanel.java:316: package org.jdesktop.layout does not exist
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
^
suncertify\gui\RecordHandlePanel.java:322: package org.jdesktop.layout does not exist
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
^
suncertify\gui\RecordHandlePanel.java:326: package org.jdesktop.layout does not exist
.add(buttonPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jde
sktop.layout.GroupLayout.PREFERRED_SIZE))
^
suncertify\gui\RecordHandlePanel.java:326: package org.jdesktop.layout does not exist
.add(buttonPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jde
sktop.layout.GroupLayout.PREFERRED_SIZE))
^
suncertify\gui\RecordHandlePanel.java:326: package org.jdesktop.layout does not exist
.add(buttonPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jde
sktop.layout.GroupLayout.PREFERRED_SIZE))

^
suncertify\gui\RecordHandlePanel.java:325: package org.jdesktop.layout does not exist
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE
)
^
suncertify\gui\RecordHandlePanel.java:325: package org.jdesktop.layout does not exist
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE
)
^
suncertify\gui\RecordHandlePanel.java:324: package org.jdesktop.layout does not exist
.add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 305, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
^
suncertify\gui\RecordHandlePanel.java:324: package org.jdesktop.layout does not exist
.add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 305, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
^
suncertify\gui\RecordHandlePanel.java:321: package org.jdesktop.layout does not exist
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
^
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I believe it is quite clear from SUN that external libraries are not allowed..

On this website, they suggest to use GridBagLayout instead: How to Use GroupLayout

Otherwise, if you want to code by hand and do not want to use GroupLayout, then GridBagLayout is recommended as the next most flexible and powerful layout manager.


Very good site on SUN's Layout Managers: Visual guide to Layout Manager

==> It seems that GroupLayout is available in Java SE 6..: javax.swing.GroupLayout

Please keep us posted on your finding on this subject.

Thanks!
Alex
[ November 13, 2007: Message edited by: Alex Belisle Turcot ]
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use a null layout in my main GUI. That way I can use absolute positioning with x and y positions. Some people may argue that this is not OK but the way I read it, it is, as long as I explain it in choices.txt. It gives absolute control of where you want an element to appear as well as it's size. Just my opinion, but I'm sticking to it!
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, you allow me to give you my opinion too ?

I don't approve your choice and I think you might be loosing points over that..
Layout managers are pretty easy to use. Just think on the number of hours spent on locking... give the layout manager 4-5 hours, they deserve it

=> At the very least, I would suggest you test your application on 1024x768 and 800x600. I would even push 1 bigger size and 1 smaller size..

Rgds,
Alex
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know how to use layout managers and probably will use them in other parts of my application. They are pretty easy to use, but DON'T always allow you to put things where you want them. I absolutely plan to test my application on different screen resolutions, and already have with just one to be sure it resizes correctly. I have a Mac, a Linux box as well as several Windows PCs and will run the app on all of them. I'm holding my ground on the null layout.
 
conny pemfors
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I switched the code from org.... to javax.swing.GroupLayout, before I was compiling with JDK 1.5_12, and to be able to compile this in commandline I used 1.6_03, and actually it works really well with GridbagLayout and GroupLayout, my only question is if it is ok to use 1.6 as well, since they are not part of the 1.5 swing package, (considering GroupLayout.);

code:
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);


layout.setHorizontalGroup(layout.createParallelGroup().addComponent(buttonPanel,javax.swing.GroupLayout.DEFAULT_SIZE,519,Short.MAX_VALUE).addComponent(jPanel2,javax.swing.GroupLayout.DEFAULT_SIZE,519,Short.MAX_VALUE));


layout.setVerticalGroup(layout.createParallelGroup().addComponent(jPanel2,javax.swing.GroupLayout.PREFERRED_SIZE,305,javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(buttonPanel,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE));
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic