Netbeans, Matisse, Swing, JDK5 & JDK6

This is more a related to a combination of Netbeans, the JRE and Swing.
I'm developing a Swing application in Netbeans (currently NB 6 M10) with JDK/JRE6. I'm using Matisse so there is quite a bit of code automatically generated for Swing components by Netbeans in my classes.
Yesterday I wanted to give a copy of my application to a friend to test, but he only has JRE5 installed. Aha, I thought, I'll just re-compile using JDK5. Unfortunately lots of Netbean's auto-generated code fails to build. I think it's mostly the layout related that fails.
Does anyone know if it's somehow possible to re-generate this code automatically under JDK5? I read somewhere there were no API changes between JDK5 and JDK6 (apologies if I'm mis-informed).
Thanks

if you have already switched the platform to JDK5 then you need to give him the dist folder because the problem is that in the JDK6 API the GroupLayout class was added which was not in JDK5. Netbeans worked around this for users with JDK5 by including a library called swinglayouts.jar, and it is packaged in the dist folder of your project. so just send that folder to your friend and you should be good.
null
Message was edited by:
kerryblue19

Similar Messages

  • Applet Won't work out of NetBeans W/Swing

    My Applet is working in NetBeans sun AppletRunner, but won't run in a browser and gives this exception:
    java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
         at java.lang.Class.getConstructor0(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)And my Applet extends javax.swing.JApplet, so whats wrong?

    Did you specify the jar in the archive attribute of the applet element tag?
    http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html#plugin
    Of course this does not help if the class is not in the jar though. :-/ (which seems very strange)
    -Puce

  • Using NetBeans Matisse to build a form with an array of JButtons

    With Matisse I can build a form with a lot of buttons on it, but i want to use a 2-dim array of JButtons so that I can easily access the buttons. How should I do this?

    Code it by hand. It's not that hard.
    JButton [][]buttons = new JButton[NUM_ROWS][NUM_COLUMNS];
    for (int row = 0; row < NUM_ROWS; row++) {
       for (int row = 0; row < NUM_ROWS; row++) {
          buttons[row][col] = new JButton();
          // set other properties of buttons[row][col]
    }If there is a lot of stuff, you could even make a separate method for creating a single button:
    private JButton createButton()
       JButton button = new JButton();
       // whatever else
       return button;
    }Then, in the "for" loops:
    buttons[row][col] = createButton();

  • NetBean Swing or Swing without NetBean

    In previous posts I have mentioned about me using BlueJ. Ive tried NetBeans IDE and find it better than BlueJ so I am using NetBeans now. One area of NetBeans uses Swing GUI components which allows you to build GUIs and creates the source code for you. There seems to be alot of information in the Oracle tutorials on Swing outside Netbeans. and at the moment I am still learning the Java programming language and do not know how important learning Swing is. This leads me to the question: Is using Swing in NetBeans enough to get by in creating GUIs or what aspects in Swing are the most important to use in conjunction with Swing in NetBeans?

    You can do desktop or web application development (there are others). I suggest you do web application development instead of desktop since I believe there are more employment opportunites there. If you decide to go that route, I suggest you dump Swing and go with JSF. Its part of the recommended JEE technology stack (http://www.oracle.com//technetwork/java/javaee/tech/index.html). I also suggest you use either Netbeans IDE or Eclipse IDE since they are the most popular with experienced developers. You'll also need a (free) database. I suggest Oracle Express. For a server: Tomcat or Glassfish.
    I suggest the first book you read is on Java, then on Servlets, then on  JSF. I suggest you keep away from JSP, its older technology. However, you will eventually need to read up on it since so many web applications are written with it. You will probably need to maintain those types of web applications when employed. Which other technologies to study and in which order in the above mentioned link is a subject for another day.

  • How to read the Java source code (in Netbeans)

    I use OS X10.5.5, NetBeans 6.1 and JSE 6 on a 64 bit mac.
    When I downloaded NB6.1 it had JSE 5 as it's default (and only) java platform. I ran Software Update to get Java 6 from Apple, used the Java Prefrences utitlity to set JSE6 as default. In NB I added the JDK6 platform, registered the JDK6 javadocs and noticed that I also have the option of registering the Java source code.
    I have three questions:
    1) How do I make JDK6 the default in NetBeans. The JDK5 keeps being default after I did the steps above and I don't see anywhere to change that.
    2) How do I read the Java 6 source code? I can see sun provides [source code| http://download.java.net/jdk6/] for their supported platforms. I dont see Apple doing the same for its JDK port. What would I need to do to get to read the java SE6 sources? or is it actually hiding somewhere in the /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home hierarchy?
    3) Where does the JVM look for the binary code to run when I make a call to, say java.util.ArrayList or any other library. In my naivety I would have assumed it would be a .class file somewhere in the java Home folder, but I don't see anything like it.
    thanks in advance,
    chris

    This is taken from the help included with netbeans. In response to question 1.
    By default, the IDE uses the version of the Java SE platform (JDK) with which the IDE runs as the default Java platform
    for compilation, execution, and debugging. You can view your IDE's JDK version by choosing Help > About and clicking the
    Detail tab. The JDK version is listed in the Java field.
    You can run the IDE with a different JDK version by starting the IDE with the --jdkhome jdk-home-dir switch on the command line
    or in your IDE-HOME/etc/netbeans.conf file. For more information, see IDE Startup Parameters.
    In the IDE, you can register multiple Java platforms and attach Javadoc and source code to each platform. For example, if you
    want to work with the new features introduced in JDK 5.0, you would either run the IDE on JDK 5.0 or register JDK 5.0 as a
    platform and attach the source code and Javadoc to the platform.
    In  , you can switch the target JDK in the Project Properties dialog box. In  , you have to set the target JDK in the Ant script itself,
    then specify the source/binary format in the Project Properties dialog box.
    To register a new Java platform:
    Choose Tools > Java Platforms from the main window.
    Click New Platform and select the directory that contains the Java platform. Java platform directories are marked with a  
    in the file chooser.
    Use the Sources and Javadoc tabs to attach Javadoc documentation and source code for debugging to the platform.
    Click Close.
    To set the default Java platform for a standard project:
    Right-click the project's root node in the Projects window and choose Properties.
    In the Project Properties dialog box, select the Libraries node in the left pane.
    Choose the desired Java platform in the Java Platform combo box.
    Switching the target JDK for a standard project does the following:
    Offers the new target JDK's classes for code completion.
    If available, displays the target JDK's source code and Javadoc documentation.
    Uses the target JDK's executables (javac and java) to compile and execute your application.
    Compiles your source code against the target JDK's libraries.
    If you want to register additional Java platforms with the IDE, you can do so by clicking the Manage Platforms button.
    Then click the Add Platform button and navigate to the desired platform.
    To set the target Java platform for a free-form project:
    In your Ant script, set the target JDK as desired in the javac, java, and javadoc tasks.
    Right-click the project's root node in the Projects window and choose Properties.
    In the Sources panel, set the level of JDK you want your application to be run on in the Source/Binary Format combo box.
    When you access Javadoc or source code for JDK classes, the IDE searches the Java platforms registered in the
    Java Platform Manager for a platform with a matching version number. If no matching platform is found, the IDE's default platform is used instead.
    See Also
    Managing the Classpath
    Declaring the Classpath in a Free-Form Project
    Stepping Through Your Program
    Legal Notices

  • Created GUI using Matisse, can't get text on jPanel

    Hello, I am tying to build my first desktop application. I created a test GUI using Netbeans Matisse.
    When the button is pressed I want that the text string stored in the variable text appears on jPanel1. The String is retrieved from a database (that's not a problem).
    How to get the text onto jPanel1?
    Here's the GUI code:
    package prototype4;
    import java.awt.Color;
    import spin.Spin;
    public class newGUI extends javax.swing.JFrame {
        /** Creates new form newGUI */
        public newGUI() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            rolloverProducer1 = new org.jdesktop.swingx.RolloverProducer();
            jPanel1 = new javax.swing.JPanel();
            jPanel2 = new javax.swing.JPanel();
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(0, 376, Short.MAX_VALUE)
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(0, 127, Short.MAX_VALUE)
            jButton1.setText("Start");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
            jPanel2.setLayout(jPanel2Layout);
            jPanel2Layout.setHorizontalGroup(
                jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel2Layout.createSequentialGroup()
                    .add(140, 140, 140)
                    .add(jButton1)
                    .addContainerGap(173, Short.MAX_VALUE))
            jPanel2Layout.setVerticalGroup(
                jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                    .addContainerGap(39, Short.MAX_VALUE)
                    .add(jButton1)
                    .add(36, 36, 36))
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(55, Short.MAX_VALUE))
            pack();
        }// </editor-fold>                       
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        // spin off   
            DAOUser daouser = (DAOUser) Spin.off(new DAOUserImpl());
            String text = daouser.getString();
            System.out.println(text);
            //jPanel1.
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new newGUI().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JButton jButton1;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPanel jPanel2;
        private org.jdesktop.swingx.RolloverProducer rolloverProducer1;
        // End of variables declaration                  
        }

    The code you posted is basically of no use to use since it uses custom Matisse classes.
    Learn how to write a Swing app without a GUI builder. Learn how to use Layout Managers on your own.
    If you want to display text on a panel then you would do:
    panel.add( label );
    panel.revalidate();
    Whos know what will happen with your code because I have no idea what the Matisse Layout Managers do.
    Read the Swing tutorial on [url
    http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]How to Use Layout Managers.

  • Eclipse Swing project import Jdeveloper

    Hello I build my Swing Porject in Eclipse. How can i integrate this swing classes in jdeveloper and work with them.
    I import the swing projecti file->new->projects->project from existing source. but i have not a design view.
    How i can generate the new JBinit method in my swing code?
    How i can binding this swing in ADF?
    I see the videos but there is not a example how i build this.
    example Code (eclipse):
    class RegistryPanel {
    private JTextArea nutzung = new JTextArea(10,50);
         private JScrollPane pane = new JScrollPane(nutzung);
         private JLabel uberschrift = new JLabel("Registrierung");
         private JButton accept = new JButton("Akzeptieren und Registrieren");
         private JButton cancel = new JButton("Abbrechen");
         public RegistryPanel(boolean auswahlFensterAnzeigen){
              uberschrift.setFont(new Font("Calibri",Font.BOLD, 20));
              this.setLayout(gbl);
              anrede.addItem(" ");
              anrede.addItem("Herr");
              anrede.addItem("Frau");
         // ‹berschrift
              gbc = wpc.gbcCreator(0, 0);
              this.add(uberschrift);
         //1. Zeile
              gbc = wpc.gbcCreator(0, 1);
              gbc.anchor = GridBagConstraints.EAST;
              gbc.insets = new Insets(0, 0, 10, 0);
              this.add(new JLabel("Anrede*"), gbc);
         ...

    Hi,
    we do have plans for supporting NetBeans' Matisse in a future version of JDeveloper. Until then JDeveloper expects the layout definition to be part of the jbinit() method. However, adding the required libraries to the JDeveloper project you should be able to at least use the code editor for further developing the project
    Frank

  • Swing JTabbedPane problem!!!!!!!!

    hi guys
    i create the UI by GUI builder of NetBeans IDE. i want to add two JPanels in JTabbedPane. But the everytime i drag the JPanel into JTabbedPane. NetBeans will generate the code and arrange two JPanels by GroupLayout. i dont want to have GroupLayout to mange the these two JPanels in JTabbedPane.
    Also i know i to do it by coding manually. But I want to execute in NetBeans. Is there any properties i have to change in Netbeans.
    thanks in advance

    I'm currently running jdk1.6.0, although the problem occurred while running on jdk1.5.x as well. It should be noted that I'm running this on Linux, using the official JDK from Sun (not gcj or anything of the sort). The application is written in pure Swing, no AWT canvases etc. Thus far, all testing has been performed exclusively on Linux and in all cases the results have been the same (I've tested with at least 2 distributions: Slackware and Mandriva 2007).
    As for development tools, the problem occurs both with the new Netbeans 5.5 (and possibly older versions, though I haven't checked) as well as eclipse running the MyEclipseIDE plugin which contains a port of the Netbeans Matisse GUI development framework. While it is possible the IDEs are generating poor code, I doubt that is the problem.
    I'll need to set up a Windows box and try it out on that. If the problem still occurs, I'll write a minimal program to replicate the problem and post it here.
    Thanks for the replies

  • Custom JTable rendering in Matisse?

    I am new to Swing development and need to show some tabular data in a jtable and a value in one of the colums determines the backgound colur for that row. I have done some investigation and it appears that you can subclass JTable and override the prepareRenderer() method to achieve this. How do you do this in the Netbeans Matisse editor, when I try to do this the IDE wont let me overwrite code that the IDE maintains.
    Any help greatly appreciated.
    Thanks
    C

    From NetBeans Help:
    To modify a form component's guarded block:
    In the Inspector window, select the component whose initialization code you want to edit.
    Click the Code button at the top of the Properties window to view the Code properties.
    Select the property you wish to edit and enter the desired value.
    The IDE updates the selected component's guarded code block with the new value.
    (Help | Java Applications | Building Java GUIs | Designing Java GUIs | Modifying GUI Source Code)

  • Netbeans Vs Eclipse .which one is best ?

    hello,
    My project work related to SNMP protocol. In my project I need to get and set data in a remote wireless device. for this , I want to know which one IDE (netbeans or eclipse) shall i use for my project.
    now I am working in netbeans. but, the problem is it may strucking up some times and it takes some time while getting data and also at that time it struck.
    If any one use the both IDEs, give your suggestions.
    thank you.

    I use netbeans at work, I am currently using the
    latest release. I find it quite slow, and it hangs
    quite often for periods of anything between 10
    seconds and 2 minutes.
    One of my colleagues is now using eclipse as he was
    having similar problems with netbeans, and I am
    thinking of changing to eclipse.
    I will wait until I get a ram upgrade for my work
    machine though, as this could be the reason I am
    experiencing this.I used to have this problem too whenever I unplugged my computer and it was running off of battery (I'm using a laptop). It frustrated me for a long time until someone suggested it was my power settings. I also noticed in the interim that it wasn't just NetBeans, it was all my Java programs. My graphics card (ATI Radeon) was optimizing for battery life when my computer wasn't plugged in. So I adjusted my power settings and now NetBeans works fine whether or not my computer's plugged in.
    I did briefly use Eclipse before I changed my power settings, and it didn't seem to suffer from the same problems NetBeans did. I think it's due to the fact that NetBeans uses Swing whereas Eclipse uses SWT.

  • How to 'Build' a swing designer?

    Hi !
    I know that's a too complex question to answer, I know, but I would be gratefull if someone can point me on the right direction on this. I'm trying to figure out how a round trip visual designer (like JBuilder 7 one) works. I've got few ideas/questions in mind:
    a) Parsing code, (maybe antlr) and building the interface as parsing. Haaard ! (well all is hard :-)
    b) instaniate the class (Component) and then insert widgets on the fly (beans) using byte code instrumentation like bcel or similar and then decompile the class with the changes to get back source code
    c) Why using a third file (.form) like Netbeans Matisse does ?
    d) does anybody knows a gui designer opensource project that I can take a look and see how it works ? (Maybe stetic from monodevelop, but prefer java)
    I would be glad if anybody can give me some points or insights on this topic. thanks in advace to all, cheers and sorry for my poor english ! :-)

    user7435095 wrote:
    ..I would be glad if anybody can give me some points or insights on this topic. The world already has enough (too many) free blooming D'n'D' GUI designers for Java.
    ..thanks in advace to all, cheers and sorry for my poor english ! :-)Your English is far better than my (insert you language here). But in future, could you put a single upper case letter at the start of every sentence? It helps mark the distinction between parts, and makes the post easier to read.

  • Newbie question : import statements

    So, i'm a complete java newbie trying to make his first swing application, a basic calc. I download NetBeans 6.5, install it, and begin to code. I quickly learn about the Matisse GUI editor, find it very easy to use, and in a couple hours, the work is done and runs very fine.
    But looking at my code, I realize I have forgotten all import statements (like import javax.swing, import java.awt.event ....), nevertheless the application runs fine. I suppose then that the Netbeans compiler automatically corrects my mistakes, but I want to do it right.
    So, I write the import statements explicitly in my code and I get a warning message : "import unused". After that, I find out about the "fix import" tool in Netbeans, use it and all my import statements disappear. I guess i'm missing something here.
    I thought import of swing classes were mandatory to write a swing application. I have NO import statement in my code, even if I'm using jFrames, jButtons, event handlers and the program works fine, why ?
    Would I be able to compile this importless code in another environment (let's say Eclipse or even javac) ?
    I'm using JDK 1.6 and Netbeans 6.5 with Windows XP.
    TIA

    glawen wrote:
    Ok, thanks for the answers, and sorry for my misinterpretation of BigDaddyLoveHandles's first post. I understand now, the import statements are useful only if you don't want to write full class names, and the generated code uses full class names so no import needed.Please also understand BigDaddyLoveHandles's latest post. If you learn to code Swing with NetBeans' Matisse, then you will be learning Matisse, not Swing. When it comes time to try to tweak or upgrade your program, you will be lost. Better is to learn Swing from the ground up by going through the Sun Swing tutorials. Though having said that, if you are very new to the language, better still is to learn the fundamentals of Java first before embarking in the murky waters of GUI programming. Best of luck to you in your endeavors.

  • How to Force Internet Explorer specific Java Runtime Environment?

    Problem: UConn uses a tool called Blackboard. Blackboard requires Version 1.5.0 (build 1.5.0_07-b03)
    but I develop so NETBeans IDE needs/wants JDK6 ( likes JDK 6 Update 16 )
    Tried managing add-ons in IE, Tried Firefox too.
    What I want is to have IE forced to the JDK5 runtime and let my other applications (NetBeans, Oracle, OracleSQLDeveloper, Firefox and MYSQL use the JDK6). I know NEtBeans will allow to specify which JDK but it seems that IE still sees both and screws up.
    Things I tried but didnt work: managing add-ons and I saw items like this Force Internet Explorer to use a specific Java Runtime Environment install?
    from: http://stackoverflow.com/questions/71254/force-internet-explorer-to-use-a-specific-java-runtime-environment-install
    First, disable the currently installed version of Java. To do this, go to Control Panel > Java > Advanced > Default Java for Browsers and uncheck Microsoft Internet Explorer.
    Next, enable the version of Java you want to use instead. To do this, go to (for example) C:\Program Files\Java\jre1.5.0_15\bin (where jre1.5.0_15 is the version of Java you want to use), and run javacpl.exe. Go to Advanced > Default Java for Browsers and check Microsoft Internet Explorer.
    To get your old version of Java back you need to reverse these steps.
    Note that in older versions of Java, Default Java for Browsers is called <APPLET> Tag Support (but the effect is the same).
    The good thing about this method is that it doesn't affect other browsers, and doesn't affect the default system JRE.
    Any ideas?

    bobparis wrote:
    Problem: UConn uses a tool called Blackboard. Blackboard requires Version 1.5.0 (build 1.5.0_07-b03)
    but I develop so NETBeans IDE needs/wants JDK6 ( likes JDK 6 Update 16 )
    Tried managing add-ons in IE, Tried Firefox too.
    What I want is to have IE forced to the JDK5 runtime and let my other applications (NetBeans, Oracle, OracleSQLDeveloper, Firefox and MYSQL use the JDK6). I know NEtBeans will allow to specify which JDK but it seems that IE still sees both and screws up.
    Simple then - bad idea.
    If your minimal target is 1.5 then you develop in 1.5. If you insist on using 1.6 for functional reasons then you will need to maintain two development environments on your box 1.5 and 1.6. You explicitly build support for 1.6 and detection for that into the code and test it using 1.6. And test using 1.5 as well.
    Note you must test both 1.5 and 1.6. Full functional tests.
    Obviously limiting yourself to 1.5 would require less effort (cost.)

  • Using Sub/Super scripts in JCheckboxes

    So I have a JCheckbox and I want it's label to be "t2 symmetry" except I would like the 2 to be in subscript.
    I understand that many swing components support HTML but even using <HTML><sub>subscript</sub></HTML>doesn't work, I figured it was just because the Jcheckbox doesn't support it since I've seen other posts in this forum regarding using HTML or even just a <sub> command. But as I'm building in my NetBeans Matisse setup those command don't work in JLabels either.
    There HAS to be a way to make subscripts work in Java 6 SE.
    What can I do to make this work?
    Thanks.

    In the future, Swing related questions should be posted in the Swing forum.
    It works fine for me.
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
    see http://homepage1.nifty.com/algafield/sscce.html,
    that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    Don't forget to use the "Code Formatting Tags",
    see http://forum.java.sun.com/help.jspa?sec=formatting,
    so the posted code retains its original formatting.

  • SetVisible spacing issue

    Add 3 buttons to a form with the default spacing.
    [button1]__[button2]__[button3]button2.setVisible(false) gives the following
    [button1][button3]I want it to be
    [button1]__[button3]I find it quite annoying that the space around component is lost when a component between is hidden. Does anyone know a way to solve this?
    Edited by: HarryShepard on 05-Jan-2010 11:26
    Added code tags because it was removing underscores

    It works for me using FlowLayout:
    public class TestFlowLayout {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JButton button = new JButton("Two");
                    button.setVisible(false);
                    JPanel panel = new JPanel();
                    panel.add(new JButton("One"));
                    panel.add(button);
                    panel.add(new JButton("Three"));
                    JFrame frame = new JFrame("Test");
                    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    frame.getContentPane().add(panel);
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.setVisible(true);
    }But I'm guessing you're using NetBeans Matisse (with GroupLayout afaik), so better ask on a NetBeans forum.
    Otherwise the Swing forum is a better place.

Maybe you are looking for

  • Installation failed on Windows 7 platform

    I am attempting to install Oracle Enterprise edition on a Windows 7 32 bit platform. During the installation, several errors are displayed stating that certain files could not be found within the installation directory. So I continued from these erro

  • Passing item to pl/sql to modify the query

    hi all, i am new to apex and appreciate any help :) what i am trying to do do is show point of interest on the map, and filter them :) what i already have done: i have a page.1 where is a list and when you click the link it sent you to page.2 with 3

  • How do I open a window at moving button's current location?

    I'm creating a flash movie of various fish swimming across the screen. At the moment I've got each fish as a movie symbol inside a button symbol whose position moves across the screen as the fish swims along. When you click a fish I want text to pop

  • Strange "Help Icon" on start up

    My G4 won't startup fully. I get a strange blue on white help icon in the upper right corner of the screen and that's it. The full menu bar never finishes coming up. I have tried repairing the disk, first with the install CD then with Disk Warrior. D

  • To kill session in one schema from another schema

    Hi Team, I got a problem like a table from one of my schema has been locked. I am getting 'ORA-00054: resource busy and acquire with NOWAIT specified' error when trying to delete rows from that table or even when trying to truncate that table. Let th